Frictional Games Forum (read-only)

Full Version: How do I open a door with a crowbar?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Yeah Im new to scripting so I dont know this stuff at all.Help?
Alot of people are asking how to do this lately.
Quote:AddUseItemCallback("", "crowbar_1", "prison_locked", "UnlockDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "door_script_1", "crowbarfunc", true, 1);
}
void UnlockDoor(string &in asItem, string &in asEntity)
{
SetEntityActive("crowbar_joint_1", true);
//SetSwingDoorLocked("prison_locked", false, true);
//PlaySoundAtEntity("", "unlock_door", "prison_locked", 0, false);
RemoveItem("crowbar_1");
}
void crowbarfunc(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("prison_locked", 0.0f);
SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_dyn_1", true);
//PlaySoundAtEntity("", "unlock_door", "prison_locked", 0, false);

}
Add a crowbar_joint_1 in the door in set it inactive.
Same with crowbar_dyn_1 in the same place.
Put a little scriptarea on the left or right of the crowbar (depending on the door). The script above works like this:
You put the crowbar in the door by the adduseitemcallback. This enables the crowbar to be pulled.
Then when the crowbar collides with the scriptarea you made next to the crowbar, it will activate the script to break the door and set the other crowbar active and fall down.
Rename the Door, crowbars as to the names in your level editor, make sure you put the door as locked. : D
Hmm doesnt work...
Did you rename the objects?
Yes.I did.
...What doesn't work.
Well it says object can not be used this way.
Post all of your script, as well as the level editor door names as well as the crowbars names

AddUseItemCallback("", "crowbar_1", "prison_locked", "UnlockDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "door_script_1", "crowbarfunc", true, 1);
}
void UnlockDoor(string &in asItem, string &in asEntity)
{
SetEntityActive("crowbar_joint_1", true);
//SetSwingDoorLocked("prison_locked", false, true);
//PlaySoundAtEntity("", "unlock_door", "prison_locked", 0, false);
RemoveItem("crowbar_1");
}
void crowbarfunc(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("prison_locked", 0.0f);
SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_dyn_1", true);
//PlaySoundAtEntity("", "unlock_door", "prison_locked", 0, false);

}





And the doors name is prison_locked and the crowbars: crowbar_dyn_1 and crowbar_joint_1

I'm new to scripting so dont laugh if I failed hard hahah.
(01-05-2012, 02:04 PM)kartanonperuna Wrote: [ -> ]AddUseItemCallback("", "crowbar_1", "prison_locked", "UnlockDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "door_script_1", "crowbarfunc", true, 1);
}
void UnlockDoor(string &in asItem, string &in asEntity)
{
SetEntityActive("crowbar_joint_1", true);
//SetSwingDoorLocked("prison_locked", false, true);
//PlaySoundAtEntity("", "unlock_door", "prison_locked", 0, false);
RemoveItem("crowbar_1");
}
void crowbarfunc(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("prison_locked", 0.0f);
SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_dyn_1", true);
//PlaySoundAtEntity("", "unlock_door", "prison_locked", 0, false);

}





And the doors name is prison_locked and the crowbars: crowbar_dyn_1 and crowbar_joint_1

I'm new to scripting so dont laugh if I failed hard hahah.
What's the name to the crowbar item?

Pages: 1 2 3 4