Script 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: Script Help (/thread-17367.html) |
Script Help - Dizturbed - 07-30-2012 As you may know, I started scripting and making stories again, but lost a lot of funk the past year. So I would like to know how to basically wake up / fadein and stand up slowly. If you could help me with this I would be much obliged. RE: Script Help - Lizard - 07-30-2012 Since you have done this before, i guess that i can just post this example, in belive, that you will work out from it void OnStart(); { SetPlayerActive(false); FadeOut(0); FadePlayerRollTo(65, 20, 20); MovePlayerHeadPos(-1, -0.45, -1.1, 20, 1); AddTimer("activate_player", 3, "FadeIn"); SetLightVisible("BoxLight_1", false); FadeImageTrailTo(3, 1); FadeRadialBlurTo(0.4, 1); } void FadeIn(string &in timer_name) { FadeIn(2); AddTimer("Start", 2, "WakeUp"); } void WakeUp(string &in timer_name) { if (timer_name == "Start") { SetLightVisible("BoxLight_1", true); AddTimer("MoveHead", 1, "WakeUp"); } else if (timer_name == "MoveHead") { FadeImageTrailTo(0, 1); FadeRadialBlurTo(0, 1); MovePlayerHeadPos(-0.5, -0.2, -1.1, 2, 2); FadePlayerRollTo(0, 1.7, 500); AddTimer("ActivatePlayer", 2, "WakeUp"); } else if (timer_name == "ActivatePlayer") { MovePlayerHeadPos(0, 0, 0, 2, 2); SetPlayerActive(true); } } PS. This example runs with two PlayerStartPositions RE: Script Help - Dizturbed - 07-31-2012 (07-30-2012, 10:17 PM)ZereboO Wrote: Since you have done this before, i guess that i can just post this example, in belive, that you will work out from itYes, but where am I supposed to put this script? This is my script as it is PHP Code: void OnStart(){SetEntityPlayerInteractCallback("TouchArea_1", "Grunt_Gone", true);AddEntityCollideCallback("Player", "Door_Close", "CloseDoor", true, 1);AddEntityCollideCallback("Player", "Walk", "WalkArea", true, 1);AddEntityCollideCallback("Player", "ScriptArea_1", "bedtime", true, 1);SetPlayerActive(false);FadeOut(0);FadePlayerRollTo(65, 20, 20);MovePlayerHeadPos(-1, -0.45, -1.1, 20, 1);AddTimer("activate_player", 3, "FadeIn");FadeImageTrailTo(3, 1);FadeRadialBlurTo(0.4, 1);} I want the player to be moved to the bed and when you get close to it you fall asleep and wake up in that state, how am I supposed to set it up then? Please respond void OnStart() { SetEntityPlayerInteractCallback("TouchArea_1", "Grunt_Gone", true); AddEntityCollideCallback("Player", "Door_Close", "CloseDoor", true, 1); AddEntityCollideCallback("Player", "Walk", "WalkArea", true, 1); AddEntityCollideCallback("Player", "ScriptArea_1", "bedtime", true, 1); SetPlayerActive(false); FadeOut(0); FadePlayerRollTo(65, 20, 20); MovePlayerHeadPos(-1, -0.45, -1.1, 20, 1); AddTimer("activate_player", 3, "FadeIn"); FadeImageTrailTo(3, 1); FadeRadialBlurTo(0.4, 1); } void WalkArea(string &in asParent, string &in asChild, int alState) { MovePlayerForward(50.0f); AddTimer("walktime", 0.1f, "timerdone"); PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false); SetPlayerActive(false); } void timerdone(string &in asTimer) { AddTimer("restarter", 0, "atwalkto"); } void CloseDoor(string &in asParent, string &in asChild, int alState) { SetSwingDoorClosed("mansion_1", true, true); } void bedtime(string &in asParent, string &in asChild, int alState) { FadeOut(1.2f); StartPlayerLookAt("bed_nice_1", 1.0f, 1.0f, ""); AddTimer("WakeUp", 5.0f, "itstime"); } void itstime(string &in asTimer) { RemoveTimer("WakeUp"); TeleportPlayer("PlayerStartArea_2"); StopPlayerLookAt(); } void FadeIn(string &in timer_name) { FadeIn(2); AddTimer("Start", 2, "WakeUp"); } void WakeUp(string &in timer_name) { if (timer_name == "Start") { SetLightVisible("BoxLight_1", true); AddTimer("MoveHead", 1, "WakeUp"); } else if (timer_name == "MoveHead") { FadeImageTrailTo(0, 1); FadeRadialBlurTo(0, 1); MovePlayerHeadPos(-0.5, -0.2, -1.1, 2, 2); FadePlayerRollTo(0, 1.7, 500); AddTimer("ActivatePlayer", 2, "WakeUp"); } else if (timer_name == "ActivatePlayer") { MovePlayerHeadPos(0, 0, 0, 2, 2); SetPlayerActive(true); } } RE: Script Help - Lizard - 07-31-2012 Just to make sure. Your looking for a script were you walk up to the bed, and falls asleep and then wakes up again? RE: Script Help - Dizturbed - 07-31-2012 (07-31-2012, 01:05 PM)ZereboO Wrote: Just to make sure. Your looking for a script were you walk up to the bed, and falls asleep and then wakes up again?Yes, where I wake up after a few seconds.. And then wake up on F.Ex. PlayerStartArea_2 I can do the rest I think... Sorry for this, it's been a long time since the last time. And I didn't even know how to use "else if" and "for" loops.. RE: Script Help - Lizard - 07-31-2012 It took some time, but this script makes it look like when you go near the bed and collide with an area, the player will fall as sleep and wakes up again several second later. I now have 3 PlayerStartPositions. And a area close to the bed, to call all the action. PlayerStaartPosition_3 as you can be set a random place, so that the player dosen't spawn in the bed, and then make him go to area besides the bed. In OnStart(); you put this AddEntityCollideCallback("Player", "SleepArea", "Sleeping", true,1); And timers will take care of the rest. The final sricpt looks like this: void OnStart(); { AddEntityCollideCallback("Player", "SleepArea", "Sleeping", true,1); } void Sleeping(string &in asParent, string &in asChild, int alState) { FadePlayerFOVMulTo(1.5, 1); FadeOut(2); SetPlayerActive(false); AddTimer("sleep", 4, "MoveToBed"); SetLightVisible("BoxLight_1", false); } void MoveToBed(string &in timer_name) { TeleportPlayer("PlayerStartArea_1"); FadePlayerRollTo(65, 20, 20); MovePlayerHeadPos(-1, -0.45, -1.1, 20, 1); FadeImageTrailTo(3, 1); FadeRadialBlurTo(0.4, 1); AddTimer("sleep2", 2, "teleport"); } void teleport(string &in timer_name) { AddTimer("wakingup", 2, "FadeIn"); } void FadeIn(string &in timer_name) { FadeIn(2); AddTimer("Start", 2, "WakeUp"); } void WakeUp(string &in timer_name) { if (timer_name == "Start") { TeleportPlayer("PlayerStartArea_1"); SetLightVisible("BoxLight_1", true); AddTimer("MoveHead", 1, "WakeUp"); } else if (timer_name == "MoveHead") { FadeImageTrailTo(0, 1); FadeRadialBlurTo(0, 1); MovePlayerHeadPos(-0.5, -0.2, -1.1, 2, 2); FadePlayerRollTo(0, 1.7, 500); AddTimer("ActivatePlayer", 2, "WakeUp"); } else if (timer_name == "ActivatePlayer") { MovePlayerHeadPos(0, 0, 0, 2, 2); SetPlayerActive(true); } } RE: Script Help - Dizturbed - 07-31-2012 So do you want me to add the teleport script myself or is it already in therE? Can't see it. But thanks! FOUNDIT RE: Script Help - Lizard - 07-31-2012 its already there tested it myself, before i posted it The teleport happens in the WakeUp timer RE: Script Help - Dizturbed - 07-31-2012 But now I can put my head through walls and stuff.. nvm fixed it. |