CrysisMK2 Posted March 10, 2012 Share Posted March 10, 2012 Just need some help with the papyrus script system...I knew how to use the old Oblivion scripting framework well enough, but this is greek, and I would really rather just get some help on this simple problem than learn the new scripting language at this point... If someone could help me with a script to: Force the player's character to activate a chair when a lever is pulled...for about 27 seconds (to watch a cutscene play out in front of them), then let them stand up.I just need help with the force activating part. Thanks in advance! PS: I'm lazy, but I have a right to be, I have a newborn and not much time for myself! Link to comment Share on other sites More sharing options...
fg109 Posted March 10, 2012 Share Posted March 10, 2012 I know exactly what you mean! I'm used to the Oblivion scripting language too and messing around with Papyrus was so difficult at first. There seems to be a lot less functions (or maybe it's just because I love OBSE) and the thing with properties was really hard to get used to at first. As for what you need, right now I have some ideas for how the scripting should work: 1. Pull level to add magic effect to player (through an ability i guess?)2. At start, disable player controls, get heading angle to the chair, set angle, play idle walk animation, register for updates3. check for distance from chair during updates, activate chair when close enough, unregister for update, wait 30 seconds4. after the wait, enable player controls, remove ability Link to comment Share on other sites More sharing options...
CrysisMK2 Posted March 10, 2012 Author Share Posted March 10, 2012 http://www.creationkit.com/Activate_-_ObjectReference seems to be what I'm looking for, but idk how to set the ObjectReference to the object I need activated....yet. Here's what I have so far... Scriptname ForceActivateChair extends ObjectReference {Force Player character to activate Legacy Mansion rocking chair.} Event OnActivate(ObjectReference akActionRef) RockingChair.Activate(Game.GetPlayer(), true) endEvent So yeah. How to make RockingChair point to the chair? We'll see... Link to comment Share on other sites More sharing options...
fg109 Posted March 10, 2012 Share Posted March 10, 2012 This is the script I came up with for a magic effect: ScriptName CustomMagicEffectScript extends ActiveMagicEffect Idle property WalkIdle auto Idle property StopIdle auto ObjectReference property ChairRef auto Spell property CustomSpell auto Actor Player Event OnEffectStart(Actor akTarget, Actor akCaster) Player = Game.GetPlayer() Game.DisablePlayerControls() float offsetz = Player.GetHeadingAngle(ChairRef) Player.SetAngle(Player.GetAngleX(), Player.GetAngleY(), Player.GetAngleZ() + offsetz) Player.PlayIdle(WalkIdle) RegisterForUpdate(1) EndEvent Event OnUpdate() if (Player.GetDistance(ChairRef) > 100) Return endif UnregisterForUpdate() Player.PlayIdle(StopIdle) ChairRef.Activate(Player) Utility.Wait(30) Player.RemoveSpell(CustomSpell) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) Game.EnablePlayerControls() EndEvent I compiled it fine, but I don't know how well it'll actually work. As for making your variables point to something, that's what the properties are for. Once you declare a property in your script, you can set the properties by double-clicking the script after you've attached your script to something. This should open up the properties window for your script. You can also add new properties here without opening up your script again. For the script I posted, CustomSpell should point to the spell that contains the magic effect this script is attached to. ChairRef should obviously be the chair you're talking about. WalkIdle and StopIdle should be the idle animations for walking and standing around. I don't know exactly which ones they are, but I think "CharacterMoveStart" and "CharacterMoveStop". Link to comment Share on other sites More sharing options...
CrysisMK2 Posted March 10, 2012 Author Share Posted March 10, 2012 Wow. Thanks. I'll test that right away. Link to comment Share on other sites More sharing options...
fg109 Posted March 10, 2012 Share Posted March 10, 2012 I just took a look at MQ01 because I wanted to see how the devs did the opening sequence, and I found the command SetPlayerAIDriven! No need for that stuff I put in the script with animations and timing, you just need to give the player some AI packages! So just disable player controls when you pull the lever, set player to AI-driven, and give the player a reference alias. Trigger the alias' sit in chair package. When your cutscene is done, stop player from being AI-driven and just re-enable the controls. Link to comment Share on other sites More sharing options...
CrysisMK2 Posted March 10, 2012 Author Share Posted March 10, 2012 I just took a look at MQ01 because I wanted to see how the devs did the opening sequence, and I found the command SetPlayerAIDriven! No need for that stuff I put in the script with animations and timing, you just need to give the player some AI packages! So just disable player controls when you pull the lever, set player to AI-driven, and give the player a reference alias. Trigger the alias' sit in chair package. When your cutscene is done, stop player from being AI-driven and just re-enable the controls. Aha! Thanks again! I was trying to figure out why that script wasn't working lol. This solved my problem! Link to comment Share on other sites More sharing options...
CrysisMK2 Posted March 10, 2012 Author Share Posted March 10, 2012 You're a beast, man. Wish I could give more than one kudos. Lol. Link to comment Share on other sites More sharing options...
Recommended Posts