Frictional Games Forum (read-only)
How do I script this? - 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 I script this? (/thread-17533.html)



How do I script this? - CorinthianMerchant - 08-06-2012

When the player enters a script area, a monster's spawns, follows only one pathnode, and after 10 seconds a sound is played, and after 30 seconds the credits start.
If it's easier can I make different script areas.


RE: How do I script this? - ApeCake - 08-06-2012

Use AddEntityCollideCallback and timers. The script would look like this:

void OnStart()
{
AddEntityCollideCallback("Player", "nameofScriptArea", "spawnmonster", true, 1);
}

void spawnmonster(string &in asParent, string &in asChild, int alState)

{
SetEntityActive("Nameofmonster", true);
AddEnemyPatrolNode("Nameofmonster", "PathNodeArea_1", 0, "");

AddTimer("playsound", 10, "PlaySound");
}

void PlaySound(string &in asTimer)

{
//play sound here, use either PlayGuiSound or PlaySoundAtEntity, example below.
PlaySoundAtEntity("","react_breath_slow.snt", "Player", 0, false);
AddTimer("startcredits", 20, "StartCredits");
}

void StartCredits(string &in asTimer)

{
StartCredits("creditsmusic.ogg", true, "Ending", "MainCredits", 1337);
}

I'm fairly sure that should work.


RE: How do I script this? - CorinthianMerchant - 08-06-2012

Thanks a lot!