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
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#1
Exclamation  Some scripting help

Well the title sais it all. anyways.

How do i make so when the player passes a script box it makes the door infront of him open with a certain force?.

And

How do i make monsters patroll?. I've tried everything but it doesn't work. I added
Spoiler below!

Void OnStart()
{
SetEntityPlayerInteractCallback("keyhall2", "monsterspawn", true);
}

void monsterspawn(string &in asEntity)
{
SetEntityActive("monster_key_keeper1", true);
AddEnemyPatrolNode("monster_key_keeper1", "PosNodeArea_1", 0.0f, "");
AddEnemyPatrolNode("monster_key_keeper1", "PosNodeArea_2", 0.0f, "");
AddEnemyPatrolNode("monster_key_keeper1", "PosNodeArea_3", 0.0f, "");
AddEnemyPatrolNode("monster_key_keeper1", "PosNodeArea_4", 0.0f, "");
AddEnemyPatrolNode("monster_key_keeper1", "PosNodeArea_5", 0.0f, "");
AddEnemyPatrolNode("monster_key_keeper1", "PosNodeArea_6", 0.0f, "");
AddEnemyPatrolNode("monster_key_keeper1", "PosNodeArea_7", 0.0f, "");
AddEnemyPatrolNode("monster_key_keeper1", "PosNodeArea_8", 0.0f, "");
AddEnemyPatrolNode("monster_key_keeper1", "PosNodeArea_9", 1.0f, "");
}


This is my current patroll node script.

I've noticed that the people here are realy nice and help out so I wana thank you guys in advance ^^.

Here's an attachment of my script file. If you need to take a look.


Attached Files
.rar   map script.rar (Size: 878 bytes / Downloads: 103)

[Image: 44917299.jpg]Dubstep <3
05-23-2011, 07:14 PM
Find
ferryadams10 Offline
Senior Member

Posts: 288
Threads: 40
Joined: Apr 2011
Reputation: 19
#2
RE: Some scripting help

dude
You made PosNodeAreas but u should make PathNodeAreas Tongue

Got a nice sofa
Please come and have a seat for a while

05-24-2011, 07:05 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#3
RE: Some scripting help

(05-24-2011, 07:05 PM)ferryadams10 Wrote: dude
You made PosNodeAreas but u should make PathNodeAreas Tongue

oh. thanks Big Grin.

[Image: 44917299.jpg]Dubstep <3
05-24-2011, 08:01 PM
Find
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




Users browsing this thread: 3 Guest(s)