blinkyzero 15 Posted May 12, 2015 Hi folks. The AI/difficulty mod I'm working on needs a way to keep track of a few variables on enemies, and currently I'm using a token system that places/checks for dummy items in enemy inventories (and then removes them on death). It works just fine, but is a touch inelegant. I'd rather use local booleans. However, I can't find much information on which boolean values are unused in KotOR1. Stoffe has some info about them in KotOR2 over on LucasForums, but K1 is a different beast (the first and most pressing difference being that K1 booleans seem to cap out at 95). 95 itself doesn't like being toggled, but 92, 93, and 94 work. Anyone know if these are free for the entire game or if they're used somewhere I haven't found? The boolean defines in k_inc_generic and elsewhere don't seem to use anything above 72, but I am deeply suspicious. Quote Share this post Link to post Share on other sites
Salk 374 Posted July 11, 2016 It would be very interesting to find out more about how KotOR local variables work. Sad to see that the OP's query has got no attention whatsoever. Quote Share this post Link to post Share on other sites
Salk 374 Posted July 11, 2016 Like it is pretty common when creating new .dlg lines, I find myself in need of having some replies appear only once and cannot use the "k_con_talkedto"/"k_act_talktrue" combo. This seems to be ideal for local booleans so this is what I did. I created two simple scripts. The first a conditional: int StartingConditional() { if (GetLocalBoolean(OBJECT_SELF, 53) == 0) { return 1; } else { return 0; } } The second a variable set: void main() { SetLocalBoolean(OBJECT_SELF, 53, 1); } When I tested it, it did work but I am not sure I am not doing anything wrong. First question is: where am I actually storing the variable? Second question: is 53 a good choice? I am not sure I understood how some numbers are "reserved" by the game and shouldn't be used? If someone could shed some lights, it'd be great. Thanks! Quote Share this post Link to post Share on other sites
blinkyzero 15 Posted August 28, 2016 Like it is pretty common when creating new .dlg lines, I find myself in need of having some replies appear only once and cannot use the "k_con_talkedto"/"k_act_talktrue" combo. This seems to be ideal for local booleans so this is what I did. I created two simple scripts. The first a conditional: int StartingConditional() { if (GetLocalBoolean(OBJECT_SELF, 53) == 0) { return 1; } else { return 0; } } The second a variable set: void main() { SetLocalBoolean(OBJECT_SELF, 53, 1); } When I tested it, it did work but I am not sure I am not doing anything wrong. First question is: where am I actually storing the variable? Second question: is 53 a good choice? I am not sure I understood how some numbers are "reserved" by the game and shouldn't be used? If someone could shed some lights, it'd be great. Thanks! Hi Salk -- I was poking around today, trying to see if anyone had looked into this question at all since last year. No joy, looks like. However, I think that in k_inc_generic the developers (mostly) documented the local numbers they ended up using. Here's what we've got there: //LOCAL BOOLEANS RANGE FROM 0 to 96 int AMBIENT_PRESENCE_DAY_ONLY = 1; //POSSIBLE CUT int AMBIENT_PRESENCE_NIGHT_ONLY = 2; //POSSIBLE CUT int AMBIENT_PRESENCE_ALWAYS_PRESENT = 3; int SW_FLAG_EVENT_ON_PERCEPTION = 20; int SW_FLAG_EVENT_ON_ATTACKED = 21; int SW_FLAG_EVENT_ON_DAMAGED = 22; int SW_FLAG_EVENT_ON_FORCE_AFFECTED = 23; int SW_FLAG_EVENT_ON_DISTURBED = 24; int SW_FLAG_EVENT_ON_COMBAT_ROUND_END = 25; int SW_FLAG_EVENT_ON_DIALOGUE = 26; int SW_FLAG_EVENT_ON_DEATH = 27; int SW_FLAG_EVENT_ON_HEARTBEAT = 28; //int SW_FLAG_AMBIENT_ANIMATIONS = 29; located in k_inc_walkways //int SW_FLAG_AMBIENT_ANIMATIONS_MOBILE = 30; located in k_inc_walkways int SW_FLAG_FAST_BUFF = 31; //POSSIBLE CUT int SW_FLAG_ASC_IS_BUSY = 32; //POSSIBLE CUT int SW_FLAG_ASC_AGGRESSIVE_MODE = 33; //POSSIBLE CUT int SW_FLAG_AMBIENT_DAY_ONLY = 40; //POSSIBLE CUT int SW_FLAG_AMBIENT_NIGHT_ONLY = 43; //POSSIBLE CUT int SW_FLAG_EVENT_ON_SPELL_CAST_AT = 44; int SW_FLAG_EVENT_ON_BLOCKED = 45; int SW_FLAG_ON_DIALOGUE_COMPUTER = 48; int SW_FLAG_FORMATION_POSITION_0 = 49; //POSSIBLE CUT int SW_FLAG_FORMATION_POSITION_1 = 50; //POSSIBLE CUT int SW_FLAG_FORMATION_POSITION_2 = 51; //POSSIBLE CUT int SW_FLAG_FORMATION_POSITION_3 = 52; //POSSIBLE CUT int SW_FLAG_FORMATION_POSITION_4 = 53; //POSSIBLE CUT int SW_FLAG_FORMATION_POSITION_5 = 54; //POSSIBLE CUT int SW_FLAG_FORMATION_POSITION_6 = 55; //POSSIBLE CUT int SW_FLAG_FORMATION_POSITION_7 = 56; //POSSIBLE CUT int SW_FLAG_FORMATION_POSITION_8 = 57; //POSSIBLE CUT int SW_FLAG_FORMATION_POSITION_9 = 58; //POSSIBLE CUT //int SW_FLAG_TARGET_FRIEND = 59; Located in k_inc_gensupport int SW_FLAG_COMMONER_BEHAVIOR = 60; int SW_FLAG_SPECTATOR_STATE = 61; int SW_FLAG_AI_OFF = 62; int SW_CANDEROUS_COMBAT_REGEN = 63; int SW_FLAG_BOSS_AI = 64; int SW_FLAG_SHIELD_USED = 65; int SW_FLAG_EVENT_ON_DIALOGUE_END = 66; int SW_FLAG_RESISTANCES_APPLIED = 67; int SW_FLAG_EVENT_DIALOGUE_END = 68; //User defined event //This flag is set when the creature percieves a hostile for the first time. //Used to eliminate the delay a creature puts on his perception event when first seeing a hostile. int SW_FLAG_STATE_AGITATED = 69; int SW_FLAG_MALAK_AI_ON = 70; int SW_FLAG_DYNAMIC_COMBAT_ZONE = 71; int SW_FLAG_EVENT_ON_DIALOGUE_INTERRUPT = 72; I'm pretty sure those formation flags from 49 to 58 never got used, so they could very well be fine to mess with. Quote Share this post Link to post Share on other sites
JCarter426 1,215 Posted August 28, 2016 if (GetLocalBoolean(OBJECT_SELF, 53) == 0) { This part is problematic. Local booleans behave a little weirdly, so to avoid issues I'd recommend calling them in the following ways: if( GetLocalBoolean(OBJECT_SELF, 53) ) { or if( !GetLocalBoolean(OBJECT_SELF, 53) ) { I forget what the issue is precisely, but it's something along the lines of they can never be set to false; they're either true or not true. 1 Quote Share this post Link to post Share on other sites
blinkyzero 15 Posted August 28, 2016 This part is problematic. Local booleans behave a little weirdly, so to avoid issues I'd recommend calling them in the following ways: if( GetLocalBoolean(OBJECT_SELF, 53) ) { or if( !GetLocalBoolean(OBJECT_SELF, 53) ) { I forget what the issue is precisely, but it's something along the lines of they can never be set to false; they're either true or not true. Oops, yeah -- I didn't even notice Salk was checking the booleans the other way. JCarter's definitely right. Use the method he described. Quote Share this post Link to post Share on other sites
Salk 374 Posted August 29, 2016 I will!Thanks for your help, guys! Quote Share this post Link to post Share on other sites
Salk 374 Posted January 21, 2022 Just a small note about Local Boolean 54. During my testing I discovered that the Kath Hounds on Dantooine use it for some purpose. Quote Share this post Link to post Share on other sites