Here is what my script looks like now:
void OnStart()
{
AddEntityCollideCallback("crowbar_joint_1", "BreakDoor", "CollideAreaBreakDoor", true, 1);
AddUseItemCallback("crowbarondoor", "crowbar_1", "castle_arched01_2", "UseCrowbarOnDoor", true);
AddUseItemCallback("crowbaronframe", "crowbar_1", "castle_arched01_2", "UseCrowbarOnDoor", true);
}
void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("timer_01", 0.2, "TimerAttatchCrowbar");
PlaySoundAtEntity("pickupcrow", "player_crouch.snt", "Player", 0.05, false);
RemoveItem("crowbar_1");
}
void TimerAttatchCrowbar(string &in asTimer)
{
PlaySoundAtEntity("attachcrowbar", "puzzle_place_jar.snt", "Player", 0, false);
SetEntityActive("crowbar_joint_1", true);
}
void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
GiveSanityBoostSmall();
PlayMusic("10_puzzle01.snt", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("castle_arched01_2", true);
SetSwingDoorDisableAutoClose("castle_arched01_2", true);
SetSwingDoorClosed("castle_arched01_2", false, false);
PlaySoundAtEntity("break", "break_wood_metal.snt", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("breakps", "ps_hit_wood", "AreaBreakEffect", false);
AddPropImpulse("castle_arched01_2", 0, 0, 3, "World");
SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_broken_1", true);
AddTimer("pushdoor", 0.1, "TimerPushDoor");
}
void TimerPushDoor(string &in asTimer)
{
AddPropImpulse("castle_arched01_2", -1, 2, -4, "World");
AddTimer("doorclose", 1.1, "TimerDoorCanClose");
}
void TimerDoorCanClose(string &in asTimer)
{
SetSwingDoorDisableAutoClose("castle_arched01_2", false);
}
(07-05-2012, 05:33 PM)Vennufius Wrote: Here is what my script looks like now:
void OnStart()
{
AddEntityCollideCallback("crowbar_joint_1", "BreakDoor", "CollideAreaBreakDoor", true, 1);
AddUseItemCallback("crowbarondoor", "crowbar_1", "castle_arched01_2", "UseCrowbarOnDoor", true);
AddUseItemCallback("crowbaronframe", "crowbar_1", "castle_arched01_2", "UseCrowbarOnDoor", true);
}
void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("timer_01", 0.2, "TimerAttatchCrowbar");
PlaySoundAtEntity("pickupcrow", "player_crouch.snt", "Player", 0.05, false);
RemoveItem("crowbar_1");
}
void TimerAttatchCrowbar(string &in asTimer)
{
PlaySoundAtEntity("attachcrowbar", "puzzle_place_jar.snt", "Player", 0, false);
SetEntityActive("crowbar_joint_1", true);
}
void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
GiveSanityBoostSmall();
PlayMusic("10_puzzle01.snt", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("castle_arched01_2", true);
SetSwingDoorDisableAutoClose("castle_arched01_2", true);
SetSwingDoorClosed("castle_arched01_2", false, false);
PlaySoundAtEntity("break", "break_wood_metal.snt", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("breakps", "ps_hit_wood", "AreaBreakEffect", false);
AddPropImpulse("castle_arched01_2", 0, 0, 3, "World");
SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_broken_1", true);
AddTimer("pushdoor", 0.1, "TimerPushDoor");
}
void TimerPushDoor(string &in asTimer)
{
AddPropImpulse("castle_arched01_2", -1, 2, -4, "World");
AddTimer("doorclose", 1.1, "TimerDoorCanClose");
}
void TimerDoorCanClose(string &in asTimer)
{
SetSwingDoorDisableAutoClose("castle_arched01_2", false);
}
Sorry again, I found a mistake. But this time I think it gave me an error that someone could actually solve.
So this is what it gave me: FATAL ERROR: Could not load script file
'custom_stories/NoNameYet/maps/NoNameYet.hps'!
main (25, 2) : ERR :No matching signatures to
'SetSwingDoorLocked(string@&, const bool)'
Oh this is just annoying... I had made a wrong script:
SetSwingDoorLocked("castle_arched01_2", true);
[align=-webkit-auto]
Which should have been this:
[/align][align=-webkit-auto]
[/align][align=-webkit-auto]
SetSwingDoorLocked("castle_arched01_2", false, false);
[/align][align=-webkit-auto]
[/align][align=-webkit-auto]
[/align]