Frictional Games Forum (read-only)
GlobalVarIn trouble - 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: GlobalVarIn trouble (/thread-18980.html)



GlobalVarIn trouble - bleakraven - 10-29-2012

Hey there,

I'm trying to script an area where if the player remains in it, after 7 seconds a sound will play. Once the sound triggers, it won't ever happen again. If the player leaves the area before the sound plays, then it can be triggered again.

Here's what I have:

PHP Code:
//LION SETPIECEvoid LionRoar(string &in asParent, string &in asChild, int state){        AddTimer("CountdownToRoar", 7, "LionIsRoaring");        AddDebugMessage("I see you.", false);        if (state == 1)        {         SetGlobalVarInt("InLion", 1);        }        else if (state == -1)        {         SetGlobalVarInt("InLion", 0);        }}
void LionIsRoaring(string &in asTimer){    if (GetGlobalVarIn("InLion") == 1)    {    PlayGuiSound("low_lion_growl.snt"1000);    RemoveEntityCollideCallback("Player""SurpriseLion_1");    RemoveTimer("CountdownToRoar");    AddDebugMessage("Roar."false);    }} 


However, I get a "No matching signatures for GlobalVarInt(string@&)" for my LionIsRoaring func.

Can anyone explain to me what I'm doing wrong or just help me code this in another way?

Cheers

PS: Sorry, idk how to format that nicely for you Confused


RE: GlobalVarIn trouble - Unearthlybrutal - 10-29-2012

Change GetGlobalVarIn("InLion") == 1 with GetGlobalVarInt("InLion") == 1

Edit:
Also if it's only a one map, you can use local variables


RE: GlobalVarIn trouble - bleakraven - 10-29-2012

(10-29-2012, 04:09 PM)Unearthlybrutal Wrote: Change GetGlobalVarIn("InLion") == 1 with GetGlobalVarInt("InLion") == 1

Edit:
Also if it's only a one map, you can use local variables
My god. *blush* Thanks... been staring at code for too long.... Think the code will work for what I need btw? Or know of a way to make it simpler?


RE: GlobalVarIn trouble - Unearthlybrutal - 10-29-2012

(10-29-2012, 04:20 PM)bleakraven Wrote:
(10-29-2012, 04:09 PM)Unearthlybrutal Wrote: Change GetGlobalVarIn("InLion") == 1 with GetGlobalVarInt("InLion") == 1

Edit:
Also if it's only a one map, you can use local variables
My god. *blush* Thanks... been staring at code for too long.... Think the code will work for what I need btw? Or know of a way to make it simpler?
If it works in that way you want, let the code be like that.


RE: GlobalVarIn trouble - bleakraven - 10-29-2012

Actually, while the syntax is correct, my code doesn't seem to stop the sound from happening even if the player leaves the area :\ It doesn't detect the state -1

Can't come up with a way to do it...


RE: GlobalVarIn trouble - Unearthlybrutal - 10-29-2012

(10-29-2012, 04:24 PM)bleakraven Wrote: Actually, while the syntax is correct, my code doesn't seem to stop the sound from happening even if the player leaves the area :\ It doesn't detect the state -1

Can't come up with a way to do it...
Post the "AddEntityCollideCallback" and I'll check if there is something wrong.


RE: GlobalVarIn trouble - bleakraven - 10-29-2012

Thanks mate, that did bring my attention to what was wrong, I had the states as 1 instead of 0. It works flawlessly now! Thanks!


RE: GlobalVarIn trouble - Unearthlybrutal - 10-29-2012

(10-29-2012, 05:35 PM)bleakraven Wrote: Thanks mate, that did bring my attention to what was wrong, I had the states as 1 instead of 0. It works flawlessly now! Thanks!
No problem Smile