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
"Moving" the player forward by it self - help please.
jssjr90 Offline
Member

Posts: 169
Threads: 39
Joined: Jun 2011
Reputation: 0
#1
"Moving" the player forward by it self - help please.

Well I have came across new pice of script that I have not tried yet and well need some help.
The setup of the script is this. You lay down on a hospital bed and you are being pushed along the hallway.
Vary much similer to whitenight scene in the into. I relay do not understand why the script is not doing
what is supposed to do. I have it all set up correctly, at least I think.
-Known bugs in the script: Does not update like it should with the included timer that repetes. Also when it does "move" the player, it is just a ever so slight nudge and just stops, this happens on every value I give it.
Here is the script I have so far. I like to keep things as little as possible.
void Forcer(string &in asTimer)
{
SetEntityActive("infirmary_hospital_bed_33", false);
//AddPlayerBodyForce( 5900.0f, 0, 0, false); //Could try this one but it does the same thing as "MovePlayerForward"
MovePlayerForward(2300.0f);
AddTimer("", 0.5f, "Forcer"); //This should repete the script but ignores it.
}


Well if anyone has a script of the idea of you moving along a hallway in a hospital bed let me know.
(This post was last modified: 10-12-2012, 05:31 AM by jssjr90.)
10-11-2012, 09:54 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: "Moving" the player forward by it self - help please.

A force of 10 with a timer interval of 0.15 worked well for me.

Tutorials: From Noob to Pro
10-11-2012, 10:07 PM
Website Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#3
RE: "Moving" the player forward by it self - help please.

void Forcer(string &in asTimer)
{
SetEntityActive("infirmary_hospital_bed_33", false);
MovePlayerForward(1.0f);
AddTimer("moveplayer", 0, "Forcer");
}

That should work; here's a way I used it in one of my own maps:

Spoiler below!

void MoveForward(string &in asTimer)
{
MovePlayerForward(1.0f);
AddTimer("automove", 0, "MoveForward");
}

void CollideAreaGrunt(string &in asParent, string &in asChild, int alstate)
{
RemoveTimer("automove");
AddTimer("", 1.25f, "LookGrunt");
}


If you still have any problems with the MovePlayerForward function, it may be attributed to how you originally call/start the timer.


If I may offer an alternative, there are 2 specific functions (startplayerlookat+fadeplayerrollto) that when used together can make a cool camera hovering effect (it will move smoothly in one line).

Hope that helped Big Grin

I rate it 3 memes.
10-11-2012, 10:08 PM
Find
jssjr90 Offline
Member

Posts: 169
Threads: 39
Joined: Jun 2011
Reputation: 0
#4
RE: "Moving" the player forward by it self - help please.

Thank you all ever so much!
10-11-2012, 11:28 PM
Find
jssjr90 Offline
Member

Posts: 169
Threads: 39
Joined: Jun 2011
Reputation: 0
#5
RE: "Moving" the player forward by it self - help please.

Great! Now I half run into a serious problem. How would I kill the "Moving by it self" script? And when ever I pause the game when the player run state is set to 0, and get back in the game, the player will "fall" and hurt him self and cause big major lag all the time. And my PC is a power house so it must be a engine bug. Any thoughts on how to get around this??
10-12-2012, 02:28 AM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#6
RE: "Moving" the player forward by it self - help please.

Quote:
void MoveForward(string &in asTimer)
{
MovePlayerForward(1.0f);
AddTimer("automove", 0, "MoveForward");
}

void CollideAreaGrunt(string &in asParent, string &in asChild, int alstate)
{
RemoveTimer("automove");
AddTimer("", 1.25f, "LookGrunt");
}

The first part of my script demonstrates how to use the walking function, and the second part shows how to stop it; when you start the original timer, give it an internal name. Set up a new entity collide callback, and when it is triggered, remove the timer (using the internal name).

I'm not sure if I understand your second problem at all; could you be more specific?

I rate it 3 memes.
(This post was last modified: 10-12-2012, 03:06 AM by Adny.)
10-12-2012, 03:06 AM
Find
jssjr90 Offline
Member

Posts: 169
Threads: 39
Joined: Jun 2011
Reputation: 0
#7
RE: "Moving" the player forward by it self - help please.

Well I have the hospital bed going down a hall, like you are on it rolling down, then I fade the screen to black and telaporting the player to a patient room, where he is laying on another hospital bed. At this point when I press the pause menu and go back in game, the player will automatically hurt him self and the frame rate will drop drastically infinity. Well here is my code so far.

/////////////////////////////////////


//Begin hospital bed moving down the hall.
void MoveForward(string &in asTimer)
{
AddTimer("", 20, "FO");
FadePlayerRollTo(1.0f, 0.5f, 0.5f);
SetPlayerMoveSpeedMul(0.8f);
SetPlayerLookSpeedMul(0);
MovePlayerForward(1.0f);
AddTimer("", 0, "MoveForward");
AddTimer("", 43, "NEXT");
}

//"Ends" the moving down the hall and teleporting back to a diffrent room.
void FO(string &in asTimer)
{
RemoveTimer("MoveForward");
FadeOut(3);
}

//I decited to restore all movement speeds back to normal while retaining "playeractive- false" still into play.
void NEXT(string &in asTimer)
{
SetPlayerMoveSpeedMul(1.0f);
SetPlayerRunSpeedMul(1.0f);
SetPlayerLookSpeedMul(1.0f);
AddTimer("", 1, "NEXT2");
FadeOut(3);
StopPlayerLookAt();
}
void NEXT2(string &in asTimer)
{
StartPlayerLookAt("ddd", 1.0f, 1.0f, "");
TeleportPlayer("ER3");
AddTimer("", 1.0f, "NEXT3");
}
//Fade in the screen to normal state.
void NEXT3(string &in asTimer)
{
FadeIn(0.5f);
//PlaySoundAtEntity("", "spot.snt", "Player", 0.0f, true);
StartEffectFlash(0.0f, 1.0f, 2.0f);
}

///////////////////////////////////////////////////////////
10-12-2012, 03:16 AM
Find
jssjr90 Offline
Member

Posts: 169
Threads: 39
Joined: Jun 2011
Reputation: 0
#8
RE: "Moving" the player forward by it self - help please.

All solved. The main problem was I had to make the hospital bed (2) with no collision, and make every new scene act upon a collide call back, before it was just all timers. Best to use collide callbacks for best precision in scenes to avoid logic errors.
10-12-2012, 05:31 AM
Find




Users browsing this thread: 1 Guest(s)