Tomato Cat
Senior Member
Posts: 287
Threads: 2
Joined: Sep 2012
Reputation:
20
RE: Crowbar/Key Script Problem
I'm going to assume that the key is not working on the door, and the crowbar is not properly prying the door open.
Regardless, this should fix your problems.
Spoiler below!
void OnStart()
{
AddUseItemCallback("", "crowbar_1", "Storage", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1);
AddUseItemCallback("", "Waterworks_Key", "Waterworks_Door", "UsedKeyOnDoor", true);
}
void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("", 0.2, "TimerSwitchShovel");
RemoveItem("crowbar_1");
}
void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("","puzzle_place_jar.snt", "Player", 0, false);
SetEntityActive("crowbar_joint_1", true);
}
void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("Storage", false, true);
AddPropImpulse("Storage", 0, 0, -50, "World");
SetSwingDoorDisableAutoClose("Storage", true);
SetSwingDoorClosed("Storage", false, false);
SetMoveObjectState("Storage", 1);
PlaySoundAtEntity("","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakEffect", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Waterworks_Door", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Player", 0, false);
RemoveItem("Waterworks_Key");
}
RAISE YOUR DONGERS ヽ༼ຈل͜ຈ༽ノ
(This post was last modified: 09-12-2012, 05:48 PM by Tomato Cat .)