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
Script Help MovePlayerForward
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#4
RE: MovePlayerForward

(07-03-2013, 04:23 PM)JustAnotherPlayer Wrote:
Spoiler below!

You have to use a looping timer.

Example;
void TimerOne(string &in asTimer)
{
MovePlayerForward(4.5f);
AddTimer("", 3, "LoopingTimer");
}

void LoopingTimer(string &in asTimer)
{
AddTimer("", 0.2f, "TimerOne");
}

So to speak.


That's not going to be quick enough - that's only going to call MovePlayerForward every 3.2 seconds, the description of the function states "It needs to be called in a timer that updates 60 times / second"
You can also have the timer call the function that it is declared in

void StartPushingPlayer()
{
   PushPlayer(""); // calls PushPlayer once, to start the loop
   AddTimer("KILL_PUSH_LOOP", 5, "KillPushLoop"); // this will stop the pushing loop in the given time
}

void PushPlayer(string &in strTimer)
{
   MovePlayerForward(5); // test the movement speed and adjust this value appropriately
   AddTimer("PUSH_LOOP", 0.016, "PushPlayer"); // this will call PushPlayer again and therefore add another timer
}

void KillPushLoop(string &in strTimer)
{
   RemoveTimer("PUSH_LOOP"); // removes the looping timer, so PushPlayer won't get called again
}

EDIT: changed the code as I realised that the Kill timer was being created repeatedly, which was unnecessary

(This post was last modified: 07-04-2013, 11:39 AM by Adrianis.)
07-03-2013, 05:14 PM
Find


Messages In This Thread
MovePlayerForward - by Pshyched - 07-03-2013, 04:07 PM
RE: MovePlayerForward - by PutraenusAlivius - 07-03-2013, 04:23 PM
RE: MovePlayerForward - by Adrianis - 07-03-2013, 05:14 PM
RE: MovePlayerForward - by DeAngelo - 07-03-2013, 04:33 PM
RE: MovePlayerForward - by WALP - 07-04-2013, 10:41 AM
RE: MovePlayerForward - by DeAngelo - 07-04-2013, 08:57 PM
RE: MovePlayerForward - by vengey - 07-13-2013, 02:23 AM
RE: MovePlayerForward - by Adrianis - 07-15-2013, 01:50 PM



Users browsing this thread: 4 Guest(s)