Script Problem.. Crowbar and open hatch.
HI.
I saw a video guide about how to write the script for using crowbar with all the effects...
In my case is not a door its a hatch...(kind of...) the item im using is hatch_metal01...because cealing hatch(the one i wanted) it never got locked.
When i enter to the game... nothing hapens.. the crowbar does nothing.
Here is my script... (my level items has the same names as the ones in the script, so there isnt a wrong name issue...
At first in "AddUseItemCallback("openhatch", "crowbar_1", "ScriptArea_1", instead of ScriptArea_1, was the name of the door item... that was hatch_1.... but it didnt work, so the one that make the guide told me that with some entitys u cant interact, so i could try to change hatch_1 to ScriptArea_1...
In both ways it dont work. Please what i should do?... (I also check the "script areas" position and the ScriptArea_1 is huge and just below the hatch).
Just to know... "crowbar_1" is the pickup crowbar, "joint" is a crowbar that appear stuck in the door the one i will move, and "brokencrowbar" is the one in two parts that will fall.
void OnStart()
{
AddUseItemCallback("openhatch", "crowbar_1", "ScriptArea_1", "UseCrowbarOnDoor", true);
AddEntityCollideCallback ("joint", "ScriptArea_1", "BreakHatch", true, 1);
}
void UseCrowbarOndoor(string &in asItem, string &in asEntity)
{
RemoveItem("crowbar_1");
PlaySoundAtEntity("", "player_crouch.snt", "Player", 0.05, false);
AddTimer(asEntity, 0.2, "TimerPlaceCrowbar");
}
void TimerPlaceCrowbar (string &in asTimer)
{
SetEntityActive("joint", true);
PlaySoundAtEntity("", "puzzle_place_jar.snt", asTimer, 0, false);
}
void BreakHatch(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("joint", false);
SetEntityActive("brokencrowbar", true);
SetSwingDoorLocked("hatch", false, false);
SetSwingDoorClosed("hatch", false, false);
SetSwingDoorDisableAutoClose("hatch", true);
AddPropImpulse("hatch", 0, -3, 0, "world");
CreateParticleSystemAtEntity("", "ps_hit_wood.ps", "AreaEffect", false);
PlaySoundAtEntity("", "break_wood_metal.snt", "AreaEffect", 0, false);
GiveSanityBoostSmall();
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
AddTimer ("", 0.1, "TimerPushHatch");
}
void TimerPushHatch (string &in asTimer)
{
AddPropImpulse("hatch", 0, -2, -1, "world");
AddTimer ("", 1.1, "TimerHatchCanClose");
}
void TimerHatchCanClose (string &in asTimer)
{
SetSwingDoorDisableAutoClose("hatch", false);
}
Thanks for the attention.
|