Frictional Games Forum (read-only)
Some scripting help - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Some scripting help (/thread-8207.html)



Some scripting help - xtron - 05-23-2011

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.


RE: Some scripting help - ferryadams10 - 05-24-2011

dude
You made PosNodeAreas but u should make PathNodeAreas Tongue


RE: Some scripting help - xtron - 05-24-2011

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

oh. thanks Big Grin.


RE: Some scripting help - Mooserider - 05-25-2011

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:
Code:
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)
Code:
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.
Code:
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:
Code:
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