Frictional Games Forum (read-only)

Full Version: GlobalVarIn trouble
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
Change GetGlobalVarIn("InLion") == 1 with GetGlobalVarInt("InLion") == 1

Edit:
Also if it's only a one map, you can use local variables
(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?
(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.
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...
(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.
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!
(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