A question about local variables.

brother_soifran

Look, Ma! Two Heads!
Gronichonha !
I've look for this on the tutorial part but not found something concret about this...
I've understood that we can create any local variable we want without write it in a file like command or define or etc...
But I'm a little bit Amazed by the way to declare it in the scripts.lst.
I explain me.
I've create a 5th variable call salade (don't laught :) ), to be able to remember if the dude have gave the vegetable or accept the quest to the NPC.
I use FSE and add it after the 4 first:
herebefore,hostile and personal ennemy.
So I have put 4 in the scripts.lst like this:

zvetlana.int ; script de zvetalana # local_vars=5

I've compiled and all has worked fine.
But when I've test my pnj with the zvetlana script on my new artemple map, this last didn't save the statue after the discussion...
After few days of discussion in my forum about this with other rookies french modders, I 've made a test and put 9 instead of 4 in the scripts.lst:
zvetlana.int ; script de zvetalana # local_vars=9

And here, it works...
The NPC remember my name and doesn't start dialogue on the same node...

Someone know why?
At start i 'm saying myself that may be it was the number after the variable in the define wich was important.
the

#define LVAR_Herebefore (4)
#define LVAR_Hostile (5)
#define LVAR_Personal_Enemy (6)
#define LVAR_Looked_Before (7)
#define LVAR_salade (8)

but it seems have not relation...
Any explication maybe?
Thanks

Brother Soifran

my script , if you want to see something else:

[spoiler:050e99e48b]/*
Script for critter tmplete
Script modifié le 15/06/2009
*/




/* Include Files */
#include "..\headers\define.h"

#define NAME SCRIPT_ZVETLANA

#include "..\headers\command.h"

/* Standard Script Procedures */
procedure start;
procedure critter_p_proc;
procedure node001;
procedure node002;
procedure node004;
procedure node005;
procedure node006;
procedure node010;
procedure node011;
procedure node012;
procedure node998;
procedure node999;
procedure node2000;
procedure use_p_proc;
procedure look_at_p_proc;
procedure description_p_proc;
procedure use_skill_on_p_proc;
procedure use_obj_on_p_proc;
procedure damage_p_proc;
procedure map_enter_p_proc;
procedure map_update_p_proc;
procedure talk_p_proc;

/*****************************************************************
Local Variables which are saved. All Local Variables need to be
prepended by LVAR_
*****************************************************************/

#define LVAR_Herebefore (4)
#define LVAR_Hostile (5)
#define LVAR_Personal_Enemy (6)
#define LVAR_Looked_Before (7)
#define LVAR_salade (8)

/*******************************************************************
Imported variables from the Map scripts. These should only be
pointers and variables that need not be saved. If a variable
Needs to be saved, make it a map variable (MVAR_)
*******************************************************************/

/*******************************************************************
Local variables which do not need to be saved between map changes.
*******************************************************************/


/*******************************************************************
******* PROCEDURES *******
*******************************************************************/


/*******************************************************************
The start procedure is the first procedure called when the map is
first entered. Any initial information that needs to be set up
should be placed in here.
*******************************************************************/

procedure start begin
end

procedure timed_event_p_proc begin
end

/********************************************************************
********************************************************************/

procedure use_p_proc begin
end

/***************************************************************************
This is cursory glance description that the player will receive should
he just pass the Action Cursor over. Examines which give more information
need to be in the description_p_proc procedure.
***************************************************************************/

procedure look_at_p_proc begin
script_overrides;
if (local_var(LVAR_Looked_Before) == 0) then
display_msg(mstr(100));
else
display_msg(mstr(101));
end


procedure description_p_proc begin
script_overrides;
display_msg(mstr(102));
end



procedure use_skill_on_p_proc begin
end


procedure use_obj_on_p_proc begin
end


/******************************************************************************************
IF it gets damaged
******************************************************************************************/

procedure damage_p_proc begin
end

/***************************************************************************************
Whenever the map is first entered, this procedure will be called.
***************************************************************************************/

procedure map_enter_p_proc begin
end


/**************************************************************************************
This procedure gets called roughly every 30 seconds of real time.
**************************************************************************************/

procedure map_update_p_proc begin
end

/**************************************************************************************
This is used for any dialogue that may need to occur with the player.
**************************************************************************************/

procedure talk_p_proc begin
if (local_var(LVAR_salade)==1) then //quand la quête est active
begin start_gdialog(NAME,self_obj,4,-1,-1);
gSay_Start;
call Node010;
gSay_End;
end_dialogue;
end
if (local_var(LVAR_salade)==0) then //la premiere fois et tant que la quête n'est pas prise.
begin start_gdialog(NAME,self_obj,4,-1,-1);
gSay_Start;
call Node001;
gSay_End;
end_dialogue;
end
if (local_var(LVAR_salade)==2) then //quand la quête est finie
float_msg(Self_obj,mstr(123),FLOAT_MSG_GREEN);
end

//Dialog created by Fallout Script Editor
//Look at www.fmc.prv.pl
//~~~~~~~~~~~~~~~~ FSE STARTS HERE

// question:chasse bonne?

procedure node001
begin
//set_local_var(LVAR_salade,0);
Reply(103);
giq_option(4,NAME,104,node002,49);//{erff, non, j'ai fait choux blanc...}
giq_option(4,NAME,105,node002,50);/*{non, j'ai pas eut de bol, j'ai aligné
ce gecko, et PAN! sous l'impact, il a reculé et est tombé dans le ravin...}*/
giq_option(4,NAME,106,node004,51);/*{non, je suis allé me promener,
je ne me sentais pas l'âme d'un chasseur aujourd'hui.}*/

end

// Answer to: erff, non, j'ai fait choux blanc...

procedure node002
begin
Reply(107);
giq_option(4,NAME,110,node005,49);//{Combien est ce qu'il en faut?}
giq_option(4,NAME,113,node006,50);/*{bofff... moi le jardinage, j'y
connais rien, vas 'y toi, je vais m'ouvrir une mousse}*/

end

// Answer to: non, je suis allé me promener, je ne me sentais p

procedure node004
begin
gSay_Message(NAME,109,50);

end

// Answer to: Combien est ce qu'il en faut?

procedure node005
begin
set_local_var(LVAR_salade,1);
Reply(111);
giq_option(4,NAME,112,node999,49);

end

// Answer to: bofff... moi le jardinage, j'y connais rien, vas

procedure node006
begin
set_local_var(LVAR_salade,2);
gSay_Message(NAME,114,50);

end

// END DIALOGUE.

procedure node999
begin

end

// START COMBAT.

procedure node998
begin

end

// START DIALOGUE (DUMB PLAYER).

procedure node2000
begin

end

// quête des salades

procedure node010
begin
gsay_reply(1304,116);
giq_option(4,1304,117,node011,49);

end

// Answer to: Erff ouais j'ai un peu galéré, 'y en avait que 2

procedure node011
begin
set_local_var(LVAR_salade,2);
if obj_carrying_pid_obj(dude_obj,(PID_SALADE >= 3)) then
rm_obj_from_inven(Dude_obj,PID_SALADE==3);
gsay_reply(1304,119);
giq_option(4,1304,120,node012,49);

end

// Answer to: Bon je te laisse j'vais bricoler un peu, a plus !

procedure node012
begin
gSay_Message(1304,118,50);

end

//xxxxxxxxxxxxxxxxxxxx

procedure critter_p_proc
begin
/*if (local_var(LVAR_Herebefore) == 0) and (tile_distance_objs( self_obj, dude_obj ) <25>5) and (local_var(0)==0) and obj_can_see_obj(self_obj,dude_obj)
then animate_run_to_tile(tile_num(dude_obj));
set_local_var(LVAR_Herebefore,1);
If (local_var(LVAR_Herebefore)==0) and (obj_can_see_obj(Self_obj,dude_obj)) then float_msg(Self_obj,mstr(103),FLOAT_MSG_GREEN);
set_local_var(LVAR_Herebefore,1);
animate_move_obj_to_tile(Self_obj,17496,1);*/
end

//Dialog created by Fallout Script Editor
//Look at www.fmc.prv.pl
//~~~~~~~~~~~~~~~~ FSE STARTS HERE

// question:chasse bonne?
//xxxxxxxxxxxxxxxxxxxx[/spoiler:050e99e48b]
 
There is a problem with Windows XP. Some early bugs I got in Shattered Destiny occured only on XP systems - and only with variables. Things worked on Win2k like I wanted to (I created SD on a Win2k system and only tested with it) and on WinXP it didn't worked anymore. There I needed to increase the number of variables and right after that the problem was solved.

I am not 100% sure why and stuff, but normally it goes well if you take the variable number and add +1. So if your var is 8, write down 9 in scripts.lst, etc.
 
Hello Lexxx, thank for replying.
You're right.
It seems to have a kind of bug with Windows Xp...
But by puting N+1 in the number of variable in the script list, it fixes it... :)
Schuss

(I return on the cathedral ;) )

Brother Soifran (normal for a brother :) )
 
Back
Top