Frictional Games Forum (read-only)
How do you make a monster spawn and then he leaves and you can hear a door opened. - 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: How do you make a monster spawn and then he leaves and you can hear a door opened. (/thread-9923.html)

Pages: 1 2 3


How do you make a monster spawn and then he leaves and you can hear a door opened. - BubbleTroll - 08-22-2011

As the subject says how do i script something like that.
Cause if im spawning a monster and telling to him to walk on the waypoints he never goes away.
So could anyone help me please?


RE: How do you make a monster spawn and then he leaves and you can hear a door opened. - xtron - 08-22-2011

Spawn monster
Code:
SetEntityActive("MONSTERNAME", true);

Disable monster
Code:
SetEntityActive("MONSTERNAME", false);

Door open sound
Code:
PlaySoundAtEntity("", "open_door.snt", "DOOR NAME", 0.1f, false);




RE: How do you make a monster spawn and then he leaves and you can hear a door opened. - BubbleTroll - 08-22-2011

How do i do like if the monster walks to an area/pathnote
it does SetEntityActive("servant_grunt_1", false); ?


RE: How do you make a monster spawn and then he leaves and you can hear a door opened. - narutohokager - 08-22-2011

You can put a collider for the monster, and one for the player who activates the monster
Code:
void OnStart
{
AddEntityCollideCallback("Grunt_1", "AreaGruntDeact", "CollideAreaGruntDeact", true, 1);
AddEntityCollideCallback("Player", "AreaGruntActive", "CollideAreaGruntActive", true, 1);
}

void CollideAreaGruntActive(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Grunt_1", true);
AddEnemyPatrolNode("Grunt_1", "PathNodeArea_1", 0, "");
}

void CollideAreaGruntDeact(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Grunt_1", false);
PlaySoundAtEntity("", "SOUNDNAME", "DOORNAME", 0, false);
}



RE: How do you make a monster spawn and then he leaves and you can hear a door opened. - BubbleTroll - 08-22-2011

hmmm... could anyone explain what AddEntity means?
cause all these scripting things are new to me :/


RE: How do you make a monster spawn and then he leaves and you can hear a door opened. - narutohokager - 08-22-2011

AddEntityCollideCallback is a way to call a function when an object / monster / player touches an object / scripts, example

A Grunt through a script that you have set, will do the function call.

Sorry Bad english...



RE: How do you make a monster spawn and then he leaves and you can hear a door opened. - BubbleTroll - 08-22-2011

Oright Big Grin
i think i understand it.
Like if grunt1 collides to areablabla a func will run.
Is that right?


RE: How do you make a monster spawn and then he leaves and you can hear a door opened. - narutohokager - 08-22-2011

Yes it is his Wink



RE: How do you make a monster spawn and then he leaves and you can hear a door opened. - BubbleTroll - 08-22-2011

good ^-^
now i only have to understand all these functions.
also if i want to make a scary moment like if the play walks into an area and a door will open by itself and he loses sanity, do i have to add any sound effect to it?


RE: How do you make a monster spawn and then he leaves and you can hear a door opened. - narutohokager - 08-22-2011

If I understand you want to make a point when the player Walk Into a area the door will open any one is his?

If so, you might be putting a sound that shows the player to fear, you can find in your folder :

Amnesia - The Dark Descent\redist\sounds\react

And implement a command that lowers the sanity of the player :

GiveSanityDamage(10, true);