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
Timer troubles
evertuy Offline
Junior Member

Posts: 46
Threads: 9
Joined: Mar 2011
Reputation: 0
#1
Timer troubles

When you make a function inside of a function with a timer, I don't know how to write that correctly, please tell me how to fix?

Quote:void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Scare_1", true, 1);
}
void Scare_1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "general_chain_rattle_single.snt", 0, false);
GiveSanityDamage(5.0f, true);
AddTimer("Timer_1", 4.0f, "looking");

void looking(string &in asTimer)
{
SetEntityActive("human_skull_1", true);
StartPlayerLookAt("human_skull_1", 6.0f, 7.0f, "");
GiveSanityDamage(5.0f, true);
}

Sucky sucky 5 grand?
04-15-2011, 02:52 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#2
RE: Timer troubles

void OnStart()
{
    AddEntityCollideCallback("Player", "ScriptArea_1", "Scare_1", true, 1);
}

void Scare_1(string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("", "general_chain_rattle_single.snt", 0, false);
    GiveSanityDamage(5.0f, true);
    AddTimer("Timer_1", 4.0f, "looking");
}

void looking(string &in asTimer)
{
    SetEntityActive("human_skull_1", true);
    StartPlayerLookAt("human_skull_1", 6.0f, 7.0f, "");
    GiveSanityDamage(5.0f, true);
}

You forgot a '}' after adding timer.

04-15-2011, 03:02 AM
Website Find
evertuy Offline
Junior Member

Posts: 46
Threads: 9
Joined: Mar 2011
Reputation: 0
#3
RE: Timer troubles

Ohh, I didn't think you needed a } after it, since more or less it is ONE function, (or one and a half).

Sucky sucky 5 grand?
(This post was last modified: 04-15-2011, 03:06 AM by evertuy.)
04-15-2011, 03:05 AM
Find
Dalroc Offline
Member

Posts: 57
Threads: 2
Joined: Mar 2011
Reputation: 0
#4
RE: Timer troubles

(04-15-2011, 03:05 AM)evertuy Wrote: Ohh, I didn't think you needed a } after it, since more or less it is ONE function, (or one and a half).
No, it is 2 functions actually.. The timer calls a whole new function after x amount of seconds, it doesn't pause the script or something.
04-15-2011, 11:21 AM
Find




Users browsing this thread: 1 Guest(s)