Frictional Games Forum (read-only)

Full Version: Teleport player?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all, I'm back in the forum. I wanted to say two things:
1. I could not retexturize the Grunt (but still not giving up!)
2. I have a new problem, unrelated to the grunts:

How I can move the player from one place to another? I don't know if you understand, so I here's an example:

The player reaches the point A and he teleports to point B without changing maps. I have tried with TeleportPlayer (string & asStartPosName), but nothing happens. Here's the script:

Spoiler below!
void OnStart()
{
AddEntityCollideCallback("Player", "Change1", "Change1", true, 0);
AddEntityCollideCallback("Player", "Change2", "Change2", true, 0);
AddEntityCollideCallback("Player", "Change3", "Change3", true, 0);
AddEntityCollideCallback("Player", "ScriptFlier", "ScriptFlier", true, 0);
FadeOut(0.0f);
SetPlayerCrouching(true);
SetPlayerActive(false);
StartPlayerLookAt("Look1_1", 100, 5, "");
AddTimer("", 5, "Wake");
}

void Change1(string &in asParent, string &in asChild, int alState)
{
TeleportPlayer("start");
StartPlayerLookAt("Look2", 100, 5, "");
SetPlayerActive(false);
SetEntityActive("corpse_male_plague_cistern_1", true);
PlaySoundAtEntity("", "app_1.snt", "Player", 0, false);
AddTimer("", 0.36f, "Change1_2");
}

void Change1_2(string &in asTimer)
{
StartPlayerLookAt("Look1", 100, 5, "");
SetPlayerActive(true);
SetEntityActive("corpse_male_plague_cistern_1", false);
TeleportPlayer("PlayerStartArea_2");
}

void Change2(string &in asParent, string &in asChild, int alState)
{
TeleportPlayer("PlayerStartArea_5");
StartPlayerLookAt("Look2", 100, 5, "");
SetPlayerActive(false);
SetEntityActive("crude_man_chains_statue_1", true);
PlaySoundAtEntity("", "app_2.snt", "Player", 0, false);
AddTimer("", 0.21f, "Change2_2");
}

void Change2_2(string &in asTimer)
{
StartPlayerLookAt("Look1", 100, 5, "");
SetPlayerActive(true);
SetEntityActive("crude_man_chains_statue_1", false);
TeleportPlayer("PlayerStartArea_4");
}

void Change3(string &in asParent, string &in asChild, int alState)
{
TeleportPlayer("PlayerStartArea_7");
StartPlayerLookAt("Look2", 100, 5, "");
SetPlayerActive(false);
SetEntityActive("ceiling_doll_1", true);
PlaySoundAtEntity("", "app_3.snt", "Player", 0, false);
AddTimer("", 0.83f, "Change3_2");
}

void Change3_2(string &in asTimer)
{
StartPlayerLookAt("Look1", 100, 5, "");
SetPlayerActive(true);
SetEntityActive("ceiling_doll_1", false);
TeleportPlayer("PlayerStartArea_6");
}

void ScriptFlier(string &in asParent, string &in asChild, int alState)
{
StopPlayerLookAt();
SetEntityActive("painting_portrait_insane_1", true);
PlaySoundAtEntity("", "screamer.snt", "Player", 0, false);
AddTimer("", 0.26f, "Scream");
}

void Scream(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_1", false);
SetEntityActive("painting_portrait_insane_2", true);
AddTimer("", 0.26f, "Scream1");
}

void Scream1(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_2", false);
SetEntityActive("painting_portrait_insane_3", true);
AddTimer("", 0.26f, "Scream2");
}

void Scream2(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_3", false);
SetEntityActive("painting_portrait_insane_4", true);
AddTimer("", 0.26f, "Scream3");
}

void Scream3(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_4", false);
SetEntityActive("painting_portrait_insane_5", true);
AddTimer("", 0.26f, "Scream4");
}

void Scream4(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_5", false);
SetEntityActive("painting_portrait_insane_6", true);
AddTimer("", 0.26f, "Scream5");
}

void Scream5(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_6", false);
SetEntityActive("painting_portrait_insane_7", true);
AddTimer("", 0.26f, "Scream6");
}

void Scream6(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_7", false);
SetEntityActive("painting_portrait_insane_8", true);
AddTimer("", 0.26f, "Scream7");
}

void Scream7(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_8", false);
SetEntityActive("painting_portrait_insane_9", true);
AddTimer("", 0.26f, "Scream8");
}

void Scream8(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_9", false);
SetEntityActive("painting_portrait_insane_10", true);
AddTimer("", 0.26f, "Scream9");
}

void Scream9(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_10", false);
}

void Wake(string &in asTimer)
{
FadeIn(5.0);
SetPlayerActive(true);
AddTimer("", 3.0f, "Wake1");
}

void Wake1(string &in asTimer)
{
StartPlayerLookAt("Look1_2", 3, 5, "");
SetPlayerCrouching(false);
AddTimer("", 1.0f, "Wake2");
}

void Wake2(string &in asTimer)
{
StartPlayerLookAt("Look1_3", 3, 5, "");
AddTimer("", 1.0f, "Wake3");
}

void Wake3(string &in asTimer)
{
StartPlayerLookAt("Look1_3", 3, 5, "");
AddTimer("", 1.0f, "Wake4");
}

void Wake4(string &in asTimer)
{
StartPlayerLookAt("Look1", 3, 5, "");
SetPlayerActive(true);
}

Also tried like this:
Spoiler below!
void OnStart()
{
AddEntityCollideCallback("Player", "Change1", "Change1", true, 0);
AddEntityCollideCallback("Player", "Change2", "Change2", true, 0);
AddEntityCollideCallback("Player", "Change3", "Change3", true, 0);
AddEntityCollideCallback("Player", "ScriptFlier", "ScriptFlier", true, 0);
FadeOut(0.0f);
SetPlayerCrouching(true);
SetPlayerActive(false);
StartPlayerLookAt("Look1_1", 100, 5, "");
AddTimer("", 5, "Wake");
}

void Change1(string &in asParent, string &in asChild, int alState)
{
TeleportPlayer("PlayerStartArea_3");
StartPlayerLookAt("Look2", 100, 5, "");
SetPlayerActive(false);
FadeOut(0.1f);
SetEntityActive("corpse_male_plague_cistern_1", true);
PlaySoundAtEntity("", "app_1.snt", "Player", 0, false);
AddTimer("", 0.36f, "Change1_2");
AddTimer("", 0.01f, "FadeIn_1");
}

void FadeIn_1(string &in asTimer)
{
FadeIn(0.1f);
}

void Change1_2(string &in asTimer)
{
StartPlayerLookAt("Look1", 100, 5, "");
SetPlayerActive(true);
FadeOut(0.1f);
SetEntityActive("corpse_male_plague_cistern_1", false);
TeleportPlayer("PlayerStartArea_2");
AddTimer("", 0.01f, "FadeIn_2");
}

void FadeIn_2(string &in asTimer)
{
FadeIn(0.1f);
}

void Change2(string &in asParent, string &in asChild, int alState)
{
TeleportPlayer("PlayerStartArea_5");
StartPlayerLookAt("Look2", 100, 5, "");
SetPlayerActive(false);
SetEntityActive("crude_man_chains_statue_1", true);
PlaySoundAtEntity("", "app_2.snt", "Player", 0, false);
AddTimer("", 0.21f, "Change2_2");
}

void Change2_2(string &in asTimer)
{
StartPlayerLookAt("Look1", 100, 5, "");
SetPlayerActive(true);
SetEntityActive("crude_man_chains_statue_1", false);
TeleportPlayer("PlayerStartArea_4");
}

void Change3(string &in asParent, string &in asChild, int alState)
{
TeleportPlayer("PlayerStartArea_7");
StartPlayerLookAt("Look2", 100, 5, "");
SetPlayerActive(false);
SetEntityActive("ceiling_doll_1", true);
PlaySoundAtEntity("", "app_3.snt", "Player", 0, false);
AddTimer("", 0.83f, "Change3_2");
}

void Change3_2(string &in asTimer)
{
StartPlayerLookAt("Look1", 100, 5, "");
SetPlayerActive(true);
SetEntityActive("ceiling_doll_1", false);
TeleportPlayer("PlayerStartArea_6");
}

void ScriptFlier(string &in asParent, string &in asChild, int alState)
{
StopPlayerLookAt();
SetEntityActive("painting_portrait_insane_1", true);
PlaySoundAtEntity("", "screamer.snt", "Player", 0, false);
AddTimer("", 0.26f, "Scream");
}

void Scream(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_1", false);
SetEntityActive("painting_portrait_insane_2", true);
AddTimer("", 0.26f, "Scream1");
}

void Scream1(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_2", false);
SetEntityActive("painting_portrait_insane_3", true);
AddTimer("", 0.26f, "Scream2");
}

void Scream2(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_3", false);
SetEntityActive("painting_portrait_insane_4", true);
AddTimer("", 0.26f, "Scream3");
}

void Scream3(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_4", false);
SetEntityActive("painting_portrait_insane_5", true);
AddTimer("", 0.26f, "Scream4");
}

void Scream4(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_5", false);
SetEntityActive("painting_portrait_insane_6", true);
AddTimer("", 0.26f, "Scream5");
}

void Scream5(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_6", false);
SetEntityActive("painting_portrait_insane_7", true);
AddTimer("", 0.26f, "Scream6");
}

void Scream6(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_7", false);
SetEntityActive("painting_portrait_insane_8", true);
AddTimer("", 0.26f, "Scream7");
}

void Scream7(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_8", false);
SetEntityActive("painting_portrait_insane_9", true);
AddTimer("", 0.26f, "Scream8");
}

void Scream8(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_9", false);
SetEntityActive("painting_portrait_insane_10", true);
AddTimer("", 0.26f, "Scream9");
}

void Scream9(string &in asTimer)
{
SetEntityActive("painting_portrait_insane_10", false);
}

void Wake(string &in asTimer)
{
FadeIn(5.0);
AddTimer("", 3.0f, "Wake1");
}

void Wake1(string &in asTimer)
{
StartPlayerLookAt("Look1", 3, 5, "");
SetPlayerCrouching(false);
SetPlayerActive(true);
AddTimer("", 1.0f, "Wake2");
}
And still not working.Thanks for your time Smile .
Is "start" a PlayerPos area type or script area?
TeleportPlayer("NameofStartArea");

You just place a Start Area where you want to teleport the player
(03-26-2012, 02:04 PM)ClayPigeon Wrote: [ -> ]Is "start" a PlayerPos area type or script area?
I tried with a StartPos and a ScriptArea, none of them work.

(03-26-2012, 09:31 PM)SilentStriker Wrote: [ -> ]TeleportPlayer("NameofStartArea");



You just place a Start Area where you want to teleport the player
I tried this and nothing happened too.


Anyone knows hot to help me? No one? Sad
What are Change1, Change2 and Change3?
(03-27-2012, 10:52 PM)Your Computer Wrote: [ -> ]What are Change1, Change2 and Change3?
Script Areas