Amnesia Editor: Scripting - 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: Amnesia Editor: Scripting (/thread-11502.html) |
Amnesia Editor: Scripting - Aweno - 11-25-2011 'Right. -Hey, y'all two-two, 'I'm new on these forums, 'and-- I'm not set to where in the forums to post this thread about my problem I've tiredly trying to solve, 'and-- I'ven't find a solution to this point. 'So, I'm working on a custom-story for Amnesia: The Dark Descent, 'it's called 'Decay' - and for the rooting beginning, I've built a cellar, 'typically close to the 'Wine Cellar' in the original story, 'which's identical to a blocked-out mine, 'but, yeah - you wake up in a wooden-framed bed, and stagger off to find a lantern inside of the dirt-blocked 'corridor', then you find a letter, 'where you see that someone's written an evident 'last note' or 'last words', where they've corded their death to a cave-in from inside a mine-shaft, 'which belongs to the story, 'but-- here's the deal, you find a key, 'but in order to get to the door that the key's supposed to basically unlock, 'you've to get through the mine's 'cellar'-door, 'and you don't've a key. -Look at this, 'I want the player to, 'as he picks up a tinderbox or examines a box close to the door's frame he's/she's scripted to go down onto the player's knees, or lie down, 'to check the empty space below the door and the door-frame, 'and there's where the one playing's to find a crowbar, 'but I've no idea how to do this, 'I know that I'm driving to use two commands with 'headpos-- or 'rollheadto'-something, 'I know how to use .hps fairly well, 'but I'm not sure how to make the player - 'when he/she picks up the tinderbox - to get on their knees and look below the door's empty space, I've tried it, 'and I'ven't found any good way to use an 'examine'-area, 'or any way at all to do this. 'My best try'd strike for the 'OnPickup' for the tinderbox, 'but I don't know how to execute the script...! 'I'd like some help with this, 'and I'm sorry for the long text, 'but, here it's. -Here is my entire .hps-file... //////////////////////////////// // Run first time starting map void OnStart() { SetLocalVarInt("iIntroPart", 0); // Initialize the sequence to null } void OnEnter() { AddTimer("tmrIntro", 1.0f, "introSequence"); // Launch the introduction sequence 1 second in } void introSequence(string &in asTimer) { AddLocalVarInt("iIntroPart", 1); // Increment the part so we move onto the next (first run through will make this 1, or the first part) float partSpeed = 1.5f; // This denotes the DEFAULT value for how long parts last in seconds switch (GetLocalVarInt("iIntroPart")) { case 1: // First part // Actions such as FadeIn, PlaySoundAtEntity, whatever you like. This will be a simple wake up sequence partSpeed = 5.0f; // I want this part to last 5 seconds FadeOut(0.0f); // Instantly turn screen to black FadePlayerRollTo(50, 220, 220); // Simulate being on the bed MovePlayerHeadPos(1.7, 0.03, 0.0, 0.5, 0.2); // Simulate LYING onto the bed FadeIn(20.0f); // Fade the screen in from black, 20 secs long break; case 2: // Second part partSpeed = 5.0f; // I want this part to last 5 seconds FadePlayerRollTo(0.0f, 33.0f, 33.0f); // Make the player's view normal MovePlayerHeadPos(0, 0, 0, 1, 0.5f); // Make the player's view normal // Player is woken up! break; } if (GetLocalVarInt("iIntroPart") <2) // If the current part is less than the total length of the sequence (in this case 2) { // Then we want to call the same function again to continue the sequence! AddTimer("tmrIntro", partSpeed, "introSequence"); // Notice that we use "partSpeed" as the delay, which will make the current part last for how ever long we specified } } //USE OF KEY void OnLeave() { AddUseItemCallback("", "awesomekey_1", "mansion_1", "KeyOnDoor", true); } void KeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("mansion_1", false, true); PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false); RemoveItem("awesomekey_1"); } //////////////////////////////// // On stepping inside of the scripted area void UsedKeyOnDoor(string &in asItem, string &in asEntity) { StopSound("wall_crawl", 0); //COLLIDING AddEntityCollideCallback("Player", "ScriptArea_1", "wall_crawl", false, 1); PlaySoundAtEntity("wall_crawl", "15_wall_crawl", "wall_crawl", 0, false); } // ON EXAMINING THE DOOR'S SPACE BELOW THE DOOR void OnLoadMap() { SetEntityCallbackFunc("tinderbox_lookbelow", "OnPickup"); } void OnPickup(string &in asEntity, string &in type) { FadePlayerRollTo(50, 220, 220); MovePlayerHeadPos(1.7, 0.03, 0.0, 0.5, 0.2); PlaySoundAtEntity("drag_dirt", "03_drag_dirt", "Player", 0, false); } 'And here's my apparently useless piece of script: // ON EXAMINING THE DOOR'S SPACE BELOW THE DOOR void OnLoadMap() { SetEntityCallbackFunc("tinderbox_lookbelow", "OnPickup"); } void OnPickup(string &in asEntity, string &in type) { FadePlayerRollTo(50, 220, 220); MovePlayerHeadPos(1.7, 0.03, 0.0, 0.5, 0.2); PlaySoundAtEntity("drag_dirt", "03_drag_dirt", "Player", 0, false); } 'If you can assist me, 'please share that with me, I'd really like to continue this map, 'it looks good, so far. -Thank YOU for your time. ;'3 RE: Amnesia Editor: Scripting - Statyk - 11-25-2011 (11-25-2011, 10:59 PM)Aweno Wrote: 'And here's my apparently useless piece of script: I did a script like this on my Sciophobia campaign. Normal head position is 0. to go DOWN, you need to set the value from -0.01f to -1.5f (if set lower, the view goes through the floor)... Go into the Entity tab of the tinderbox and fill in the PlayerInteractCallback as: "tindypick1" and replace your "OnPickup" with this: Code: void tindypick1(string &in asEntity) RE: Amnesia Editor: Scripting - Aweno - 11-26-2011 (11-25-2011, 11:30 PM)Statyk Wrote:(11-25-2011, 10:59 PM)Aweno Wrote: 'And here's my apparently useless piece of script: 'Oh, shit - thanks, brohanovic - it works...! 'Thanks alot, 'right now, 'I'm just set to-- how do I make him rotate normally? 'Daniel spites around the axis like a cogwheel, 'I guess that's just how it works, 'unless I'm able to change the 'FadePlayerRollTo'. I don't know how to fix that, 'but - thanks for the help, I really appreciate that. 'C'y'all, 'and've fun. 'And, how do I freeze the player to prevent him/her from waddling off somewhere else in the tunnel, 'unfreezing the player once he/she picks up the crowbar...? 'Thanks...! RE: Amnesia Editor: Scripting - Statyk - 11-27-2011 (11-26-2011, 03:09 PM)Aweno Wrote: 'Oh, shit - thanks, brohanovic - it works...! 'Thanks alot, 'right now, 'I'm just set to-- how do I make him rotate normally? 'Daniel spites around the axis like a cogwheel, 'I guess that's just how it works, 'unless I'm able to change the 'FadePlayerRollTo'. I don't know how to fix that, 'but - thanks for the help, I really appreciate that. 'C'y'all, 'and've fun."Waddling" made me laugh. Anyway, you have to use SetPlayerActive(true/false); .... Let me try to script this. also add to the fall script. //__________________________ void tindypick1(string &in asEntity) { SetPlayerActive(false); StartPlayerLookAt("doorcrowbar", 2, 2, ""); FadePlayerRollTo(50, 3, 5); MovePlayerHeadPos(1.7, -1.5f, 0.0, 1, 0.3); PlaySoundAtEntity("drag_dirt", "03_drag_dirt", "Player", 0, false); } //__________________________ Go into the editor and go to the PlayerInteractCallback of the crowbar and put in "crowpick1". Then change the crowbar's NAME to "doorcrowbar" and add this to your script: //__________________________ void crowpick1(string &in asEntity) { StopPlayerLookAt(); SetPlayerActive(true); FadePlayerRollTo(0, 3, 5); MovePlayerHeadPos(0, 0, 0, 1, 0.3); } //__________________________ so in the end, it looks like this: void tindypick1(string &in asEntity) { SetPlayerActive(false); StartPlayerLookAt("doorcrowbar", 2, 2, ""); FadePlayerRollTo(50, 3, 5); MovePlayerHeadPos(1.7, -1.5f, 0.0, 1, 0.3); PlaySoundAtEntity("drag_dirt", "03_drag_dirt", "Player", 0, false); } void crowpick1(string &in asEntity) { StopPlayerLookAt(); SetPlayerActive(true); FadePlayerRollTo(0, 3, 5); MovePlayerHeadPos(0, 0, 0.0, 1, 0.3); } I did this exact thing in my map, "Sciophobia" =P haha |