Frictional Games Forum (read-only)
Area Scripts - 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: Area Scripts (/thread-6116.html)



Area Scripts - sassix - 01-08-2011

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-////


RE: Area Scripts - Tottel - 01-08-2011

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.


RE: Area Scripts - sassix - 01-08-2011

(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


RE: Area Scripts - Tottel - 01-08-2011

http://wiki.frictionalgames.com/hpl2/tutorials/script/entihscript_beginner?

^^


RE: Area Scripts - sassix - 01-08-2011

(01-08-2011, 10:58 PM)Tottel Wrote: http://wiki.frictionalgames.com/hpl2/tutorials/script/entihscript_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


RE: Area Scripts - Russ Money - 01-08-2011

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.


RE: Area Scripts - sassix - 01-08-2011

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