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
Questions from beginner
Russ Money Offline
Senior Member

Posts: 360
Threads: 25
Joined: Dec 2010
Reputation: 4
#2
RE: Questions from beginner

First off, you'll need this for scripting.

http://wiki.frictionalgames.com/hpl2/amn..._functions

To make the crowbar joint, you'll need to add it to your map. Wedge it in the door to make it look as you want, then in the entity tab, uncheck the active box.

You can do this with chests, making them locked as well.

Now you just need to make the script, I'll assume you know how to set up the text file to read it for the map.

Under OnStart, set up the function for your crowbar, so when the player uses the crowbar on the door, it is taken away from their inventory and the joint is activated. Once the joint reaches the point you want it to break, unlock the door.

Should look like this:

void OnStart()
{
AddUseItemCallback("crowbar", "crowbar", "door", "AttatchCrowbar", true);
}

void AttatchCrowbar(string &in asItem, string &in asEntity)
{
SetEntityActive("crowbar_joint", true);
RemoveItem(asItem);
}

Now to set it so the door breaks open, make a small area that when the crowbar is bent, it'll collide with an area. Add it to your OnStart, also add the callback to unlock the door. Also, remove the crowbar joint so it's not just floating there.

void OnStart()
{
AddUseItemCallback("crowbar", "crowbar", "door", "AttatchCrowbar", true);
AddEntityCollideCallback("crowbar_joint", "AreaOpenDoor", "OpenDoor", true, 1);
}

void AttatchCrowbar(string &in asItem, string &in asEntity)
{
SetEntityActive("crowbar_joint", true);
RemoveItem(asItem);
}

void OpenDoor(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("crowbar_joint", false);
void SetSwingDoorLocked("door", false, false);
}


You will use the same callback when using a key to unlock a door, or anything for that matter. Just add an AddUseItemCallback for your script and make it so the key unlocks whatever it's unlocking.


Let me know if this makes sense to you or not.

(This post was last modified: 06-14-2011, 12:22 PM by Russ Money.)
06-14-2011, 12:20 PM
Find


Messages In This Thread
Questions from beginner - by Finska - 06-14-2011, 11:53 AM
RE: Questions from beginner - by Russ Money - 06-14-2011, 12:20 PM
RE: Questions from beginner - by Finska - 06-14-2011, 12:30 PM
RE: Questions from beginner - by Russ Money - 06-14-2011, 12:31 PM
RE: Questions from beginner - by Finska - 06-14-2011, 12:36 PM
RE: Questions from beginner - by Russ Money - 06-14-2011, 12:38 PM
RE: Questions from beginner - by Finska - 06-14-2011, 12:44 PM
RE: Questions from beginner - by laser50 - 06-14-2011, 12:51 PM
RE: Questions from beginner - by Russ Money - 06-14-2011, 01:02 PM
RE: Questions from beginner - by Finska - 06-14-2011, 01:05 PM
RE: Questions from beginner - by Russ Money - 06-14-2011, 01:09 PM
RE: Questions from beginner - by Russ Money - 06-14-2011, 01:08 PM
RE: Questions from beginner - by Finska - 06-14-2011, 01:09 PM
RE: Questions from beginner - by Finska - 06-14-2011, 01:15 PM
RE: Questions from beginner - by Russ Money - 06-14-2011, 01:18 PM
RE: Questions from beginner - by Finska - 06-14-2011, 01:23 PM
RE: Questions from beginner - by Russ Money - 06-14-2011, 01:43 PM
RE: Questions from beginner - by Finska - 06-14-2011, 01:43 PM
RE: Questions from beginner - by Khyrpa - 06-14-2011, 02:12 PM
RE: Questions from beginner - by Russ Money - 06-14-2011, 02:17 PM



Users browsing this thread: 1 Guest(s)