Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GlobalVarIn trouble
bleakraven Offline
Junior Member

Posts: 8
Threads: 3
Joined: Oct 2012
Reputation: 0
#1
GlobalVarIn trouble

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: (Select All)
//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
(This post was last modified: 10-29-2012, 05:36 PM by bleakraven.)
10-29-2012, 04:00 PM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#2
RE: GlobalVarIn trouble

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

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

When Life No Longer Exists
Full-conversion mod
(This post was last modified: 10-29-2012, 04:17 PM by Unearthlybrutal.)
10-29-2012, 04:09 PM
Website Find
bleakraven Offline
Junior Member

Posts: 8
Threads: 3
Joined: Oct 2012
Reputation: 0
#3
RE: GlobalVarIn trouble

(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
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#4
RE: GlobalVarIn trouble

(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.

When Life No Longer Exists
Full-conversion mod
10-29-2012, 04:23 PM
Website Find
bleakraven Offline
Junior Member

Posts: 8
Threads: 3
Joined: Oct 2012
Reputation: 0
#5
RE: GlobalVarIn trouble

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...
(This post was last modified: 10-29-2012, 04:26 PM by bleakraven.)
10-29-2012, 04:24 PM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#6
RE: GlobalVarIn trouble

(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.

When Life No Longer Exists
Full-conversion mod
10-29-2012, 04:34 PM
Website Find
bleakraven Offline
Junior Member

Posts: 8
Threads: 3
Joined: Oct 2012
Reputation: 0
#7
RE: GlobalVarIn trouble

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
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#8
RE: GlobalVarIn trouble

(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

When Life No Longer Exists
Full-conversion mod
10-29-2012, 06:39 PM
Website Find




Users browsing this thread: 1 Guest(s)