Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Crowbar Script
Prelauncher Offline
Senior Member

Posts: 451
Threads: 11
Joined: May 2011
Reputation: 13
#2
RE: Crowbar Script

This is the script i´ve used to create a crowbar-puzzle Smile


AddEntityCollideCallback("crowbar_joint_1", "BreakDoor", "CollideAreaBreakDoor", true, 1);
AddUseItemCallback("crowbarondoor", "crowbar_1", "locked_door","UseCrowbarOnDoor", true);
AddUseItemCallback("crowbaronframe", "crowbar_1", "AreaUseCrowbar", "UseCrowbarOnDoor", true);

//BEGIN BREAK DOOR//
void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer(asEntity, 0.2, "TimerSwitchShovel");
PlaySoundAtEntity("pickupcrow","player_crouch.snt", "Player", 0.05, false);

//Remove callback incase player never touched door
SetEntityPlayerInteractCallback("locked_door", "", true);
SetEntityPlayerInteractCallback("AreaUseCrowbar", "", true);

RemoveItem(asItem);
}
void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("attachshovel","puzzle_place_jar.snt", asTimer, 0, false);

SetEntityActive("crowbar_joint_1", true);
}
void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
GiveSanityBoostSmall();

PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);

SetSwingDoorLocked("locked_door", false, false);
SetSwingDoorDisableAutoClose("locked_door", true);
SetSwingDoorClosed("locked_door", false,false);

PlaySoundAtEntity("break","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("breakps", "ps_hit_wood", "AreaBreakEffect", false);
AddPropImpulse("locked_door", -3, 0, 0, "world");

SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_dyn_1", true);

AddTimer("pushdoor", 0.1, "TimerPushDoor");
AddTimer("voice2", 1, "TimerDanielVoices");

CompleteQuest("10Door", "10Door");

AddDebugMessage("Break door!", false);
}
void TimerPushDoor(string &in asTimer)
{
AddPropImpulse("locked_door", -1, 2, -4, "world");
AddTimer("doorclose", 1.1, "TimerDoorCanClose");
}

void TimerDoorCanClose(string &in asTimer)
{
SetSwingDoorDisableAutoClose("locked_door", false);
}

//END BREAK DOOR//

Socialism (noun): A great way to run out of other people's money.
(This post was last modified: 08-27-2011, 12:42 AM by Prelauncher.)
08-27-2011, 12:32 AM
Find


Messages In This Thread
Crowbar Script - by TheBaker - 08-26-2011, 11:54 PM
RE: Crowbar Script - by Prelauncher - 08-27-2011, 12:32 AM
RE: Crowbar Script - by TheBaker - 08-27-2011, 10:45 AM
RE: Crowbar Script - by TheBaker - 08-27-2011, 12:35 PM



Users browsing this thread: 1 Guest(s)