Frictional Games Forum (read-only)

Full Version: TeleportPlayer Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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);
}
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.
(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.
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.
(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.