Frictional Games Forum (read-only)
[SCRIPT] Using MovePlayerForward Script - 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: [SCRIPT] Using MovePlayerForward Script (/thread-14539.html)



Using MovePlayerForward Script - heyitsrobert97 - 04-06-2012

Hey, I need to know How to Use This Script Code
MovePlayerForward(float afAmount)



“REQUIRES THE 1.2 PATCH: JUSTINE” Moves the player forward. It needs to be called in a timer that updates 60 times / second.

I entered it into one timer like this and it doesn't even move!

AddUseItemCallback("", "acidjar_1", "pathblock_1", "placeacid", true);
}

void placeacid(string &in asItem, string &in asEntity)
{
RemoveItem("acidjar_1");
SetEntityActive("explosivejar", true);
SetPlayerActive( false);
StartPlayerLookAt("walkto", 10.0f, 10.0f, "");
AddEntityCollideCallback("Player", "walkto", "lookexplosion", true, 1);
AddTimer("walktotimer", 0.3f, "atwalkto");
}

void atwalkto(string &in asTimer)
{
MovePlayerForward(15.0f);
}

void lookexplosion(string &in asParent, string &in asChild, int alState)
{
StopPlayerLookAt();
StartPlayerLookAt("explosivetable", 10.0f, 10.0f, "");
AddTimer("explodetimer", 1.0f, "explosion");
}

void explosion(string &in asTimer)
{
CreateParticleSystemAtEntity("", "ps_break_cavein.ps", "explosivejar", false);
StartEffectFlash(0.0f, 1.0f, 0.2f);
PlaySoundAtEntity("", "explosion_rock_large.snt", "barrel_1", 0, false);
SetEntityActive("explosivejar", false);
SetEntityActive("pathblock_1", false);
SetEntityActive("explosivetable", false);
SetPlayerActive( true);
}

Any Help It was supposed to be a thing where when you place explosives the player deactivates and walks to a script area, and then the jar explodes. but the Move Script isnt working.



RE: Using MovePlayerForward Script - Statyk - 04-06-2012

It is not looping the timer. do something like:

void placeacid(string &in asItem, string &in asEntity)
{
RemoveItem("acidjar_1");
SetEntityActive("explosivejar", true);
SetPlayerActive( false);
StartPlayerLookAt("walkto", 10.0f, 10.0f, "");
AddEntityCollideCallback("Player", "walkto", "lookexplosion", true, 1);
AddTimer("walktotimer", 0.3f, "atwalkto");
}


void atwalkto(string &in asTimer)
{
MovePlayerForward(10.0f);
AddTimer("looper", 0.1f, "restart_walk");
}


void restart_walk(string &in asTimer)
{
AddTimer("restarter", 0, "atwalkto");
}



//________________

Then when you want him to stop, either on a timer or in a script area collide, place these:

RemoveTimer("looper");
RemoveTimer("restarter");