Frictional Games Forum (read-only)
Need help with this scripting. - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Need help with this scripting. (/thread-16592.html)

Pages: 1 2 3


Need help with this scripting. - HoyChampoy - 06-29-2012

Hey guys. I am working on a custom story and there is this part where you are in a hallway and a grunt is patrolling it. You have to sneak across him in order to get to the other room. But the thing i want to do is that if the player fails to sneak across the hallway and dies, I want the player respawn and try sneak pass him again. (like a videogames these days. if you die, you start from a checkpoint and you have to do the part again.) I just cant seem to do it. When I die, i do start at the assigned checkpoint, but the script areas no longer work and the grunt doesn't spawn anymore. Is there a way to do it? Please help. Thanks!


RE: Need help with this scripting. - Cruzore - 06-29-2012

Might just refer you to http://www.frictionalgames.com/forum/thread-16542-page-2.html


RE: Need help with this scripting. - HoyChampoy - 06-29-2012

(06-29-2012, 07:22 PM)FastHunteR Wrote: Might just refer you to http://www.frictionalgames.com/forum/thread-16542-page-2.html
i tried it but i cant seem to get it to work. Here it is:


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


void Respawn_1(string &in asParent, string &in asChild, int alState)
{
CheckPoint("","PlayerRespawnArea_1" ,"TryAgainOne", "DeathHints", "DeathHint1");
}


void TryAgainOne(string &in asParent, string &in asChild, int alState)
{
CreateEntityAtArea("hallway_grunt", "", "monster_area1", false);
}

And if i get the monster to work, is there a way to get a script area to spawn again?


RE: Need help with this scripting. - Cruzore - 06-29-2012

wrong callback syntax at TryAgainOne.
right one is:
void TryAgainOne(string &in asName, int alCount)
Also, you forgot the entity file at CreateEntityAtArea:
CreateEntityAtArea("hallway_grunt", "servant_grunt.ent", "monster_area1", false);
And your second question, what do you mean by script area? I don't understand your question.


RE: Need help with this scripting. - EXAWOLT - 06-29-2012

if you want the area to work several times, just change the true to false.
instead of creating an enemy at a entity, i suggest to set out one in the editor and make him inactive, and when colliding with the area, the monster will be activated, and if you die, the monsters will always dissappear but when you collides with the area it will respawn.
SetEntityActive("Monster", true);


RE: Need help with this scripting. - Cruzore - 06-29-2012

It will respawn? Good to know, thought it wouldn't.
One more thing though, does OnEnter() play again when you respawn?


RE: Need help with this scripting. - HoyChampoy - 06-29-2012

(06-29-2012, 07:47 PM)FastHunteR Wrote: wrong callback syntax at TryAgainOne.
right one is:
void TryAgainOne(string &in asName, int alCount)
Also, you forgot the entity file at CreateEntityAtArea:
CreateEntityAtArea("hallway_grunt", "servant_grunt.ent", "monster_area1", false);
And your second question, what do you mean by script area? I don't understand your question.
alright, i got the monster to spawn again, but how do i get him to spawn where he first came from instead of the spot where he killed me? And for the other question, i want the script areas to activate again after the player dies. Ex: the player walks down a hallway and goes through a script area, which cause the screen to fade and forcing the player to put away his lantern., i want it so that if the player dies, all this would happen again when he went through a second time. It sounds weird when i put it in words, so i found a video that would help describe it.

Notice as he goes though the part at 6:43 but dies later on, but at 7:34 when he respawns all the things happen again, like the screen turning black.






RE: Need help with this scripting. - Cruzore - 06-29-2012

Exawolt's solution should fix both. So, anyone knows if OnEnter() plays again after you respawn?


RE: Need help with this scripting. - HoyChampoy - 06-29-2012

(06-29-2012, 07:48 PM)EXAWOLT Wrote: if you want the area to work several times, just change the true to false.
instead of creating an enemy at a entity, i suggest to set out one in the editor and make him inactive, and when colliding with the area, the monster will be activated, and if you die, the monsters will always dissappear but when you collides with the area it will respawn.
SetEntityActive("Monster", true);
I tried it but he wont even spawn when i collide with the area anymore

(06-29-2012, 07:48 PM)EXAWOLT Wrote: if you want the area to work several times, just change the true to false.
instead of creating an enemy at a entity, i suggest to set out one in the editor and make him inactive, and when colliding with the area, the monster will be activated, and if you die, the monsters will always dissappear but when you collides with the area it will respawn.
SetEntityActive("Monster", true);
Heres a pic
[Image: ?action=view&current=helppic.png]


i want it so that if the player fails, everything resets, such as the enemy pos and the fadeout script area


RE: Need help with this scripting. - Your Computer - 06-29-2012

If the grunt kills the player, it won't activate again. The monsters were designed to not prevent the player from progressing, and dynamically created monsters don't follow path nodes. You'll need to have monsters in store to "reactivate" them.