Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved May someone please help?
Author Message
spamqad Offline
Junior Member

Posts: 12
Joined: Sep 2010
Reputation: 0
Post: #1
May someone please help?
Ok so I am trying to create a small prank map to scare my friend, but my script is not working. What im trying to accomplish is when the player steps into ScriptArea_1 The brute spawns, and walks the nods if he cant find the player, But if the player tries to retreat to the closet ScriptArea_2 will be triggered and the monster inside the closet will spawn. However when I stepped into ScriptArea_1 nothing happened. Can someone please help me?
-----------------------------------------------------------------------------------------------------------

void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "ScriptArea_1", true, 1);
}
void ScriptArea_1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_7", 0, "");
AddEntityCollideCallback("Player", "PlayerCollide", "ScriptArea_2", true, 1);
}
void ScriptArea_2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
}
-----------------------------------------------------------------------------------------------------------
(This post was last modified: 12-15-2011 03:41 AM by spamqad.)
12-15-2011 03:15 AM
Find all posts by this user Quote this message in a reply
triadtimes Offline
Senior Member

Posts: 451
Joined: Jan 2011
Reputation: 19
Post: #2
RE: May someone please help?
If the area the player is walking into is called "ScriptArea_1" then that should be the second part of AddEntityCollideCallback, not the third. Also your third would then be called PlayerCollide (or whatever) and so would the function to call.

Also make sure to call the functions different names.

void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "PlayerCollide", true, 1);
}

void PlayerCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_7", 0, "");
AddEntityCollideCallback("Player", "ScriptArea_2", "PlayerCollide2", true, 1);
}

void PlayerCollide2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
}

Escape
Alone
(Г°ω°)Г

(This post was last modified: 12-15-2011 03:31 AM by triadtimes.)
12-15-2011 03:30 AM
Visit this user's website Find all posts by this user Quote this message in a reply
spamqad Offline
Junior Member

Posts: 12
Joined: Sep 2010
Reputation: 0
Post: #3
RE: May someone please help?
(12-15-2011 03:30 AM)triadtimes Wrote:  If the area the player is walking into is called "ScriptArea_1" then that should be the second part of AddEntityCollideCallback, not the third. Also your third would then be called PlayerCollide (or whatever) and so would the function to call.

Also make sure to call the functions different names.

void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "PlayerCollide", true, 1);
}

void PlayerCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_7", 0, "");
AddEntityCollideCallback("Player", "ScriptArea_2", "PlayerCollide2", true, 1);
}

void PlayerCollide2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
}
Thanks man. Couldn't thank you enough.
12-15-2011 03:41 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)