How i can reload script area when i die ? And how to create loopable sounds ? - 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 i can reload script area when i die ? And how to create loopable sounds ? (/thread-17389.html) Pages:
1
2
|
How i can reload script area when i die ? And how to create loopable sounds ? - rakakak11 - 07-31-2012 (sorry for bad english) Like the title says.... I have working checkpoint and when i die by monsters i want to encounter the same monsters again... I want some script areas reload when i die....i know that there is same thread like i have but i really dont understand what i have to do.... "http://www.frictionalgames.com/forum/thread-17384.html" Too i don't understand how i can have ambient sounds (loopable sounds, like baby start crying every 1 minute...lol) RE: How i can reload script area when i die ? And how to create loopable sounds ? - FlawlessHappiness - 07-31-2012 To do the baby thing the answer is TIMERS Put this inside a function: AddTimer("", 60, "Baby_cry"); This means it takes 60 seconds before it calls the function "Baby_cry" Then make the function: void Baby_cry(string &in asTimer) { PlaySoundAtEntity("", "[BABYCRY SOUND]", "Player", 0.5f, false); AddTimer("", 60, "Baby_cry"); } See? I call the same timer inside the timerfunction. This means it will repeat doing this to infinity RE: How i can reload script area when i die ? And how to create loopable sounds ? - drunkmonk - 07-31-2012 For the checkpoint, what you must do is you have to re-apply all the functions that happen when encountering the monster. I will use my script for example What this does is before you die the function will run normally as it should the first time through. Now when you die and you respawn at the checkpoint, the script will register that the monster encounter has already happened and doesn't need to do it again unless you declare it in the checkpoint function, that way when you die the script knows that it has to run the function again Hope this helped void OnStart { AddEntityCollideCallback("Player", "monster_spawn", "monsterspawn", true, 1); CheckPoint("check01", "PlayerStartArea_2", "CheckPoint01", "", ""); } void CheckPoint01(string &in asName, int alCount) { SetPlayerHealth(RandFloat(80, 95)); AddEntityCollideCallback("Player", "monster_spawn", "monsterspawn", true, 1); ResetProp("monster_door"); } void monsterspawn(string &in asParent, string &in asChild, int alState) { SetEntityActive("servant_grunt_2", true); SetPropHealth("monster_door", 0.0); ShowEnemyPlayerPosition("servant_grunt_2"); AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_6", 0.0, ""); AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_7", 0.0, ""); AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_8", 0.0, ""); AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_9", 0.0, ""); } RE: How i can reload script area when i die ? And how to create loopable sounds ? - Mackiiboy - 07-31-2012 I'll try to simplify it a bit more than I did in the 1st thread. I suppose you have a collide callback function or something similar that spawns the monster, right? Inside that function that activates the monster you should put a checkpoint, you could also put it inside void OnStart() instead, but not both. I recommend to use your monster function if your are going to have more checkpoints than just one. You can put this one inside your function with the monster (or OnStart): Code: CheckPoint("", "NameOfTheAreaYouWantToSpawnAtAfterDeath", DeathFunction, "", ""); Your deathfunction would be something like this: Code: void DeathFunction(string &in asName, int alCount) (07-31-2012, 08:59 PM)rakakak11 Wrote: Like the title says.... RE: How i can reload script area when i die ? And how to create loopable sounds ? - rakakak11 - 07-31-2012 thanks for all replies i try everything now... EDIT: WOW thanks! drunkmonk scripts helped me.... this is how i has it before...: Quote:void Zombik(string &in asParent, string &in asChild, int alState) And this is Fixed version : Quote:void Zombik(string &in asParent, string &in asChild, int alState)So i did everything right (probably) like mackiiboy says, but you forgot that i have to add collidecallback things too.... And too i dont need to reset monsters..they resets automaticaly with my script Now i go try the loopable sounds...really thanks all for help RE: How i can reload script area when i die ? And how to create loopable sounds ? - rakakak11 - 07-31-2012 hmm but the sounds not work....i really dont know why... there is my script: Quote:void OnEnter() As you can see i putted more loopable sounds at once.. probably this is error EDIT: deleted other sounds and still not working... RE: How i can reload script area when i die ? And how to create loopable sounds ? - Adny - 07-31-2012 They probably do work, you just have very large amounts of time between them (several minutes in fact). Just to clarify, those times are in seconds, not milliseconds RE: How i can reload script area when i die ? And how to create loopable sounds ? - rakakak11 - 07-31-2012 (07-31-2012, 11:05 PM)andyrockin123 Wrote: They probably do work, you just have very large amounts of time between them (several minutes in fact). Just to clarify, those times are in seconds, not millisecondsyes i know but i was waiting like few minutes...but i try lower the second amount. I lowered and still not working... And what the hell is PreloadSound(string& asSoundFile); ???? Maybe this is solution RE: How i can reload script area when i die ? And how to create loopable sounds ? - Adny - 07-31-2012 PlaySoundAtEntity uses .snt files, not .ogg files (at least not directly). You're probably better off using random integers to generate a random time to play, as well as a random sound. Try using this instead: void OnStart() { AddEntityCollideCallback("Player", "ScriptArea_1", "Zavalenie", true, 1); } void Zavalenie(string &in asParent, string &in asChild, int alState) { PlayGuiSound("explosion_rock_large.ogg", 0.8f); StopMusic( 0, 50); SetEntityActive("kamen1", true); SetEntityActive("zombik", false); StartScreenShake(0.5f, 1, 1, 0); AddTimer("", RandInt(30, 60), "ambients"); AddTimer("", RandInt(30, 60), "ambients2"); } void ambients(string &in asTimer) { PlaySoundAtEntity("", "scare_male_terrified"+RandInt(1, 3), "Player", 0.5f, false); AddTimer("", RandInt(30, 60), "ambients"); } void ambients2(string &in asTimer) { PlaySoundAtEntity("", "scare_wall_stomp", "Player", 0.5f, false); AddTimer("", RandInt(30, 60), "ambients2"); } This script will randomly choose a time between 30 and 60 seconds to play a random noise at. Hope that helped! RE: How i can reload script area when i die ? And how to create loopable sounds ? - rakakak11 - 08-01-2012 (07-31-2012, 11:16 PM)andyrockin123 Wrote: PlaySoundAtEntity uses .snt files, not .ogg files (at least not directly). You're probably better off using random integers to generate a random time to play, as well as a random sound. Try using this instead:This is what im looking for !!! Sound now work but the "scare_male_terrified" didnt work... i deleted this "scare_male_terrified" +RandInt(1, 3) and now "scare_male_terrified" sound work ! Im again really grateful for help. But what is this thing that i deleted ? "+RandInt(1, 3)" |