Frictional Games Forum (read-only)
What do i put in between } and { after SetEntityActive? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: What do i put in between } and { after SetEntityActive? (/thread-20049.html)



What do i put in between } and { after SetEntityActive? - pingthepong - 01-25-2013

Okay guys, so I have been doing this whole Custom Story thing for a few days now, but one thing is really confusing me. Below, I have posted my .hps for a map i'm making. What I really don't understand is how "grunt3" will never spawn. I think it's to do with the two brackets, where there's no "void" bit inbetween. I can get this map running, but I've purposely left that gap so you guys could help me with it. Any ideas?

void OnStart()
{
AddEntityCollideCallback("Player", "grunt_area", "monster", true,1);
AddEntityCollideCallback("grunt1","stop","CollideStop",true,1);
}

void monster(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("grunt1",true);
AddEnemyPatrolNode("grunt1","node_1",0,"");
AddEnemyPatrolNode("grunt1","node_2",0,"");
AddEnemyPatrolNode("grunt1","node_3",0,"");
AddEnemyPatrolNode("grunt1","node_4",0,"");
AddEnemyPatrolNode("grunt1","node_5",0,"");
}

void CollideStop(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("grunt1",false);
}

void OnEnter()
{
AddEntityCollideCallback("Player", "grunt2_area", "monster2", true,1);
AddEntityCollideCallback("grunt","stop","CollideStop2",true,1);
}

void monster2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("grunt2",true);
AddEnemyPatrolNode("grunt2","grunt2node_1",0,"");
AddEnemyPatrolNode("grunt2","grunt2node_2",0,"");
AddEnemyPatrolNode("grunt2","grunt2node_3",0,"");
AddEnemyPatrolNode("grunt2","grunt2node_4",0,"");
AddEnemyPatrolNode("grunt2","grunt2node_5",0,"");
}

void CollideStop2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("grunt2",false);
}


{
AddEntityCollideCallback("Player", "grunt3area", "monster3", true,1);
AddEntityCollideCallback("grunt3","stop","CollideStop3",true,1);
}

void monster3(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("grunt3",true);
AddEnemyPatrolNode("grunt3","grunt3node1",0,"");
AddEnemyPatrolNode("grunt3","grunt3node2",0,"");
AddEnemyPatrolNode("grunt3","grunt3node3",0,"");
}

void CollideStop3(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("grunt3",false);
}

void OnLeave()
{

}


RE: What do i put in between } and { after SetEntityActive? - FlawlessHappiness - 01-25-2013

There should never be void inside the brackets.

This is the function you wrote:
SetEntityActive("grunt3",false);



This is the entity you want to do the line with. In this situation, a grunt.
This one defines if the entity should be active or inactive.
true = active
false = inactive


You see, you set it to false. That's why it isn't spawning.

In other scripting-situations, post your question here: http://www.frictionalgames.com/forum/forum-39.html
Development Support


RE: What do i put in between } and { after SetEntityActive? - pingthepong - 01-25-2013

(01-25-2013, 09:25 AM)BeeKayK Wrote: There should never be void inside the brackets.

This is the function you wrote:
SetEntityActive("grunt3",false);



This is the entity you want to do the line with. In this situation, a grunt.
This one defines if the entity should be active or inactive.
true = active
false = inactive


You see, you set it to false. That's why it isn't spawning.

In other scripting-situations, post your question here: http://www.frictionalgames.com/forum/forum-39.html
Development Support

Okay, but the grunt still isn't spawning.


RE: What do i put in between } and { after SetEntityActive? - FlawlessHappiness - 01-25-2013

Because these two lines

{
AddEntityCollideCallback("Player", "grunt3area", "monster3", true,1);
AddEntityCollideCallback("grunt3","stop","CollideStop3",true,1);
}


Are not being called.


They would be called if they were under fx. void OnStart


void OnStart()
{
AddEntityCollideCallback("Player", "grunt3area", "monster3", true,1);
AddEntityCollideCallback("grunt3","stop","CollideStop3",true,1);
}



IMPORTANT:
You cannot have 2 void OnStart's.
You must place the lines next to the other, in the first void OnStart like this:


void OnStart()
{
AddEntityCollideCallback("Player", "grunt_area", "monster", true,1);
AddEntityCollideCallback("grunt1","stop","CollideStop",true,1);
AddEntityCollideCallback("Player", "grunt3area", "monster3", true,1);
AddEntityCollideCallback("grunt3","stop","CollideStop3",true,1);
}


RE: What do i put in between } and { after SetEntityActive? - pingthepong - 01-25-2013

(01-25-2013, 09:48 AM)BeeKayK Wrote: Because these two lines

{
AddEntityCollideCallback("Player", "grunt3area", "monster3", true,1);
AddEntityCollideCallback("grunt3","stop","CollideStop3",true,1);
}


Are not being called.


They would be called if they were under fx. void OnStart


void OnStart()
{
AddEntityCollideCallback("Player", "grunt3area", "monster3", true,1);
AddEntityCollideCallback("grunt3","stop","CollideStop3",true,1);
}



IMPORTANT:
You cannot have 2 void OnStart's.
You must place the lines next to the other, in the first void OnStart like this:


void OnStart()
{
AddEntityCollideCallback("Player", "grunt_area", "monster", true,1);
AddEntityCollideCallback("grunt1","stop","CollideStop",true,1);
AddEntityCollideCallback("Player", "grunt3area", "monster3", true,1);
AddEntityCollideCallback("grunt3","stop","CollideStop3",true,1);
}

It worked! thanks man! +rep


RE: What do i put in between } and { after SetEntityActive? - FlawlessHappiness - 01-25-2013

Good!
You'll need to understand the how the script works.

If it isn't being called by anything it will not appear in the script.

On thing i don't understand is why you have:

AddEntityCollideCallback("Player", "grunt2_area", "monster2", true,1);
AddEntityCollideCallback("grunt","stop","CollideStop2",true,1);



Inside the OnEnter.


It should be in the void OnStart, as well.