AlexRobillard
Junior Member
Posts: 41
Threads: 5
Joined: Jun 2011
Reputation:
0
Oh man....
I try not to bother anyone but I decided to make an account and ask for help with this script that wont work. I probably made a simple and dumb mistake but here is the script:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player" , "Monster_Walk_Trigger" , "MonsterWalk1" , true , 1);
AddEntityCollideCallback("Player" , "Monster_Walk_Trigger" , "AddEnemyPatrolNode" , true , 1);
}
void AddEnemyPatrolNode(Monster1, PathNodeArea_35, 3, string& asAnimation);
void AddEnemyPatrolNode(Monster1, PathNodeArea_35, 3, string& asAnimation);
void MonsterWalk1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("Monster1" , true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
Thanks.
06-28-2011, 03:47 PM
Russ Money
Senior Member
Posts: 360
Threads: 25
Joined: Dec 2010
Reputation:
4
RE: Oh man....
(06-28-2011, 03:47 PM) AlexRobillard Wrote: void AddEnemyPatrolNode(Monster1, PathNodeArea_35, 3, string& asAnimation);
void MonsterWalk1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("Monster1" , true);
}
Remove both of the
void AddEnemyPatrolNode(Monster1, PathNodeArea_35, 3, string& asAnimation);
Maybe change it to
void MonsterWalk1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("Monster1" , true);
AddEnemyPatrolNode("Monster1", "PathNodeArea_35", 3, "");
}
06-28-2011, 03:55 PM
AlexRobillard
Junior Member
Posts: 41
Threads: 5
Joined: Jun 2011
Reputation:
0
RE: Oh man....
(06-28-2011, 03:55 PM) Russ Money Wrote: (06-28-2011, 03:47 PM) AlexRobillard Wrote: void AddEnemyPatrolNode(Monster1, PathNodeArea_35, 3, string& asAnimation);
void MonsterWalk1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("Monster1" , true);
}
Remove both of the
void AddEnemyPatrolNode(Monster1, PathNodeArea_35, 3, string& asAnimation);
Maybe change it to
void MonsterWalk1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("Monster1" , true);
AddEnemyPatrolNode("Monster1", "PathNodeArea_35", 3, "");
}
I changed it and now have this:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player" , "Monster_Walk_Trigger" , "MonsterWalk1" , true , 1);
AddEntityCollideCallback("Player" , "Monster_Walk_Trigger" , "AddEnemyPatrolNode" , true , 1);
}
void MonsterWalk1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("Monster1" , true);
AddEnemyPatrolNode("Monster1", "PathNodeArea_35", 3, "");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
The monster doesn't spawn when I walk to where I placed the script though (it doesn't ever spawn).
06-28-2011, 04:10 PM
DamnNoHtml
Senior Member
Posts: 469
Threads: 34
Joined: Sep 2010
Reputation:
16
RE: Oh man....
(06-28-2011, 04:10 PM) AlexRobillard Wrote: (06-28-2011, 03:55 PM) Russ Money Wrote: (06-28-2011, 03:47 PM) AlexRobillard Wrote: void AddEnemyPatrolNode(Monster1, PathNodeArea_35, 3, string& asAnimation);
void MonsterWalk1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("Monster1" , true);
}
Remove both of the
void AddEnemyPatrolNode(Monster1, PathNodeArea_35, 3, string& asAnimation);
Maybe change it to
void MonsterWalk1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("Monster1" , true);
AddEnemyPatrolNode("Monster1", "PathNodeArea_35", 3, "");
}
I changed it and now have this:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player" , "Monster_Walk_Trigger" , "MonsterWalk1" , true , 1);
AddEntityCollideCallback("Player" , "Monster_Walk_Trigger" , "AddEnemyPatrolNode" , true , 1);
}
void MonsterWalk1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("Monster1" , true);
AddEnemyPatrolNode("Monster1", "PathNodeArea_35", 3, "");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
The monster doesn't spawn when I walk to where I placed the script though (it doesn't ever spawn).
There is no problem with your code. Make sure the Script Area / Monster names all match up
exactly . Its one of the more common mistakes.
Creator of Wake, Through the Portal, Insomnia, and Cycles What to do with HPL3....
06-28-2011, 04:17 PM
AlexRobillard
Junior Member
Posts: 41
Threads: 5
Joined: Jun 2011
Reputation:
0
RE: Oh man....
Wow, I feel stupid now.
Another question, I want the monster to go on another path when I spawn him again later in the level and hit a couple of nodes, how would I get it to work? When I tried this, the game crashes:
void OnStart()
{
AddEntityCollideCallback("Player" , "Monster_Walk_Trigger" , "MonsterWalk1" , true , 1);
AddEntityCollideCallback("Player" , "Monster_Walk_Trigger2" , "MonsterWalk2" , true , 1);
AddEntityCollideCallback("Player" , "Monster_Walk_Trigger" , "AddEnemyPatrolNode" , true , 1);
AddEntityCollideCallback("Player" , "Monster_Walk_Trigger2" , "AddEnemyPatrolNode2" , true , 1);
}
void MonsterWalk1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("Monster1" , true);
AddEnemyPatrolNode("Monster1", "PathNodeArea_35", 3, "");
}
void MonsterWalk2(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("Monster2" , true);
AddEnemyPatrolNode2("Monster2", "PathNodeArea_20", 3, "");
AddEnemyPatrolNode2("Monster2", "PathNodeArea_4", 10, "");
AddEnemyPatrolNode2("Monster2", "PathNodeArea_58", 1, "");
AddEnemyPatrolNode2("Monster2", "PathNodeArea_59", 2, "");
}
Thanks again.
(This post was last modified: 06-28-2011, 04:44 PM by AlexRobillard .)
06-28-2011, 04:22 PM
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
RE: Oh man....
Hello, nice to meet you. To your latest question, you should try to spawn a completely different monster aside from your first two monsters by adding an monster entity called, for example, "Monster3".
06-28-2011, 05:21 PM
AlexRobillard
Junior Member
Posts: 41
Threads: 5
Joined: Jun 2011
Reputation:
0
RE: Oh man....
(06-28-2011, 05:21 PM) Kyle Wrote: Hello, nice to meet you. To your latest question, you should try to spawn a completely different monster aside from your first two monsters by adding an monster entity called, for example, "Monster3".
I want one monster to follow that path though, wont it look weird if a monster spawns in its place?
06-28-2011, 06:44 PM
rojkish
Junior Member
Posts: 45
Threads: 0
Joined: Jun 2011
Reputation:
0
RE: Oh man....
(06-28-2011, 04:22 PM) AlexRobillard Wrote: Wow, I feel stupid now.
Another question, I want the monster to go on another path when I spawn him again later in the level and hit a couple of nodes, how would I get it to work?
Thanks again.
While doing this you're going to use two different functions, right?
Spoiler below!
void MonsterWalk1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster1" , true);
AddEnemyPatrolNode("Monster1", "PathNodeArea_35", 3, "");
}
&
void MonsterWalk3(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster1" , true);
AddEnemyPatrolNode("Monster1", "NEW_PATROL_NODE", 3, "");
My point being; it's two different functions. The first tells him to go to one place, and the other one tells him to go to another place - this means that when the second happens (assuming he've been deactivated in another script area), he won't follow the first path nodes.
However, if he does, you can always use;
ClearEnemyPatrolNodes("Monster1");
06-28-2011, 07:03 PM
AlexRobillard
Junior Member
Posts: 41
Threads: 5
Joined: Jun 2011
Reputation:
0
RE: Oh man....
I don't understand, I have the Monster2 walking to different places around the map but it says that the pathnodes don't work.
06-28-2011, 09:00 PM