![]() |
GetPlayerSanity Trouble - 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: GetPlayerSanity Trouble (/thread-31693.html) |
GetPlayerSanity Trouble - Southlaguna - 11-15-2015 Hey guys So iv'e been trying to make sequence based on a players sanity level and im starting to figure out this isn't so easy... I'm trying to make it so that the player looses sanity in a specific location and outside of the location the sanity drain stops and so does the sanityevents timer. Im still kinda new to if functions and such so i may have just missd something tiny. PLEASE HELP, information on this type of san_timer will be a huge help for the rest of the project! ----------------------------------------------------------------------------------- void Drink(string &in asEntity) { SetPlayerActive(false); AddTimer("DrinkPosSet", 1.8f, "DrinkingNow"); StartPlayerLookAt("Drink_Area", 0.5f, 1.8f, ""); MovePlayerHeadPos(0.0f, -0.1f, 0.0f, 0.1f, 0.1f); } void DrinkingNow(string &in asTimer) { SetPlayerActive(true); StopPlayerLookAt(); AddTimer("sanloop", 0.1f, "SanityDrain"); AddTimer("sanevents", 3.0f, "Sanevents"); AddTimer("pig", 5.0f, "PigTime"); } void SanityDrain(string &in asTimer) { GiveSanityDamage(0.1f, false); AddTimer("sanloop", 0.1f, "SanityDrain"); } void Sanevents(string &in asTimer) { AddLocalVarInt("iInsane", 1); float partSpeed = 2.5f; switch (GetLocalVarInt("iInsane")) { case 1: // First part partSpeed = 6.5f; GetPlayerSanity(); if(GetPlayerSanity()==97){ PlaySoundAtEntity("", "afx_spooky_door_creaky.snt", "ps_fog_28", 0.8f, false); AddTimer("sane", 6.8f, "Sanevents"); } else if(GetPlayerSanity()> 97){ RemoveTimer("sane"); } break; case 2: // Second part partSpeed = 12.9f; GetPlayerSanity(); if(GetPlayerSanity()==94){ PlaySoundAtEntity("", "afx_spooky_eerie_monster.snt", "ps_fog_28", 0.1f, false); AddTimer("sane", 12.9f, "Sanevents"); } else if(GetPlayerSanity()> 94){ RemoveTimer("sane"); } break; case 3:// Third Part partSpeed = 7.0f; GetPlayerSanity(); if(GetPlayerSanity()==82){ PlaySoundAtEntity("", "insanity_statue_spawn.snt", "spawn_01", 0.1f, false); AddTimer("sane", 6.8f, "Sanevents"); } else if(GetPlayerSanity()> 82){ RemoveTimer("sane"); } break; case 4:// Fourth Part partSpeed = 6.5f; GetPlayerSanity(); if(GetPlayerSanity()==75){ PlaySoundAtEntity("", "insanity_statue_spawn.snt", "spawn_2", 0.1f, false); } else if(GetPlayerSanity()> 82){ RemoveTimer("sane"); } break; } } void PigTime(string &in asTimer) { GetPlayerSanity(); if(GetPlayerSanity()==65){ SetNPCAwake("Hunter", true, true); } else if(GetPlayerSanity()> 65){ AddTimer("pig", 5.0f, "PigTime"); } } void StopDrain(string &in asParent, string &in asChild, int alState) { RemoveTimer("sanloop"); } RE: GetPlayerSanity Trouble - FlawlessHappiness - 11-15-2015 You tried to make something. So what happened? Why isn't your script working? |