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
Level Help
Author Message
SampleFriend Offline
Junior Member

Posts: 8
Threads: 1
Joined: Mar 2011
Reputation: 0
#1
Level Help

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
03-14-2011, 05:31 AM
Find Reply
Russ Money Offline
Senior Member

Posts: 360
Threads: 25
Joined: Dec 2010
Reputation: 4
#2
RE: Level Help

(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.

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/amn..._functions
(This post was last modified: 03-14-2011, 06:27 AM by Russ Money.)
03-14-2011, 05:51 AM
Find Reply
SampleFriend Offline
Junior Member

Posts: 8
Threads: 1
Joined: Mar 2011
Reputation: 0
#3
RE: Level Help

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
(This post was last modified: 03-14-2011, 06:02 AM by SampleFriend.)
03-14-2011, 05:57 AM
Find Reply
Russ Money Offline
Senior Member

Posts: 360
Threads: 25
Joined: Dec 2010
Reputation: 4
#4
RE: Level Help

(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
03-14-2011, 06:27 AM
Find Reply
SampleFriend Offline
Junior Member

Posts: 8
Threads: 1
Joined: Mar 2011
Reputation: 0
#5
RE: Level Help

(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!
03-14-2011, 06:31 AM
Find Reply
Russ Money Offline
Senior Member

Posts: 360
Threads: 25
Joined: Dec 2010
Reputation: 4
#6
RE: Level Help

Did it teach you anything? Let me know if it makes any sense now, scripting, i mean.
03-14-2011, 07:16 AM
Find Reply
SampleFriend Offline
Junior Member

Posts: 8
Threads: 1
Joined: Mar 2011
Reputation: 0
#7
RE: Level Help

(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?
03-14-2011, 08:02 AM
Find Reply
Russ Money Offline
Senior Member

Posts: 360
Threads: 25
Joined: Dec 2010
Reputation: 4
#8
RE: Level Help

(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 ;
03-14-2011, 08:17 AM
Find Reply
SampleFriend Offline
Junior Member

Posts: 8
Threads: 1
Joined: Mar 2011
Reputation: 0
#9
RE: Level Help

(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.
(This post was last modified: 03-14-2011, 08:43 AM by SampleFriend.)
03-14-2011, 08:27 AM
Find Reply
Russ Money Offline
Senior Member

Posts: 360
Threads: 25
Joined: Dec 2010
Reputation: 4
#10
RE: Level Help

(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.
03-14-2011, 08:31 AM
Find Reply




Users browsing this thread: 1 Guest(s)