Posted by: plainab
« on: March 30, 2012, 05:04:12 PM »you set GLOBAL, LOCALS, AREA variables based on events happening via scripting (baf/bcs) or dialog choices taken via dialog files (d/dlg)
So if you know the conditions that you want a certain variable to be changed by then you can merely set that variable to the new number when those conditions happen
Using your example.
If PC talks to one NPC and agrees to do something and "Glob1" gets set to 3...
should PC talk to the same NPC and agrees to do something else and thus sets "Glob2" to 5
You could then have in a script a small block
You could do this in Near Infinity as well, as it's a matter of keeping track of the variables in script & dialog. Tho I do think that it is easier to keep track of using the baf & d file formats of weidu
Do note that LOCALS only affects the creature running the script or dialog file and those values are not stored between game sessions. If they are important values that you need to access between game sessions then you need to use GLOBAL since GLOBALs are stored in the save file.
One thing to note, there is some funkiness about when variables are actually set. Scripts set the variables at the end of the script parsing round so, the block above in the example would force the script to reparse and set the variable, however it also leads to the possibility that other actions from the same script or higher script levels may take place before that which relies on the newly set variable. Dialog files on the other hand are even trickier, you'll have to ask someone even more knowledgeable about that. Dialog is not my strong point.
So if you know the conditions that you want a certain variable to be changed by then you can merely set that variable to the new number when those conditions happen
Using your example.
If PC talks to one NPC and agrees to do something and "Glob1" gets set to 3...
should PC talk to the same NPC and agrees to do something else and thus sets "Glob2" to 5
You could then have in a script a small block
Code: [Select]
IF
Global("Glob1","LOCALS",3)
Global("Glob2","LOCALS",5)
THEN
RESPONSE #100
SetGlobal("Glob3","LOCALS",8)
END
now then the next time the NPC is spoken to or the next time the script is parsed whatever you have set up to happen for when "Glob3" is 8 will happen.You could do this in Near Infinity as well, as it's a matter of keeping track of the variables in script & dialog. Tho I do think that it is easier to keep track of using the baf & d file formats of weidu
Do note that LOCALS only affects the creature running the script or dialog file and those values are not stored between game sessions. If they are important values that you need to access between game sessions then you need to use GLOBAL since GLOBALs are stored in the save file.
One thing to note, there is some funkiness about when variables are actually set. Scripts set the variables at the end of the script parsing round so, the block above in the example would force the script to reparse and set the variable, however it also leads to the possibility that other actions from the same script or higher script levels may take place before that which relies on the newly set variable. Dialog files on the other hand are even trickier, you'll have to ask someone even more knowledgeable about that. Dialog is not my strong point.