Frictional Games Forum (read-only)

Full Version: Setting an area active [SOLVED]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok so i wanna set an area active with another area which activates a grunt.
Meaning you walk in to one area and that activates a grunt and another area which you will walk into which will set of another grunt, but i dont know what kind of coding i should do to make the area active. Help plz :3
Areas can be done active just like entities:
SetEntityActive(string& asName, bool abActive);
string &in asName = "nameofyourareahere" and bool is true = active false = unactive
So you can put the collide callback in the OnStart part
OR
you could just keep the areas active and when u want the collide to happen.. just add the collide callback in the function that would activate the areas or smthing
Code:
void OnStart()
{
AddEntityCollideCallback("Player", "ActivateMonster_Area", "ActivateMonster", true, 1); //Callback for first function
}

void ActivateMonster(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster_1", true); //Activates first monster
AddEntityCollideCallback("Player", "ActivateMonster_2_Area", "ActivateMonster_2", true, 1); //Adds callback for the second monster
}

void ActivateMonster_2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster_2", true); //Activates second monster
}

That SHOULD work, although I haven't tested it in-game so I might have made mistakes.

Alternatively, you could probably do something like this:
Code:
void OnStart()
{
AddEntityCollideCallback("Player", "ActivateMonster_Area", "ActivateMonster", true, 1); //Callback for first function
AddEntityCollideCallback("Player", "ActivateMonster_2_Area", "ActivateMonster_2", true, 1); //Adds callback for the second monster
}

void ActivateMonster(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster_1", true); //Activates first monster
SetEntityActive("ActivateMonster_2_Area", true); //Activates the area that activates monster 2, it will need to be inactive from start.
}

void ActivateMonster_2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster_2", true); //Activates second monster
}
whoa you did the whole scripts
I consider it easier to learn with examples Smile No meaning telling someone what to do, if you don't show them how to do it.
God dammit, you did such nice explanations and I still got it wrong... Ok so my area's are called Death_1 And Death_2.
Now this is the scripting:
void OnStart()
{
AddEntityCollideCallback("Player", "Death_1", "CollideActiveGrunt", true,1);
AddEntityCollideCallback("Player", "Death_2", "CollideActiveBrute", true,1);
}
void CollideActiveGrunt(string &in asEntity)
{
SetEntityActive("servant_grunt_2", true);
SetEntityActive("Death_2", true);
}

void CollideActiveBrute(string &in asEntity)
{
SetEntityActive ("servant_brute_1", true);
}

But it doesnt work Sad spot the problem?
change (string &in asEntity) BOTH OF THEM
TO:
(string &in asParent, string &in asChild, int alState)
@Greven,

What is the error report?

If there is none and it is just straight-up broken, then i don't know, maybe the space inbetween "SetEntityActive" and "("servant_brute_1", true);" on the second to last line? I don't think it should be there... :/
(05-09-2011, 08:46 PM)Khyrpa Wrote: [ -> ]change (string &in asEntity) BOTH OF THEM
TO:
(string &in asParent, string &in asChild, int alState)

Cheers to you sir!

@kyle,


problem solved :3 Mister Khyrpa was too fast Tongue
Hot damn! XD