[SCRIPT] Wake up script - 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] Wake up script (/thread-15188.html) |
RE: Wake up script - Saren - 05-05-2012 (05-05-2012, 02:01 AM)Cranky Old Man Wrote: Magically working code, with pixie dust and sugar flakes on top:Lol yea, the map works but not the "Waking up" part RE: Wake up script - Your Computer - 05-05-2012 (05-05-2012, 02:21 AM)Saren Wrote: Lol yea, the map works but not the "Waking up" part At some point you're going to want to call the wakeup function if you want it to have any effect. RE: Wake up script - Saren - 05-05-2012 (05-05-2012, 02:29 AM)Your Computer Wrote: At some point you're going to want to call the wakeup function if you want it to have any effect.Oh yea, it does feel like there something missing here... like a fricken CALLBACK, Right.... so the question is, WHAT'S IT CALLED??? Cause I sure have no idea.. The callbacks I know is either used on doors and stuff or require a script area.... I dunno with one fits this... RE: Wake up script - Cranky Old Man - 05-05-2012 Where did you get OnGameStart() from anyway? You're like one out of ten whom I've seen has done this thing. RE: Wake up script - Your Computer - 05-05-2012 (05-05-2012, 02:40 AM)Saren Wrote: Oh yea, it does feel like there something missing here... like a fricken CALLBACK, Right.... so the question is, WHAT'S IT CALLED??? Cause I sure have no idea.. The callbacks I know is either used on doors and stuff or require a script area.... I dunno with one fits this... All the code you've provided so far hasn't given me enough information to inform you of the syntax required. All i know is that the latest wakeup function you've posted applies to almost no callback. RE: Wake up script - Saren - 05-05-2012 (05-05-2012, 02:45 AM)Your Computer Wrote:void wakeUp () {(05-05-2012, 02:40 AM)Saren Wrote: Oh yea, it does feel like there something missing here... like a fricken CALLBACK, Right.... so the question is, WHAT'S IT CALLED??? Cause I sure have no idea.. The callbacks I know is either used on doors and stuff or require a script area.... I dunno with one fits this... FadeOut(0); // Instantly fades the screen out. (Good for starting the game) FadeIn(20); // Amount of seconds the fade in takes FadeImageTrailTo(2, 2); FadeSepiaColorTo(100, 4); SetPlayerActive(false); FadePlayerRollTo(0, 2, 500); // "Tilts" the players head FadeRadialBlurTo(0.15, 2); SetPlayerCrouching(true); AddTimer("trig1", 15.0f, "beginStory"); // Change '11.0f' to however long you want the 'unconciousness' to last } void beginStory(string &in asTimer){ ChangePlayerStateToNormal(); SetPlayerActive(true); FadePlayerRollTo(65, 20, 20); // Change all settings to defaults FadeRadialBlurTo(0.0, 1); FadeSepiaColorTo(0, 4); SetPlayerCrouching(false); FadeImageTrailTo(0,1); } void OnStart() { //Callbacks AddEntityCollideCallback("Player", "Spawnmusic", "PlayMusic", true, 1); AddEntityCollideCallback("Player", "Stopmusic", "StopMusic", true, 1); AddEntityCollideCallback("Player", "Missingstaff", "Message1", true, 1); AddEntityCollideCallback("Player", "Guarddogthoughts", "Message2", true, 1); AddUseItemCallback("", "Masterbedroomkey", "masterbedroomdoor", "UsedKeyOnDoor", true); AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1); AddEntityCollideCallback("Player", "PlayerCollide2", "MonsterFunction2", true, 1); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("masterbedroomdoor", false, true); PlaySoundAtEntity("", "unlock_door", "masterbedroomdoor", 0, false); PlaySoundAtEntity("", "03_puzzle_secret", "Player", 0, false); RemoveItem("Masterbedroomkey"); } //Doormessages void MasterBedroomDoor(string &in entity) { SetMessage("Messages", "MasterBedroomDoor", 0); } //Crowbar void OnEnter() { AddUseItemCallback("", "crowbar_1", "crowbar_door", "UsedCrowbarOnDoor", true); AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1); } void UsedCrowbarOnDoor(string &in asItem, string &in asEntity) { AddTimer("", 0.2, "TimerSwitchShovel"); RemoveItem("crowbar_1"); } void TimerSwitchShovel(string &in asTimer) { PlaySoundAtEntity("","puzzle_place_jar.snt", "", 0, false); SetEntityActive("crowbar_joint_1", true); } void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState) { AddPlayerSanity(25); PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false); SetSwingDoorLocked("crowbar_door", false, true); AddPropImpulse("crowbar_door", 0, 0, -50, "World"); SetSwingDoorDisableAutoClose("crowbar_door", true); SetSwingDoorClosed("crowbar_door", false, false); SetMoveObjectState("crowbar_door", 1); PlaySoundAtEntity("","break_wood_metal", "BreakEffect", 0, false); CreateParticleSystemAtEntity("", "ps_hit_wood", "BreakEffect", false); SetEntityActive("crowbar_joint_1", false); SetLocalVarInt("Door", 1); } //Foodstorage grunt void MonsterFunction(string &in asParent, string &in asChild, int alState) { SetEntityActive("grunt_foodstorage", true); ShowEnemyPlayerPosition("grunt_foodstorage"); AddEnemyPatrolNode("grunt_foodstorage", "PathNodeArea_1", 2, ""); AddEnemyPatrolNode("grunt_foodstorage", "PathNodeArea_2", 0, ""); AddEnemyPatrolNode("grunt_foodstorage", "PathNodeArea_3", 0, ""); AddEnemyPatrolNode("grunt_foodstorage", "PathNodeArea_4", 0, ""); AddEnemyPatrolNode("grunt_foodstorage", "PathNodeArea_5", 0, ""); AddEnemyPatrolNode("grunt_foodstorage", "PathNodeArea_6", 0, ""); AddEnemyPatrolNode("grunt_foodstorage", "PathNodeArea_7", 0, ""); AddEnemyPatrolNode("grunt_foodstorage", "PathNodeArea_8", 0, ""); } void Despawngrunt_foodstorage(string &in asParent , string &in asChild , int alState) { SetEntityActive("grunt_foodstorage", false); } //Penumbra dog void MonsterFunction2(string &in asParent, string &in asChild, int alState) { SetEntityActive("guard_dog", true); ShowEnemyPlayerPosition("guard_dog"); AddEnemyPatrolNode("guard_dog", "PathNodeArea_9", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_10", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_11", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_12", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_13", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_14", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_15", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_16", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_17", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_18", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_19", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_20", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_21", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_22", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_23", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_24", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_25", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_26", 0, ""); AddEnemyPatrolNode("guard_dog", "PathNodeArea_27", 0, ""); } //Messages void Message1(string &in asChild, string &in asParent, int alState) { SetMessage("Messages", "Missingstaff", 5); } void Message2(string &in asChild, string &in asParent, int alState) { SetMessage("Messages", "Guarddogthoughts", 5); } void OnLeave() { } Whole thing.. RE: Wake up script - Your Computer - 05-05-2012 Your wakeUp function should do fine being called in OnStart. Though, i would recommend not attempting to fade in the screen so quickly. RE: Wake up script - Saren - 05-05-2012 Soo, that means the void on start should be at the top?? RE: Wake up script - Saren - 05-10-2012 Okay... this is seriously annoying me now... does anyone have a wake up sequence that ACTUALLY work.... cause mine sure as hell don't.. RE: Wake up script - Adrianis - 05-10-2012 Dude you need to tell us whats wrong. Is there a script error, is the thing just not happening, is it all happenin too fast or is just one part not working? Yes, OnStart should be at the top. TBH I've never tried having it elswhere but I don't think it would react too well, and for organisational purposes I recommend always having OnStart at the start of the script, as this is where the initial setup of variables and callbacks should take place. It looks like there is still no callback in OnStart to actually start the WakeUp, which you may want. Also, all the stuff in your WakeUp function is going to be executed immediately and simultaneously, from whats in there you probably want some parts to be delayed. Things like the FadeIn/Out, SetPlayerActive/Crouching etc should be done in OnStart. If this wakeing up happens immediatly at the start of the game, then you will probably want all of it in OnStart. If I was in your position right now, the best thing I could do to figure this out is find a working example of a script for this sort of 'waking up' sequence, study it, and replicate bit by bit till you understand all the parts that are going in. The problem is that this can be quite a complicated sequence to achieve, and if you are not familiar with the flow of logic and how to use functions/loops you may find it very difficult. |