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
Setting an area active [SOLVED]
Greven Offline
Member

Posts: 106
Threads: 13
Joined: May 2011
Reputation: 3
#1
Setting an area active [SOLVED]

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

[WIP] Recidivus
(This post was last modified: 05-09-2011, 08:59 PM by Greven.)
05-09-2011, 08:02 PM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#2
RE: Setting an area active

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
(This post was last modified: 05-09-2011, 08:14 PM by Khyrpa.)
05-09-2011, 08:12 PM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#3
RE: Setting an area active

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:
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
}
05-09-2011, 08:12 PM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#4
RE: Setting an area active

whoa you did the whole scripts
05-09-2011, 08:16 PM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#5
RE: Setting an area active

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.
05-09-2011, 08:30 PM
Find
Greven Offline
Member

Posts: 106
Threads: 13
Joined: May 2011
Reputation: 3
#6
RE: Setting an area active

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?

[WIP] Recidivus
(This post was last modified: 05-09-2011, 08:45 PM by Greven.)
05-09-2011, 08:44 PM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#7
RE: Setting an area active

change (string &in asEntity) BOTH OF THEM
TO:
(string &in asParent, string &in asChild, int alState)
05-09-2011, 08:46 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#8
RE: Setting an area active

@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:47 PM
Find
Greven Offline
Member

Posts: 106
Threads: 13
Joined: May 2011
Reputation: 3
#9
RE: Setting an area active

(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

[WIP] Recidivus
(This post was last modified: 05-09-2011, 08:53 PM by Greven.)
05-09-2011, 08:51 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#10
RE: Setting an area active [SOLVED]

Hot damn! XD

05-09-2011, 09:11 PM
Find




Users browsing this thread: 3 Guest(s)