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
Move Player / Remove Timers
Shirder Offline
Junior Member

Posts: 6
Threads: 2
Joined: Dec 2011
Reputation: 0
#10
RE: Move Player / Remove Timers

(05-22-2013, 01:07 AM)JustAnotherPlayer Wrote:
Spoiler below!
void ResAreaSign(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(false);
SetMessage("Thoughts", "RestrictedArea", 5.0);
StartPlayerLookAt("SignArea_1", 5, 5, "");
AddTimer("", 2.0f, "TurnAround");
}

void TurnAround(string &in asTimer)
{
StartPlayerLookAt("SignArea_3", 5, 5, "");
AddTimer("", 0.5f, "StartWalking");
}

void StartWalking(string &in asTimer)
{
MovePlayerForward(5.0f);
AddTimer("", 0.01f, "RepeatWalking");
}

void RepeatWalking(string &in asTimer)
{
AddTimer("RepeatWalk", 0.01f, "StartWalking");
AddTimer("", 3.0f, "StopWalking");
}

void StopWalking(string &in asTimer)
{
RemoveTimer("StartWalking");
RemoveTimer("RepeatWalking");
StopPlayerLookAt();
AddTimer("", 0.5, "GiveControlBack");
}

void GiveControlBack(string &in asTimer)
{
SetPlayerActive(true);
}

Try this.

Did nothing. But thanks anyway^^

Well, after about one hour of pure trial&error, I got rid of it at last.
I needed to name the timers, and if I want to remove them, it's not RemoveTimer("MyFunc"), but RemoveTimer("TimerName").
Spoiler below!
void TurnAround(string &in asTimer)
{
[...]
AddTimer("Start", 0.5f, "StartWalking");
AddTimer("", 1.5f, "StopEverything");
}

void StartWalking(string &in asTimer)
{
MovePlayerForward(5.0f);
AddTimer("Repeat", 0.01f, "RepeatWalking");
}

void RepeatWalking(string &in asTimer)
{
AddTimer("Start", 0.01f, "StartWalking");
}

void StopEverything(string &in asTimer)
{
[...]
RemoveTimer("Start");
RemoveTimer("Repeat");
}
Now he's standing still after 1,5 seconds. Some more finetuning and I'm done :D

If anybody has the same problem and comes across this thread, here's a brief remark:
I thought it was poorly explained in Game Timers, but if you pay attention, it says "string &in asName", not "string &in asFunction".

English isn't my first language, so please forgive my grammar mistakes :D
(This post was last modified: 05-22-2013, 11:34 AM by Shirder.)
05-22-2013, 11:33 AM
Find


Messages In This Thread
Move Player / Remove Timers - by Shirder - 05-20-2013, 06:10 PM
RE: Move Player - by Slanderous - 05-20-2013, 06:29 PM
RE: Move Player - by OriginalUsername - 05-20-2013, 06:35 PM
RE: Move Player - by Adrianis - 05-20-2013, 07:08 PM
RE: Move Player - by Shirder - 05-20-2013, 08:41 PM
RE: Move Player - by Adrianis - 05-21-2013, 02:45 AM
RE: Move Player - by PutraenusAlivius - 05-21-2013, 02:43 AM
RE: Move Player - by Shirder - 05-21-2013, 10:20 PM
RE: Move Player / Remove Timers - by Shirder - 05-22-2013, 11:33 AM
RE: Move Player / Remove Timers - by Adrianis - 05-22-2013, 01:03 PM



Users browsing this thread: 3 Guest(s)