Frictional Games Forum (read-only)
Setting an area active [SOLVED] - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Setting an area active [SOLVED] (/thread-7915.html)



Setting an area active [SOLVED] - Greven - 05-09-2011

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


RE: Setting an area active - Khyrpa - 05-09-2011

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


RE: Setting an area active - Roenlond - 05-09-2011

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
}



RE: Setting an area active - Khyrpa - 05-09-2011

whoa you did the whole scripts


RE: Setting an area active - Roenlond - 05-09-2011

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.


RE: Setting an area active - Greven - 05-09-2011

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?


RE: Setting an area active - Khyrpa - 05-09-2011

change (string &in asEntity) BOTH OF THEM
TO:
(string &in asParent, string &in asChild, int alState)


RE: Setting an area active - Kyle - 05-09-2011

@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... :/


RE: Setting an area active - Greven - 05-09-2011

(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


RE: Setting an area active [SOLVED] - Kyle - 05-09-2011

Hot damn! XD