Frictional Games Forum (read-only)
How do I open a door with a crowbar? - 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: How do I open a door with a crowbar? (/thread-12338.html)

Pages: 1 2 3 4


How do I open a door with a crowbar? - kartanonperuna - 01-04-2012

Yeah Im new to scripting so I dont know this stuff at all.Help?


RE: How do I open a door with a crowbar? - flamez3 - 01-04-2012

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



RE: How do I open a door with a crowbar? - kartanonperuna - 01-04-2012

Hmm doesnt work...


RE: How do I open a door with a crowbar? - flamez3 - 01-04-2012

Did you rename the objects?


RE: How do I open a door with a crowbar? - kartanonperuna - 01-04-2012

Yes.I did.


RE: How do I open a door with a crowbar? - flamez3 - 01-04-2012

...What doesn't work.


RE: How do I open a door with a crowbar? - kartanonperuna - 01-05-2012

Well it says object can not be used this way.


RE: How do I open a door with a crowbar? - flamez3 - 01-05-2012

Post all of your script, as well as the level editor door names as well as the crowbars names


RE: How do I open a door with a crowbar? - kartanonperuna - 01-05-2012


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.


RE: How do I open a door with a crowbar? - flamez3 - 01-05-2012

(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?