Frictional Games Forum (read-only)

Full Version: Oh man....
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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:
Code:
////////////////////////////
// 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)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)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:
Code:
////////////////////////////
// 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)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:
Code:
////////////////////////////
// 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.
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:
Code:
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.
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)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, 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");
I don't understand, I have the Monster2 walking to different places around the map but it says that the pathnodes don't work.