Some newbie scripting help needed. - 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: Some newbie scripting help needed. (/thread-16890.html) |
Some newbie scripting help needed. - HandsomeGaren - 07-11-2012 Hi, I've recently been getting into making custom stories for Amnesia, since i'm still learning I'm just making maps for experimental purposes and so that I can learn all of the elements needed to make a full-fledged custom story. However, this is the first time I've had to use scripting and I've been - although I can hold my own thanks to the amount of tutorials out there - stuck on this one issue that I've had for quite some time now. // Run when entering map void OnStart() { AddUseItemCallback("", "endlevelkey_1", "enddoor_1", "UsedKeyOnDoor", true); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("enddoor_1", false, true); PlaySoundAtEntity("", "unlock_door", "enddoor_1", 0, false); RemoveItem("endlevelkey_1"); } AddEntityCollideCallback("Player", "teleportscript", "teleport", true, 1); void teleport(string& asParent, string &in asChild, int alStates) { SetEntityActive("teleportingnakedguy", true); AddPropForce("teleportingnakedguy", 0, 0, -10000, "world"); PlaySoundAtEntity("", "24_iron_maiden.snt", "teleportingnakedguy", 0, false); } As you can see, I have scripting for a door+key, and a teleporting naked guy trap, these two both work on their own, however when I put them together I get this error; FATAL ERROR: Could not load script file 'custom_stories/Corridor/maps/00_Corridor_1.hps'! main (13,25): ERR : Expected identifier. I've toyed with it somewhat and this is the best I've come up with. Can anybody help me fix my mistake and possibly teach me how to have two or more scripts in the same file operate correctly? Thanks. RE: Some newbie scripting help needed. - SilentStriker - 07-11-2012 AddEntityCollideCallback("Player", "teleportscript", "teleport", true, 1);' it should be placed inside void OnStart() like the AddUseItemCallback RE: Some newbie scripting help needed. - HandsomeGaren - 07-11-2012 Many thanks, you helped out lots. ^^ RE: Some newbie scripting help needed. - SilentStriker - 07-11-2012 Your welcome ^^ Welcome to the forum btw RE: Some newbie scripting help needed. - Vyzor - 07-11-2012 Its Garen people, Spin to win |