Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting an area active [SOLVED]
Author Message
Greven Offline
Member

Posts: 106
Joined: May 2011
Reputation: 3
Post: #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 all posts by this user Quote this message in a reply
Khyrpa Offline
Senior Member

Posts: 615
Joined: Apr 2011
Reputation: 24
Post: #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 all posts by this user Quote this message in a reply
Roenlond Offline
Senior Member

Posts: 331
Joined: Apr 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Khyrpa Offline
Senior Member

Posts: 615
Joined: Apr 2011
Reputation: 24
Post: #4
RE: Setting an area active
whoa you did the whole scripts
05-09-2011 08:16 PM
Find all posts by this user Quote this message in a reply
Roenlond Offline
Senior Member

Posts: 331
Joined: Apr 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Greven Offline
Member

Posts: 106
Joined: May 2011
Reputation: 3
Post: #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 all posts by this user Quote this message in a reply
Khyrpa Offline
Senior Member

Posts: 615
Joined: Apr 2011
Reputation: 24
Post: #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 all posts by this user Quote this message in a reply
Kyle Offline
Posting Freak

Posts: 910
Joined: Sep 2010
Reputation: 7
Post: #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 all posts by this user Quote this message in a reply
Greven Offline
Member

Posts: 106
Joined: May 2011
Reputation: 3
Post: #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 all posts by this user Quote this message in a reply
Kyle Offline
Posting Freak

Posts: 910
Joined: Sep 2010
Reputation: 7
Post: #10
RE: Setting an area active [SOLVED]
Hot damn! XD

05-09-2011 09:11 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)