Crowbar Script - 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: Crowbar Script (/thread-9999.html) |
Crowbar Script - TheBaker - 08-26-2011 I want to open a door with a crowbar like in the guest room and I've been trying to copy the script and the areas in the editor. I've also searched in the forum but I still can't get it to work and I hope you guys can help. This is what my script looks like now and I got this from another thread in the forum. //////////////////////////// // Run first time starting map void OnStart() { AddEntityCollideCallback("Crowbar_1", "AreaPutCrowbar", "CrowbarAppear", true, 1); AddEntityCollideCallback("Crowbar_1", "mansion_2", "CrowbarAppear", true, 1); AddEntityCollideCallback("Crowbar_joint", "break", "BreakDoor", true, 1); void CrowbarAppear(string &in asParent, string &in asChild, int alState) { SetEntityActive("Crowbar_joint", true); RemoveItem("Crowbar_1"); } void BreakDoor(string &in asParent, string &in asChild, int alState) { SetSwingDoorLocked("mansion_2", false, false); CreateParticleSystemAtEntity("", "ps_hit_wood", "BreakEffect", false); PlaySoundAtEntity("", "break_wood", "BreakEffect", 0.0, false); SetEntityActive("Crowbar_joint", false); SetEntityActive("crowbar", true); } //////////////////////////// // Run when entering map void OnEnter() { } //////////////////////////// // Run when leaving map void OnLeave() { } So if it's possible please copy my script and repost it as it should be and of course tell me what's wrong with it Thanks in advance! I saw that I missed one of the"}" in the beggining of the script but it still wont work, just letting you know. RE: Crowbar Script - Prelauncher - 08-27-2011 This is the script i´ve used to create a crowbar-puzzle AddEntityCollideCallback("crowbar_joint_1", "BreakDoor", "CollideAreaBreakDoor", true, 1); AddUseItemCallback("crowbarondoor", "crowbar_1", "locked_door","UseCrowbarOnDoor", true); AddUseItemCallback("crowbaronframe", "crowbar_1", "AreaUseCrowbar", "UseCrowbarOnDoor", true); //BEGIN BREAK DOOR// void UseCrowbarOnDoor(string &in asItem, string &in asEntity) { AddTimer(asEntity, 0.2, "TimerSwitchShovel"); PlaySoundAtEntity("pickupcrow","player_crouch.snt", "Player", 0.05, false); //Remove callback incase player never touched door SetEntityPlayerInteractCallback("locked_door", "", true); SetEntityPlayerInteractCallback("AreaUseCrowbar", "", true); RemoveItem(asItem); } void TimerSwitchShovel(string &in asTimer) { PlaySoundAtEntity("attachshovel","puzzle_place_jar.snt", asTimer, 0, false); SetEntityActive("crowbar_joint_1", true); } void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState) { GiveSanityBoostSmall(); PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false); SetSwingDoorLocked("locked_door", false, false); SetSwingDoorDisableAutoClose("locked_door", true); SetSwingDoorClosed("locked_door", false,false); PlaySoundAtEntity("break","break_wood_metal", "AreaBreakEffect", 0, false); CreateParticleSystemAtEntity("breakps", "ps_hit_wood", "AreaBreakEffect", false); AddPropImpulse("locked_door", -3, 0, 0, "world"); SetEntityActive("crowbar_joint_1", false); SetEntityActive("crowbar_dyn_1", true); AddTimer("pushdoor", 0.1, "TimerPushDoor"); AddTimer("voice2", 1, "TimerDanielVoices"); CompleteQuest("10Door", "10Door"); AddDebugMessage("Break door!", false); } void TimerPushDoor(string &in asTimer) { AddPropImpulse("locked_door", -1, 2, -4, "world"); AddTimer("doorclose", 1.1, "TimerDoorCanClose"); } void TimerDoorCanClose(string &in asTimer) { SetSwingDoorDisableAutoClose("locked_door", false); } //END BREAK DOOR// RE: Crowbar Script - TheBaker - 08-27-2011 I copied you script and I made a kind of succes, now the crowbar disappear and hear a sound but the door is still locked. I think I will get it any minute so thanks man for the help! RE: Crowbar Script - TheBaker - 08-27-2011 The crowbar still wont appear when I use it on the door, does anyone have clue why? It works, I named one of the areas wrong |