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
2 enemys
aqfitz622 Offline
Junior Member

Posts: 23
Threads: 9
Joined: Nov 2011
Reputation: 0
#1
2 enemys

i have a script that spawns a monster.

//____________________________

void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
}

void OnEnter()
{

}

void OnLeave()
{

}

//_______________________

then i want to add a 2nd monster. so i do this

//____________________________

void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
}

{
AddEntityCollideCallback("Player", "PlayerCollide2", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_2", true);
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_3", 2, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_10", 0, "");
}

void OnEnter()
{

}

void OnLeave()
{

}

//_______________________

when i run my game it crashes when i load the map. Ideas?
11-13-2011, 06:45 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: 2 enemys


You're missing a function header for:

{
AddEntityCollideCallback("Player", "PlayerCollide2", "MonsterFunction", true, 1);
}

You should practice providing the error message instead of just saying "it crashes."

Tutorials: From Noob to Pro
(This post was last modified: 11-13-2011, 08:16 PM by Your Computer.)
11-13-2011, 08:16 PM
Website Find
Darion97 Offline
Junior Member

Posts: 29
Threads: 1
Joined: Jun 2011
Reputation: 1
#3
RE: 2 enemys

void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "PlayerCollide2", "MonsterFunction2", true, 1);
}

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
}

void MonsterFunction2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_2", true);
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_3", 2, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_10", 0, "");
}

void OnEnter()
{

}

void OnLeave()
{

}
(This post was last modified: 11-13-2011, 08:28 PM by Darion97.)
11-13-2011, 08:16 PM
Find
aqfitz622 Offline
Junior Member

Posts: 23
Threads: 9
Joined: Nov 2011
Reputation: 0
#4
RE: 2 enemys

it says
FATAL ERROR
FATAL ERROR: Could not load script file 'custom_stories/test/maps/tra--ed.hps'?
main (14, 1) : ERR : Unexpected token.
also what is the function header. is it "void OnStart()"
(This post was last modified: 11-13-2011, 08:24 PM by aqfitz622.)
11-13-2011, 08:24 PM
Find
aqfitz622 Offline
Junior Member

Posts: 23
Threads: 9
Joined: Nov 2011
Reputation: 0
#5
RE: 2 enemys

(11-13-2011, 08:16 PM)Darion97 Wrote: void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "PlayerCollide2", "MonsterFunction2", true, 1);
}

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
}

void MonsterFunction2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_2", true);
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_3", 2, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_brute_2", "PathNodeArea_10", 0, "");
}

void OnEnter()
{

}

void OnLeave()
{

}
thank you i tried that and it works now. thank you
11-13-2011, 09:47 PM
Find




Users browsing this thread: 1 Guest(s)