Frictional Games Forum (read-only)
Level 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: Level Help (/thread-6882.html)

Pages: 1 2


Level Help - SampleFriend - 03-14-2011

I'm new to this editor, I've used other editors in the past like Source SDK.
Just the scripting is a little confusing, I need to know how to create an event when I pick up a key and a monster spawns outside the room, smashes the door and after about 30 seconds walks off and de-spawns.

Any help is appreciated

Thanks Big Grin


RE: Level Help - Russ Money - 03-14-2011

(03-14-2011, 05:31 AM)SampleFriend Wrote: I'm new to this editor, I've used other editors in the past like Source SDK.
Just the scripting is a little confusing, I need to know how to create an event when I pick up a key and a monster spawns outside the room, smashes the door and after about 30 seconds walks off and de-spawns.

Any help is appreciated

Thanks Big Grin

Well, the only thing is, there are a lot of variables when it comes to scripting. But I'll give you an example to work off of.

Code:
OnStart()
{
//Key_01, the name of the key entity.
SetEntityPlayerInteractCallback("key_01", "spawn_monster", true);
//Add an Area Script with the name Area_1, just in front of the door the player enters.
AddEntityCollideCallback("Player", "Area_1", "close_door", true, 1);
}

void spawn_monster(string &in asEntity)
{
//monster_1, name of the monster entity.
SetEntityActive("monster_1", true);

//Add a path node inside the room, name it node_1
AddEnemyPatrolNode("monster_1", "node_1", 30.0f, "");
//Add a path node outside the room, name it node_2
AddEnemyPatrolNode("monster_1", "node_2", 0.0f, "");
//Add a area script outside the room, with node_2 inside of it
AddEntityCollideCallback("monster_1", "Area_2", "despawn_monster", true, 1);
}

void close_door(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("door_1", true, true);
}

void despawn_monster(string &in asEntity)
{
SetEntityActive("monster_1", false);
}

If you like, I can go into detail of the script. You'll have to go back and change the names of the entities in your map for this to work. As I said, VARIABLES

Also, check this out.
http://wiki.frictionalgames.com/hpl2/amnesia/script_functions


RE: Level Help - SampleFriend - 03-14-2011

Thanks, I'll give it a test now.

EDIT: Sorry, but what should I have in the map, like a script named spawn_monster?
Again, sorry :/ new to this


RE: Level Help - Russ Money - 03-14-2011

(03-14-2011, 05:57 AM)SampleFriend Wrote: Thanks, I'll give it a test now.

EDIT: Sorry, but what should I have in the map, like a script named spawn_monster?
Again, sorry :/ new to this

Added dev notes to it on what to do, check the code again


RE: Level Help - SampleFriend - 03-14-2011

(03-14-2011, 06:27 AM)Russ Money Wrote: Added dev notes to it on what to do, check the code again

Thank you sooo much!


RE: Level Help - Russ Money - 03-14-2011

Did it teach you anything? Let me know if it makes any sense now, scripting, i mean.


RE: Level Help - SampleFriend - 03-14-2011

(03-14-2011, 07:16 AM)Russ Money Wrote: Did it teach you anything? Let me know if it makes any sense now, scripting, i mean.

Yeah, makes more sense then it did a few hours ago. Just one more question (might have more if there's more errors) I get an error when I launch the second map (which is the level I'm using the script for)

"FATAL ERROR: Could not load script file 'custom_stories/Test Custom Story/maps/ch01/D:/Test Custom Story/ch01/Test_Map_ch02.hps!
Main (1, 8) : ERR : Expected identifier" Angry

I'm not sure where this "/ch01/D:/Test Custom Story/ch01/" is coming from though, it should just be "custom_stories/Test Custom Story/maps/ch01/Test_Map_ch02.hps" right?


RE: Level Help - Russ Money - 03-14-2011

(03-14-2011, 08:02 AM)SampleFriend Wrote: "FATAL ERROR: Could not load script file 'custom_stories/Test Custom Story/maps/ch01/D:/Test Custom Story/ch01/Test_Map_ch02.hps!
Main (1, 8) : ERR : Expected identifier" Angry

I'm not sure where this "/ch01/D:/Test Custom Story/ch01/" is coming from though, it should just be "custom_stories/Test Custom Story/maps/ch01/Test_Map_ch02.hps" right?


What Main (1, 8) means is there is a error on line 1, the 8th character. Usually a misplaced quotation mark " or semi-colon ;


RE: Level Help - SampleFriend - 03-14-2011

(03-14-2011, 08:17 AM)Russ Money Wrote: What Main (1, 8) means is there is a error on line 1, the 8th character. Usually a misplaced quotation mark " or semi-colon ;

Ah, ok I'll have a look.
Thanks again.

EDIT: Undecided first line is OnStart() and I've copied pasted the code that you've posted and I haven't edited it.


RE: Level Help - Russ Money - 03-14-2011

(03-14-2011, 08:27 AM)SampleFriend Wrote:
(03-14-2011, 08:17 AM)Russ Money Wrote: What Main (1, 8) means is there is a error on line 1, the 8th character. Usually a misplaced quotation mark " or semi-colon ;

Ah, ok I'll have a look.
Thanks again.

If you post the first part of your code, I'll take a look and see if I can tell you what's making the error.