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
How do I open a door with a crowbar?
kartanonperuna Offline
Posting Freak

Posts: 755
Threads: 44
Joined: Oct 2011
Reputation: 8
#1
How do I open a door with a crowbar?

Yeah Im new to scripting so I dont know this stuff at all.Help?
(This post was last modified: 01-07-2012, 03:56 AM by kartanonperuna.)
01-04-2012, 10:11 AM
Website Find Reply
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#2
RE: How do I open a door with a crowbar?

Alot of people are asking how to do this lately.
Quote:AddUseItemCallback("", "crowbar_1", "prison_locked", "UnlockDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "door_script_1", "crowbarfunc", true, 1);
}
void UnlockDoor(string &in asItem, string &in asEntity)
{
SetEntityActive("crowbar_joint_1", true);
//SetSwingDoorLocked("prison_locked", false, true);
//PlaySoundAtEntity("", "unlock_door", "prison_locked", 0, false);
RemoveItem("crowbar_1");
}
void crowbarfunc(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("prison_locked", 0.0f);
SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_dyn_1", true);
//PlaySoundAtEntity("", "unlock_door", "prison_locked", 0, false);

}
Add a crowbar_joint_1 in the door in set it inactive.
Same with crowbar_dyn_1 in the same place.
Put a little scriptarea on the left or right of the crowbar (depending on the door). The script above works like this:
You put the crowbar in the door by the adduseitemcallback. This enables the crowbar to be pulled.
Then when the crowbar collides with the scriptarea you made next to the crowbar, it will activate the script to break the door and set the other crowbar active and fall down.
Rename the Door, crowbars as to the names in your level editor, make sure you put the door as locked. : D

(This post was last modified: 01-04-2012, 10:19 AM by flamez3.)
01-04-2012, 10:18 AM
Find Reply
kartanonperuna Offline
Posting Freak

Posts: 755
Threads: 44
Joined: Oct 2011
Reputation: 8
#3
RE: How do I open a door with a crowbar?

Hmm doesnt work...
01-04-2012, 10:48 AM
Website Find Reply
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#4
RE: How do I open a door with a crowbar?

Did you rename the objects?

01-04-2012, 11:01 AM
Find Reply
kartanonperuna Offline
Posting Freak

Posts: 755
Threads: 44
Joined: Oct 2011
Reputation: 8
#5
RE: How do I open a door with a crowbar?

Yes.I did.
01-04-2012, 01:12 PM
Website Find Reply
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#6
RE: How do I open a door with a crowbar?

...What doesn't work.

01-04-2012, 01:48 PM
Find Reply
kartanonperuna Offline
Posting Freak

Posts: 755
Threads: 44
Joined: Oct 2011
Reputation: 8
#7
RE: How do I open a door with a crowbar?

Well it says object can not be used this way.
01-05-2012, 12:50 PM
Website Find Reply
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#8
RE: How do I open a door with a crowbar?

Post all of your script, as well as the level editor door names as well as the crowbars names

01-05-2012, 01:52 PM
Find Reply
kartanonperuna Offline
Posting Freak

Posts: 755
Threads: 44
Joined: Oct 2011
Reputation: 8
#9
RE: How do I open a door with a crowbar?


AddUseItemCallback("", "crowbar_1", "prison_locked", "UnlockDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "door_script_1", "crowbarfunc", true, 1);
}
void UnlockDoor(string &in asItem, string &in asEntity)
{
SetEntityActive("crowbar_joint_1", true);
//SetSwingDoorLocked("prison_locked", false, true);
//PlaySoundAtEntity("", "unlock_door", "prison_locked", 0, false);
RemoveItem("crowbar_1");
}
void crowbarfunc(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("prison_locked", 0.0f);
SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_dyn_1", true);
//PlaySoundAtEntity("", "unlock_door", "prison_locked", 0, false);

}





And the doors name is prison_locked and the crowbars: crowbar_dyn_1 and crowbar_joint_1

I'm new to scripting so dont laugh if I failed hard hahah.
01-05-2012, 02:04 PM
Website Find Reply
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#10
RE: How do I open a door with a crowbar?

(01-05-2012, 02:04 PM)kartanonperuna Wrote: AddUseItemCallback("", "crowbar_1", "prison_locked", "UnlockDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "door_script_1", "crowbarfunc", true, 1);
}
void UnlockDoor(string &in asItem, string &in asEntity)
{
SetEntityActive("crowbar_joint_1", true);
//SetSwingDoorLocked("prison_locked", false, true);
//PlaySoundAtEntity("", "unlock_door", "prison_locked", 0, false);
RemoveItem("crowbar_1");
}
void crowbarfunc(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("prison_locked", 0.0f);
SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_dyn_1", true);
//PlaySoundAtEntity("", "unlock_door", "prison_locked", 0, false);

}





And the doors name is prison_locked and the crowbars: crowbar_dyn_1 and crowbar_joint_1

I'm new to scripting so dont laugh if I failed hard hahah.
What's the name to the crowbar item?


01-05-2012, 02:06 PM
Find Reply




Users browsing this thread: 1 Guest(s)