[SCRIPT] Teleportation! - 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] Teleportation! (/thread-21464.html) |
Teleportation! - VillainousPotato - 05-12-2013 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! RE: Teleportation! - Daemian - 05-12-2013 TeleportPlayer( area ); make sure the area type is PlayerStart RE: Teleportation! - VillainousPotato - 05-12-2013 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 '{'. RE: Teleportation! - Streetboat - 05-12-2013 Post your code. You likely have one too many opening brackets somewhere. RE: Teleportation! - PutraenusAlivius - 05-12-2013 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. } RE: Teleportation! - VillainousPotato - 05-12-2013 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. RE: Teleportation! - PutraenusAlivius - 05-12-2013 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. RE: Teleportation! - VillainousPotato - 05-12-2013 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() { } RE: Teleportation! - PutraenusAlivius - 05-12-2013 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. RE: Teleportation! - VillainousPotato - 05-12-2013 Awsome. Thank you very much. It works perfectly now. what did you change? EDIT: nevermind i found it. |