SetPlayerActive(false) Help! - 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: SetPlayerActive(false) Help! (/thread-15970.html) |
SetPlayerActive(false) Help! - MaZiCUT - 06-08-2012 void OnStart() { wakeUp(); AddEntityCollideCallback("Player", "KillTheLights", "LightsOut", true, 1); AddEntityCollideCallback("Player", "KillTheLights", "Freeze", true, 1); } void Freeze(string &in asParent, string &in asChild, int alState) { SetPlayerActive(false); AddTimer("", 10, ""); SetPlayerActive(true); } Hello i'm having troubble with something. This is what happends: I go to the custom story, launch.. it's dark i wake up then i go forwards and collide with an area that kills the lights, but i want that area to also freeze the player aka SetPlayerActive(false); and then you have to wait a specific time, 10 seconds in my case, so can you please help? I'm new here so if this is in the wrong section please tell me. Ignore the red! I fixed it with help from [b]P44RTHURN4X and with his script i just made a new area for the freeze and it worked.[/b] RE: SetPlayerActive(false) Help! - P44RTHURN4X - 06-08-2012 Hmm, that's weird... Why does you have no names in your timer? for example: SetPlayerActive(false); AddTimer("game_timer", 10.0f, "freeze_end"); SetPlayerActive(true); 1. You have to put 10.0f not 10 in the timer 2. you have to continue the timer, for example: void Freeze(string &in asParent, string &in asChild, int alState) { SetPlayerActive(false); AddTimer("game_timer", 10.0f, "freeze_end"); } void freeze_end(string &in asTimer) { SetPlayerActive(true); } Try this and then tell me what happens then... GReeZe' P44 RE: SetPlayerActive(false) Help! - MaZiCUT - 06-08-2012 (06-08-2012, 04:45 PM)P44RTHURN4X Wrote: Hmm, that's weird...The player still is able to walk normally right through and nothing happends i can post the full script: void OnStart() { wakeUp(); AddEntityCollideCallback("Player", "KillTheLights", "LightsOut", true, 1); AddEntityCollideCallback("Player", "KillTheLights", "Freeze", true, 1); } void Freeze(string &in asParent, string &in asChild, int alState) { SetPlayerActive(false); AddTimer("game_timer", 10.0f, "freeze_end"); } void freeze_end(string &in asTimer) { SetPlayerActive(true); } void wakeUp() { FadeOut(0); FadeIn(30); FadeImageTrailTo(2, 2); FadeSepiaColorTo(100, 4); SetPlayerActive(false); FadePlayerRollTo(90, 15, 180); FadeRadialBlurTo(0.15, 2); SetPlayerCrouching(true); AddTimer("trig1", 11.0f, "beginStory"); } void beginStory(string &in asTimer){ ChangePlayerStateToNormal(); SetPlayerActive(true); FadePlayerRollTo(0, 33, 33); FadeRadialBlurTo(0.0, 1); FadeSepiaColorTo(0, 4); SetPlayerCrouching(false); FadeImageTrailTo(0,1); } void LightsOut(string &in asParent, string &in asChild, int alState) { SetLampLit("lamp_1", false, true); AddTimer("", 2, "Out2"); } void Out2(string &in asTimer) { SetLampLit("lamp_2", false, true); AddTimer("", 2, "Out3"); } void Out3(string &in asTimer) { SetLampLit("lamp_3", false, true); AddTimer("", 2, "Out4"); } void Out4(string &in asTimer) { SetLampLit("lamp_4", false, true); AddTimer("", 2, "Out5"); } void Out5(string &in asTimer) { SetLampLit("lamp_5", false, true); AddTimer("", 2, "Out6"); } void Out6(string &in asTimer) { SetLampLit("lamp_6", false, true); } void OnEnter() { } void OnLeave() { } RE: SetPlayerActive(false) Help! - SilentStriker - 06-08-2012 (06-08-2012, 04:45 PM)P44RTHURN4X Wrote: Hmm, that's weird...1. He doesn't need to write 10.0f he can just write 10 the f is only used when you use the like 0.342f or 1.53f if it's a number that doesn't have decimals it's not needed to have a f the first part of a timer, the one you call game_timer is only necessary if you need to stop the timer with RemoveTimer(""); if you don't need to remove the timer the name of the timer is not necessary. But it need to call a function for example freeze_end RE: SetPlayerActive(false) Help! - P44RTHURN4X - 06-09-2012 No, he have to type 10.0f, cause the "f" is important, otherwise the cpu cant read the time and the timer start automatically in 1 second after other scripts! And the names, you said it's just for Remove... it's not! These are the internal names which you need in every script in .hps files! .hps are just working with void, bool and float and this 3 kind of scripting are just working with your own internal names. the other name, for the callback, can be all things like "1" or "a". But if you do other callback funcs you need another cbname like "12" or "ab" or only "2" or "b". It's working better with notepad++ - there are important numbers/letters and words in colors. GReeZe' P44 RE: SetPlayerActive(false) Help! - Your Computer - 06-09-2012 (06-09-2012, 12:43 PM)P44RTHURN4X Wrote: No, he have to type 10.0f, cause the "f" is important, otherwise the cpu cant read the time and the timer start automatically in 1 second after other scripts! And the names, you said it's just for Remove... it's not! These are the internal names which you need in every script in .hps files! .hps are just working with void, bool and float and this 3 kind of scripting are just working with your own internal names. the other name, for the callback, can be all things like "1" or "a". But if you do other callback funcs you need another cbname like "12" or "ab" or only "2" or "b". Doubles can be safely converted to floats if the double does not surpass 32-bit. Ints can likewise be safely converted to floats or doubles. The only reason why you would need to put an f at the end of the decimal value for float arguments is if you're overly concerned about performance or syntax. As for timer names, they are not required; an empty string will do, unless you plan on using the timer names--which is good practice to use them, lest you create hundreds of timer callbacks. |