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
Script Help crowbar opening a door?
zombiehacker595 Offline
Member

Posts: 141
Threads: 51
Joined: Mar 2012
Reputation: 3
#1
crowbar opening a door?

so i did all the scripting for the crowbar opening a door i used this website to do it but when ever i put my crowbar on that door it just says you cannot use this item that way. this is the script for it
void OnStart()
{
AddUseItemCallback("", "crowbar_1", "mansion_2", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1);
}
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", "", 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("mansion_2", false, true);
AddPropImpulse("mansion_2", 0, 0, -50, "World");
SetSwingDoorDisableAutoClose("mansion_2", true);
SetSwingDoorClosed("mansion_2", false, false);
SetMoveObjectState("mansion_2", 1);
PlaySoundAtEntity("","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakEffect", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
}
i have made sure the crowbar and the door are all the same as the script in level editor but it still wont work any ideas anyone?


(03-29-2012, 11:49 AM)zombiehacker595 Wrote: so i did all the scripting for the crowbar opening a door i used this website to do it but when ever i put my crowbar on that door it just says you cannot use this item that way. this is the script for it
void OnStart()
{
AddUseItemCallback("", "crowbar_1", "mansion_2", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1);
}
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", "", 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("mansion_2", false, true);
AddPropImpulse("mansion_2", 0, 0, -50, "World");
SetSwingDoorDisableAutoClose("mansion_2", true);
SetSwingDoorClosed("mansion_2", false, false);
SetMoveObjectState("mansion_2", 1);
PlaySoundAtEntity("","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakEffect", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
}
i have made sure the crowbar and the door are all the same as the script in level editor but it still wont work any ideas anyone?
nvm every body it decided to work Big Grin


(This post was last modified: 03-29-2012, 11:51 AM by zombiehacker595.)
03-29-2012, 11:49 AM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#2
RE: crowbar opening a door?

I made a tutorial on how to use a crowbar on a door Smile

look in the development articles

03-29-2012, 11:53 AM
Find




Users browsing this thread: 1 Guest(s)