Jump to content

Global vs Local


jpg

Recommended Posts

Can anyone explain when one would use a local vs global when setting globals? I really have no clue as to how these differ and haven't been able to find anything that helps explain it...

 

TIA jpg

Link to comment
Can anyone explain when one would use a local vs global when setting globals? I really have no clue as to how these differ and haven't been able to find anything that helps explain it...

 

TIA jpg

Locals are specific to a character - you may have one local LoveTalk value for Jaheira, and a completely separate one for Aerie. I believe they are unavailable to use as triggers in any other character's dialogues, so you will want to be careful not to put anything in there that you'd want someone else commenting on or reacting to. I have no practical experience in this area, so hopefully someone who's made an NPC will drop on by with other tips.

Link to comment

Yeah, locals are local to the script/dialogue they are being used in. Globals can be accessed by anything. Locals can be locals even if there is a global of the same name, but you can't have to globals or locals of the same name, if that makes any sense at all.

 

Icen

Link to comment

So technically, I could put everything as a Global (provided there are no conflicts w existing global tags) but this is rather inelegant (and potentially clunky).

 

Better approach = Everything that is internal to the Cre could / should be done as a local and anything that links to anyone/anything else as a global.

 

Is this a fair / correct summary?

 

Thanks for the help!

jpg

Link to comment

Ultimately, it doesn't much matter which you use, as far as the game is concerned. As a previous poster mentioned, local variables are unique to the CRE, or probably more specifically, the DV, but globals can be used by any script in the game. I mostly just use locals for things I'm never going to need to revisit, like tracking a conversation inside a dialogue or as check variables inside the same script. Since I'm likely to use the same variables in several scripts, for example, banter between NPC1 and NPC2 will only happen if a banter between NPC1 and NPC3 allready did, or that an NPC will "remember" that the PC did a certain thing earlier in the game, I usually use globals, unless I'm really, really sure I'm never going to look at it again. There's nothing more frustrating than getting bug reports because you set a local and you're checking a global.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...