PDA

View Full Version : Creating a custom Boolean?


Gavroche
01-23-2008, 10:08 AM
Is it possible to set a custom boolean in a first, firing script, and to use it in a second, conditionnal script? Will the game recognize it, provided I enter the name of the boolean correctly, even though it's not a boolean from the original game?


Example:

void main()
{
SetGlobalBoolean("Has_eaten_an_apple",TRUE);
}



#include "k_inc_debug"


int StartingConditional()
{
int iResult;

iResult = GetGlobalBoolean("Has_eaten_an_apple")==TRUE;
return iResult;
}

In a first .dlg, I Force Persuade a character to eat an apple (which fires the first script, which sets Has_eaten_an_apple as true). Later (after having visited one or two planets), this character spawns, I talk to him and if Has_eaten_an_apple is true (conditionnal script located in the second .dlg), then he tells me thanks for the fruit.


Will this work even though the game has no "Has_eaten_an_apple" boolean as-is?



NB: Please, please, don't ask me why I chose such an example XD

stoffe
01-24-2008, 07:11 AM
Is it possible to set a custom boolean in a first, firing script, and to use it in a second, conditionnal script? Will the game recognize it, provided I enter the name of the boolean correctly, even though it's not a boolean from the original game?


Yes, you can add new Global variables to the game and use them in scripts. To make the game recognize them you must first add them to the globalcat.2da file though.

Gavroche
01-24-2008, 04:08 PM
Ah, I should have thought there would *also* be a .2da for variables. There are .2da's for everything actually ^^

Thanks stoffe! It does work now.