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
Monster doesn't spawn when "Script" area has collided with player (on custom story)
ryuthebeardy Offline
Junior Member

Posts: 5
Threads: 1
Joined: Feb 2012
Reputation: 0
#1
Monster doesn't spawn when "Script" area has collided with player (on custom story)

Recently, I have decided to make a custom story however I am new to the whole "C++" coding. So i kinda need help on this code below.
void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_gsrunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
}
void OnEnter
{

}
void OnLeave
{

}
Here is what I have done (If my description is confusing, i have a image of the area of my level),

.jpg   wtf.jpg (Size: 218.03 KB / Downloads: 119)
I have placed a monster behind a door (he is inactive), and when the player crosses the door, he should collide with the "Script area" named "PlayerCollide", in which should active the monster, however doesn't... Can anyone help?
06-25-2012, 07:25 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Monster doesn't spawn when "Script" area has collided with player

Looks like you may have named your HPS file incorrectly. I say this because the OnEnter and OnLeave functions are incomplete and should have caused a syntax error. The file name of the HPS should be "01 Mansion.hps". If it is that, then rename both the MAP and HPS file so that they lack spaces.

Tutorials: From Noob to Pro
06-25-2012, 07:33 PM
Website Find
ryuthebeardy Offline
Junior Member

Posts: 5
Threads: 1
Joined: Feb 2012
Reputation: 0
#3
RE: Monster doesn't spawn when "Script" area has collided with player

Hi, I have renamed the map name to "mansion_1.map" (and same for the .hsp file) however, when i run the game and collide with the script area, nothing happens. What do i try now?
06-25-2012, 09:56 PM
Find
Jagsrs28 Offline
Member

Posts: 101
Threads: 25
Joined: Jun 2012
Reputation: 0
#4
Monster doesn't spawn when "Script" area has collided with player (on custom story)

(06-25-2012, 07:25 PM)ryuthebeardy Wrote: Recently, I have decided to make a custom story however I am new to the whole "C++" coding. So i kinda need help on this code below.
void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_gsrunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
}
void OnEnter
{

}
void OnLeave
{

}
Here is what I have done (If my description is confusing, i have a image of the area of my level),

I have placed a monster behind a door (he is inactive), and when the player crosses the door, he should collide with the "Script area" named "PlayerCollide", in which should active the monster, however doesn't... Can anyone help?
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_gsrunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");

Change all of that to:

SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");

That's the only error I see. I am comparing it to mine.

Edit: I would also left click him and see if he is actually named servant_grunt_1
If not I recommend you change that.

Check the name of your Script Area and make sure it matches PlayerCollide.

Special Custom Story for 2 special people!

[Image: LWFcAl]


(This post was last modified: 06-25-2012, 10:16 PM by Jagsrs28.)
06-25-2012, 10:11 PM
Find
ryuthebeardy Offline
Junior Member

Posts: 5
Threads: 1
Joined: Feb 2012
Reputation: 0
#5
Monster doesn't spawn when "Script" area has collided with player (on custom story)

I have made sure that the monster's name is identical to the codes, and made sure that the Script area is the same in the code, however the event still doesn't happen. What do I try now?
06-26-2012, 03:17 PM
Find




Users browsing this thread: 1 Guest(s)