Frictional Games Forum (read-only)

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

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 Smile
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.

This is the script i´ve used to create a crowbar-puzzle Smile

AddEntityCollideCallback("crowbar_joint_1", "BreakDoor", "CollideAreaBreakDoor", true, 1);
AddUseItemCallback("crowbarondoor", "crowbar_1", "locked_door","UseCrowbarOnDoor", true);
AddUseItemCallback("crowbaronframe", "crowbar_1", "AreaUseCrowbar", "UseCrowbarOnDoor", true);

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);

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)

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);

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! Smile

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 Tongue