aqfitz622
Junior Member
Posts: 23
Threads: 9
Joined: Nov 2011
Reputation:
0
|
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 |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
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."
(This post was last modified: 11-13-2011, 08:16 PM by Your Computer.)
|
|
11-13-2011, 08:16 PM |
|
Darion97
Junior Member
Posts: 29
Threads: 1
Joined: Jun 2011
Reputation:
1
|
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 |
|
aqfitz622
Junior Member
Posts: 23
Threads: 9
Joined: Nov 2011
Reputation:
0
|
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 |
|
aqfitz622
Junior Member
Posts: 23
Threads: 9
Joined: Nov 2011
Reputation:
0
|
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 |
|
|