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
Some scripting help
Mooserider Offline
Member

Posts: 64
Threads: 11
Joined: Jan 2011
Reputation: 2
#4
RE: Some scripting help

For making the door open, make a script area in your map where you want the player to walk into, then add this to the OnStart part of your script:
AddEntityCollideCallBack("Player", "ScriptArea", "DoorOpen", true, 1);
Change ScriptArea to the name of your script area. True is whether or not it happens only once.
Anyway, add this into your code (Not in onStart, just in a blank space)
void DoorOpen(string &in asParent, string &in asChild, int alState)
{
AddTimer("DoorTimer", 1.0f, "DoorOpened");//Only have this line if the player will interact with the door afterwards.
SetSwingDoorClosed("Door", false, false);
SetSwingDoorDisableAutoClose("Door", true);
AddPropImpulse("Door", X.0f, Y.0f, Z.0f, "World");
}

Now, there are a couple things you have to do:
1. Change Door to the name of your door.

2. X, Y, and Z is the direction of the force. You'll need to find out which way your door opens and put a huge number like 10000 where the X Y or Z is depending on which way your door opens. The other coordinates that mean up or down can just be changed to 0.

This concept confused me the first time I read it, so I'll have an example:
Spoiler below!
[Image: propimpulseexample.jpg]


3. If the door begins locked, you will need to add the following in with the AddPropImpulse and stuff.
SetSwingDoorLocked("Door", false, false);
Now, finally, if you want the player to be able to interact with the door again afterwards, I think you'll have to add this afterwards:
void DoorOpened(string &in asTimer)
{
SetSwingDoorDisableAutoClose("Door", false);
}

And again, change Door to the name of your door.

I hope I've helped you, Sorry if it was a bit of a long explanation, and if I've mucked up and the script doesn't work just tell me.Big Grin

Working on a FC: "Don't Let Go "
05-25-2011, 11:27 AM
Find


Messages In This Thread
Some scripting help - by xtron - 05-23-2011, 07:14 PM
RE: Some scripting help - by ferryadams10 - 05-24-2011, 07:05 PM
RE: Some scripting help - by xtron - 05-24-2011, 08:01 PM
RE: Some scripting help - by Mooserider - 05-25-2011, 11:27 AM



Users browsing this thread: 1 Guest(s)