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
Area Scripts
sassix Offline
Member

Posts: 56
Threads: 13
Joined: Jan 2011
Reputation: 0
#1
Area Scripts

Abend,
ich hab mal ne Frage bezüglich eines " wenn der spieler in eine Area rein kommt" command. Ich weiss nich genau wie ich anstellen muss. Da ich noch am lernen bin und ich keine ahnung wie ich das anstellen muss wärs nett wenn ihr mir auf die sprünge helfen könntet.

Ich hab hier einfach mal was ausprobiert, auf verschiedener art und weise. Manchmal lässt sich damit die map laden, allerdings sind die gegner dann schon von anfang an aktiv, und manchmal bekomm ich dann einen error das in dieser zeilen ein fehler ist.

Hab ich da wenigstens ansatzsweise was richtig gemacht oder versteh ich den "onenter" command falsch :/

///Gegner Aktiv stellen////

void OnEnter()
{
AddEntityCollideCallback("Player" , "ScriptArea_1" , true , 1);
}

{
SetEntityActive("servant_grunt_2" , true);
SetEntityActive("servant_grunt_1" , true);
SetEntityActive("servant_brute_1" , true);
}


///Gegner Aktiv stellen -Ende-////
01-08-2011, 10:39 PM
Find
Tottel Offline
Senior Member

Posts: 307
Threads: 9
Joined: Nov 2010
Reputation: 0
#2
RE: Area Scripts

Ok, I do not exactly understand what you said.. and I'm just going to assume there's something wrong with the script without translating.
I'm guessing you want those grunts to appear when the player collides with an area.
In that case, you must use a custom function that is called when the player collides with the area.

Add an extra parameter to your
AddEntityCollideCallback("Player" , "ScriptArea_1" , true , 1);
that defines the name of that function; then put those 3 SetEntityActive lines in that function, since right now, they don't belong to any.
01-08-2011, 10:44 PM
Find
sassix Offline
Member

Posts: 56
Threads: 13
Joined: Jan 2011
Reputation: 0
#3
RE: Area Scripts

(01-08-2011, 10:44 PM)Tottel Wrote: Ok, I do not exactly understand what you said.. and I'm just going to assume there's something wrong with the script without translating.
I'm guessing you want those grunts to appear when the player collides with an area.
In that case, you must use a custom function that is called when the player collides with the area.

Add an extra parameter to your
AddEntityCollideCallback("Player" , "ScriptArea_1" , true , 1);
that defines the name of that function; then put those 3 SetEntityActive lines in that function, since right now, they don't belong to any.

y well thats what i said in german , im still learning this stuff and i rly dont know what exactly to do :/
i dont know how to define a name for a funktion, could need some more clues Tongue
01-08-2011, 10:53 PM
Find
Tottel Offline
Senior Member

Posts: 307
Threads: 9
Joined: Nov 2010
Reputation: 0
#4
RE: Area Scripts

http://wiki.frictionalgames.com/hpl2/tut...t_beginner?

^^
(This post was last modified: 01-08-2011, 10:58 PM by Tottel.)
01-08-2011, 10:58 PM
Find
sassix Offline
Member

Posts: 56
Threads: 13
Joined: Jan 2011
Reputation: 0
#5
RE: Area Scripts

(01-08-2011, 10:58 PM)Tottel Wrote: http://wiki.frictionalgames.com/hpl2/tut...t_beginner?

^^

ah well onenter is like onstart :/ i got "onstart" alrdy on top of my .hps so its totaly useless right now Big Grin
i never saw this tut so thx man ! i searched something like that the whole time =) so im gona check this out now and try
01-08-2011, 11:04 PM
Find
Russ Money Offline
Senior Member

Posts: 360
Threads: 25
Joined: Dec 2010
Reputation: 4
#6
RE: Area Scripts

Quote:///Gegner Aktiv stellen////

void OnEnter()
{
AddEntityCollideCallback("Player" , "ScriptArea_1" , "Spawn", true , 1);
}

void Spawn(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_2" , true);
SetEntityActive("servant_grunt_1" , true);
SetEntityActive("servant_brute_1" , true);
}


///Gegner Aktiv stellen -Ende-////

What this does is: When the Player enters ScriptArea_1, run "Spawn". Spawn is our string that will make the enemies activate.

void Spawn triggers what "Spawn" will do, which is activate your grunts and brute.
(This post was last modified: 01-08-2011, 11:40 PM by Russ Money.)
01-08-2011, 11:37 PM
Find
sassix Offline
Member

Posts: 56
Threads: 13
Joined: Jan 2011
Reputation: 0
#7
RE: Area Scripts

void Collide_Area(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_2" , true);
SetEntityActive("servant_grunt_1" , true);
SetEntityActive("servant_brute_1" , true);
FadeOut(20);
}
--------------
Well this one works fine for me, its just a simple map for testing scripts so it doenst matter if i use spawn or collide_area , but thx Smile
(This post was last modified: 01-08-2011, 11:47 PM by sassix.)
01-08-2011, 11:46 PM
Find




Users browsing this thread: 1 Guest(s)