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
What do i put in between } and { after SetEntityActive?
pingthepong Offline
Junior Member

Posts: 3
Threads: 1
Joined: Jan 2013
Reputation: 0
#1
What do i put in between } and { after SetEntityActive?

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()
{

}
01-25-2013, 08:16 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: What do i put in between } and { after SetEntityActive?

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

Trying is the first step to success.
(This post was last modified: 01-25-2013, 09:26 AM by FlawlessHappiness.)
01-25-2013, 09:25 AM
Find
pingthepong Offline
Junior Member

Posts: 3
Threads: 1
Joined: Jan 2013
Reputation: 0
#3
RE: What do i put in between } and { after SetEntityActive?

(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.
01-25-2013, 09:30 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: What do i put in between } and { after SetEntityActive?

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);
}

Trying is the first step to success.
01-25-2013, 09:48 AM
Find
pingthepong Offline
Junior Member

Posts: 3
Threads: 1
Joined: Jan 2013
Reputation: 0
#5
RE: What do i put in between } and { after SetEntityActive?

(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
01-25-2013, 09:52 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: What do i put in between } and { after SetEntityActive?

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.

Trying is the first step to success.
01-25-2013, 09:55 AM
Find




Users browsing this thread: 1 Guest(s)