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
TheBaker Offline
Junior Member

Posts: 15
Threads: 5
Joined: Aug 2011
Reputation: 0
#1
Crowbar Script

I want to open a door with a crowbar like in the guest room and I've been trying to copy the script and the areas in the editor. I've also searched in the forum but I still can't get it to work and I hope you guys can help.

This is what my script looks like now and I got this from another thread in the forum.

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Crowbar_1", "AreaPutCrowbar", "CrowbarAppear", true, 1);
AddEntityCollideCallback("Crowbar_1", "mansion_2", "CrowbarAppear", true, 1);

AddEntityCollideCallback("Crowbar_joint", "break", "BreakDoor", true, 1);

void CrowbarAppear(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Crowbar_joint", true);
RemoveItem("Crowbar_1");
}

void BreakDoor(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("mansion_2", false, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "BreakEffect", false);
PlaySoundAtEntity("", "break_wood", "BreakEffect", 0.0, false);
SetEntityActive("Crowbar_joint", false);
SetEntityActive("crowbar", true);
}


////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

So if it's possible please copy my script and repost it as it should be and of course tell me what's wrong with it Smile
Thanks in advance!
I saw that I missed one of the"}" in the beggining of the script but it still wont work, just letting you know.

(This post was last modified: 08-26-2011, 11:57 PM by TheBaker.)
08-26-2011, 11:54 PM
Find
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
TheBaker Offline
Junior Member

Posts: 15
Threads: 5
Joined: Aug 2011
Reputation: 0
#3
RE: Crowbar Script

I copied you script and I made a kind of succes, now the crowbar disappear and hear a sound but the door is still locked. I think I will get it any minute so thanks man for the help! Smile

08-27-2011, 10:45 AM
Find
TheBaker Offline
Junior Member

Posts: 15
Threads: 5
Joined: Aug 2011
Reputation: 0
#4
RE: Crowbar Script

The crowbar still wont appear when I use it on the door, does anyone have clue why?

It works, I named one of the areas wrong Tongue
(This post was last modified: 08-27-2011, 12:49 PM by TheBaker.)
08-27-2011, 12:35 PM
Find




Users browsing this thread: 1 Guest(s)