Frictional Games Forum (read-only)
TeleportPlayer Help - 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: TeleportPlayer Help (/thread-11999.html)



TeleportPlayer Help - Nomad923 - 12-22-2011

I cant seem to figure out what to do to fix this, The error i keep getting is:

ExecuteString (19,17) : ERR : 'PlayerStartArea_2' is not declared
main (1, 1) : ERR : No matching signatures to 'OnGameStart()'


Code:
void OnStart()
{

}

void OnEnter()
{
    AddEntityCollideCallback("Player", "TeleportTrigger", "Nightmare", true, 1);
}

void OnLeave()
{

}

void Nightmare(string &inasParent, string &in asChild, int alState)
{
    FadeOut(0.0f);
    TeleportPlayer(PlayerStartArea_2);
}



RE: TeleportPlayer Help - Your Computer - 12-22-2011

You're supposed to provide a string for TeleportPlayer. Instead, you have provided an undeclared variable. Also, you may want to verify the definition of the Nightmare function.


RE: TeleportPlayer Help - Nomad923 - 12-22-2011

(12-22-2011, 07:38 AM)Your Computer Wrote: You're supposed to provide a string for TeleportPlayer. Instead, you have provided an undeclared variable. Also, you may want to verify the definition of the Nightmare function.

Ok after doing what you said, i get the following errors now
execute (1, 1) : ERR : No matching signatures to 'OnGameStart()'

main (17, 24) : ERR : Expected '('

These are the changes i made.

Im new to making custom stories, so could you show me the changes you would have made to this.

Code:
void OnStart()
{
}

void OnEnter()
{
    AddEntityCollideCallback("Player", "Teleport", "Nightmare", true, 1);
}

void OnLeave()
{
}

void Nightmare(string &inasParent, string &in asChild, int alState)
{
    FadeOut(0.0f);
    TeleportPlayer(string PlayerStartArea_2);
    PlaySoundAtEntity("", "insanity_monster_roar01", "slime_pile_3", 0, false);
    FadeIn(0.0f);
}

Ignore the fade in part im going to change the time for the fade in.


RE: TeleportPlayer Help - palistov - 12-22-2011

Use quotation marks around PlayerStartArea_2.

It should look like this:
TeleportPlayer("PlayerStartArea_2");

When you don't enclose an argument quotation marks, you're using a variable like Your Computer mentioned.


RE: TeleportPlayer Help - Nomad923 - 12-22-2011

(12-22-2011, 09:01 AM)palistov Wrote: Use quotation marks around PlayerStartArea_2.

It should look like this:
TeleportPlayer("PlayerStartArea_2");

When you don't enclose an argument quotation marks, you're using a variable like Your Computer mentioned.
Ah ok that makes sense, dont know why i didnt realize that was the problem. Thanks for the help guys.