Frictional Games Forum (read-only)
"Moving" the player forward by it self - help please. - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: "Moving" the player forward by it self - help please. (/thread-18733.html)



"Moving" the player forward by it self - help please. - jssjr90 - 10-11-2012

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.


RE: "Moving" the player forward by it self - help please. - Your Computer - 10-11-2012

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


RE: "Moving" the player forward by it self - help please. - Adny - 10-11-2012

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


RE: "Moving" the player forward by it self - help please. - jssjr90 - 10-11-2012

Thank you all ever so much!


RE: "Moving" the player forward by it self - help please. - jssjr90 - 10-12-2012

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??


RE: "Moving" the player forward by it self - help please. - Adny - 10-12-2012

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?


RE: "Moving" the player forward by it self - help please. - jssjr90 - 10-12-2012

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);
}

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


RE: "Moving" the player forward by it self - help please. - jssjr90 - 10-12-2012

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.