VillainousPotato
Member
Posts: 50
Threads: 13
Joined: Mar 2013
Reputation:
1
|
Teleportation!
Im having trouble getting my script right. I'm trying to get my character to teleport when he touches a script area. Any help or a code I can copy would be awesome. Thanks!
|
|
05-12-2013, 12:10 AM |
|
Daemian
Posting Freak
Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation:
49
|
RE: Teleportation!
TeleportPlayer( area );
make sure the area type is PlayerStart
|
|
05-12-2013, 12:24 AM |
|
VillainousPotato
Member
Posts: 50
Threads: 13
Joined: Mar 2013
Reputation:
1
|
RE: Teleportation!
I've done that. However I've had trouble linking it to a collide callback. And naming the function. When I try and test it, it says unexpected variable '{'.
|
|
05-12-2013, 12:30 AM |
|
Streetboat
Posting Freak
Posts: 1,099
Threads: 40
Joined: Mar 2011
Reputation:
56
|
RE: Teleportation!
Post your code. You likely have one too many opening brackets somewhere.
|
|
05-12-2013, 12:41 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Teleportation!
void OnStart()
{
AddEntityCollideCallback("Player", "SATeleport", "PlrTeleport", true, 1); //SATeleport is the area where you teleport.
}
void PlrTeleport(string &in asParent, string &in asChild, int alState)
{
TeleportPlayer("PlrStart"); //PlrStart is the area where you will be teleported.
}
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
05-12-2013, 12:49 AM |
|
VillainousPotato
Member
Posts: 50
Threads: 13
Joined: Mar 2013
Reputation:
1
|
RE: Teleportation!
That's what i thought, as I've encountered this problem before, but i didnt find any when I looked.
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_4", "FloorFall1", true, 1);
}
void FloorFall1(string& asStartPosName);
{
TeleportPlayer(PlayerStartArea_2);
}
///also this is just a section of my script, let me know if you want the entire thing. also i messed up on the error, it says unexpected token, not variable.
|
|
05-12-2013, 12:58 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Teleportation!
I found one error. There could be more so just to be on the safe side, post the whole script.
BTW, here's the error.
void FloorFall1(string &in asParent, string &in asChild, int alState) //It was wrong.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
05-12-2013, 01:02 AM |
|
VillainousPotato
Member
Posts: 50
Threads: 13
Joined: Mar 2013
Reputation:
1
|
RE: Teleportation!
OK i changed that,but now it comes up with an error saying that 'PlayerStartArea_2' is not declared. ill post my whole script in a bit.
void OnStart()
{
AddUseItemCallback("", "key_laboratory_1", "mansion_8", "OpenDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_2", "Falling", true, 1);
AddEntityCollideCallback("Player", "MorgueInsanity", "MorgueDoorClose", true, 1);
AddEntityCollideCallback("Player", "SkullFall", "FallingSkull", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_3", "PlaySound1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_4", "FloorFall1", true, 1);
}
void OpenDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}
void Falling(string &in asParent, string &in asChild, int alState)
{
AddPropForce("box_1", 0, 0, -2000, "world");
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
GiveSanityDamage(6.0f, true);
}
void MorgueDoorClose(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
SetSwingDoorLocked("door_red_1", true, true);
SetSwingDoorClosed("door_red_1", true, true);
}
void FallingSkull(string &in asParent, string &in asChild, int alState)
{
AddPropForce("lab_cryo_head_1", 1800, 0, 0, "world");
SetPlayerActive(false);
GiveSanityDamage(6.0f, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
AddTimer("", 1.0f, "lookatskull");
}
void lookatskull(string &in asTimer)
{
StartPlayerLookAt("lab_cryo_head_1", 10.0f, 10.0f, "");
AddTimer("", 1.0f, "skulllook");
}
void skulllook(string &in asTimer)
{
StartPlayerLookAt("corpse_male_torso_1", 10.0f, 10.0f, "");
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
AddTimer("", 0.5f, "stoplook");
}
void stoplook(string &in asTimer)
{
StopPlayerLookAt();
SetPlayerActive(true);
}
void PlaySound1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "00_faint.snt", "Player", 0, false);
}
void FloorFall1(string &in asParent, string &in asChild, int alState)
{
TeleportPlayer(PlayerStartArea_2);
}
void OnEnter()
{
}
void OnLeave()
{
}
|
|
05-12-2013, 01:09 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Teleportation!
void OnStart()
{
AddUseItemCallback("", "key_laboratory_1", "mansion_8", "OpenDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_2", "Falling", true, 1);
AddEntityCollideCallback("Player", "MorgueInsanity", "MorgueDoorClose", true, 1);
AddEntityCollideCallback("Player", "SkullFall", "FallingSkull", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_3", "PlaySound1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_4", "FloorFall1", true, 1);
}
void OpenDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}
void Falling(string &in asParent, string &in asChild, int alState)
{
AddPropForce("box_1", 0, 0, -2000, "world");
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
GiveSanityDamage(6.0f, true);
}
void MorgueDoorClose(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
SetSwingDoorLocked("door_red_1", true, true);
SetSwingDoorClosed("door_red_1", true, true);
}
void FallingSkull(string &in asParent, string &in asChild, int alState)
{
AddPropForce("lab_cryo_head_1", 1800, 0, 0, "world");
SetPlayerActive(false);
GiveSanityDamage(6.0f, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
AddTimer("", 1.0f, "lookatskull");
}
void lookatskull(string &in asTimer)
{
StartPlayerLookAt("lab_cryo_head_1", 10.0f, 10.0f, "");
AddTimer("", 1.0f, "skulllook");
}
void skulllook(string &in asTimer)
{
StartPlayerLookAt("corpse_male_torso_1", 10.0f, 10.0f, "");
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
AddTimer("", 0.5f, "stoplook");
}
void stoplook(string &in asTimer)
{
StopPlayerLookAt();
SetPlayerActive(true);
}
void PlaySound1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "00_faint.snt", "Player", 0, false);
}
void FloorFall1(string &in asParent, string &in asChild, int alState)
{
TeleportPlayer("PlayerStartArea_2");
}
void OnEnter()
{
}
void OnLeave()
{
}
Fixed.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
05-12-2013, 01:17 AM |
|
VillainousPotato
Member
Posts: 50
Threads: 13
Joined: Mar 2013
Reputation:
1
|
RE: Teleportation!
Awsome. Thank you very much. It works perfectly now. what did you change?
EDIT: nevermind i found it.
|
|
05-12-2013, 01:21 AM |
|
|