[SCRIPT] Scripting/Variables problem. - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: [SCRIPT] Scripting/Variables problem. (/thread-20181.html) Pages:
1
2
|
RE: Scripting/Variables problem. - FlawlessHappiness - 02-04-2013 Something is completely wrong inside the void Callback2. You cannot have a void-callback inside another callback. That doesn't make any sense. RE: Scripting/Variables problem. - FlawlessHappiness - 02-04-2013 Could you please tell me a little clearer what you want to happen? I'm a little sleepy now, so i'll go to bed, but i might check up on it tomorrow RE: Scripting/Variables problem. - Adrianis - 02-05-2013 I'm not sure I get exactly what you are trying to do, but... void Callback2(string &in asEntity, int alState) { AddLocalVarInt("Variable", 1); if (GetLocalVarInt("Variable") == 0) { AddEntityCollideCallback("Player", "Area_3", "MoveWeepingAngel1", true, 0); AddEntityCollideCallback("Player", "Area_4", "MoveWeepingAngel2", true, 0); AddEntityCollideCallback("Player", "Area_5", "MoveWeepingAngel3", true, 0); AddEntityCollideCallback("Player", "Area_6", "MoveWeepingAngel4", true, 0); } } That 'if' will never evaluate to true (unless 'Variable' is initialised to a minus number), because you are adding 1 before it checks if it is 0, which clearly it is not. That means those 4 collide callbacks are not getting added, which may or may not prevent everything from working... RE: Scripting/Variables problem. - FlawlessHappiness - 02-05-2013 void OnStart() { AddEntityCollideCallback("Player", "Area_3", "CheckAreas", false, 0); AddEntityCollideCallback("Player", "Area_4", "CheckAreas", false, 0); AddEntityCollideCallback("Player", "Area_5", "CheckAreas", false, 0); AddEntityCollideCallback("Player", "Area_6", "CheckAreas", false, 0); } void CheckAreas(string &in asParent, string &in asChild, int alState) { if(alState == 1) { if(asChild == "Area_3") { SetLocalVarInt("Area_3", 1); } if(asChild == "Area_4") { SetLocalVarInt("Area_4", 1); } if(asChild == "Area_5") { SetLocalVarInt("Area_5", 1); } if(asChild == "Area_6") { SetLocalVarInt("Area_6", 1); } SetLocalVarInt("InsideArea", 1); } if(alState == -1) { SetLocalVarInt("InsideArea", 0); if(asChild == "Area_3") { SetLocalVarInt("Area_3", 0); } if(asChild == "Area_4") { SetLocalVarInt("Area_4", 0); } if(asChild == "Area_5") { SetLocalVarInt("Area_5", 0); } if(asChild == "Area_6") { SetLocalVarInt("Area_6", 0); } } } void Callback2(string &in asEntity, int alState) { if(GetLocalVarInt("InsideArea") == 1) { if(alState == 1) { } if(alState == 0) { if(GetLocalVarInt("Area_3") == 1) { //DO STUFF IF INSIDE AREA 3 } if(GetLocalVarInt("Area_4") == 1) { //DO STUFF IF INSIDE AREA 4 } if(GetLocalVarInt("Area_5") == 5) { //DO STUFF IF INSIDE AREA 3 } if(GetLocalVarInt("Area_6") == 6) { //DO STUFF IF INSIDE AREA 3 } } } } This is how i understood it. RE: Scripting/Variables problem. - FlawlessHappiness - 02-05-2013 I need to know what is not working... RE: Scripting/Variables problem. - FlawlessHappiness - 02-05-2013 Let me try to understand what you want: There are 4 areas. When you collide with any of them a callback will check if you are looking at the angel. If you are looking away from it, a new callback will call? RE: Scripting/Variables problem. - FlawlessHappiness - 02-05-2013 Ok, i editted the post with the script. RE: Scripting/Variables problem. - FlawlessHappiness - 02-05-2013 I don't know. Seems like my script doesn't work. I haven't tested it myself... I'm sorry RE: Scripting/Variables problem. - Adrianis - 02-08-2013 Looking through your most recently posted script, I can't see anything that's actually calling Callback2? Unless that's not the most up to date script, that might be a problem... RE: Scripting/Variables problem. - Adrianis - 02-08-2013 (02-08-2013, 05:11 PM)Robosprog Wrote: In the new script something does still nothing. 'Something' sounds pretty ominous Do you want to post the new script up? That way, we may be able to accurately pin down the issue |