lFostelR Posted November 19, 2014 Share Posted November 19, 2014 Scriptname JTAeatscript extends ActiveMagicEffect Idle Property IdleEatingStandingStart AUTO Idle Property chaireatingstart AUTO Event OnEffectStart (Game.player.SetDontMove(),actor akactor, actor akCaster) Game.player.SetDontMove() if Game.Getplayer().GetSitState() == 0 ; While the player has a weapon drawn, try to have him sheathe it every tenth-second. while !EscapeClause && player.IsWeaponDrawn() && !player.IsDead() Game.player.SetDontMove()==3.playidle(IdleEatingStandingStart) endif if Game.Getplayer().GetSitState() == 3 Game.Getplayer().playidle(chaireatingstart) endif EndEvent can anyone tell me how to add a function to this example that will disable movement untill the effect is over? something like: player.SetDontMove() Game.DisablePlayerControls keep in mind, I have zero scripting skills. Link to comment Share on other sites More sharing options...
Arocide Posted November 19, 2014 Share Posted November 19, 2014 (edited) If you don't want the player to be able to move through input (W, S, A, D) then Game.DisablePlayerControls is the way to go, SetDontMove just stops the actor (in your case the player actor) from moving / being pushed around, so the player can potentially still do actions that could stuff up the animations. So an example of what it could look like (If I am reading what you are asking correctly) could look like this:Scriptname JTAeatscript extends ActiveMagicEffect Idle Property IdleEatingStandingStart AUTO Idle Property chaireatingstart AUTO Event OnEffectStart (actor akTarget, actor akCaster) Game.player.SetDontMove() Game.DisablePlayerControls() ; Which by default disables movement, fighting (attacking input), activating and entering menus if Game.Getplayer().GetSitState() == 0 ; While the player has a weapon drawn, try to have him sheathe it every tenth-second. while !EscapeClause && player.IsWeaponDrawn() && !player.IsDead() Game.player.SetDontMove().playidle(IdleEatingStandingStart) endwhile elseif Game.Getplayer().GetSitState() == 3 Game.Getplayer().playidle(chaireatingstart) endif EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) Game.EnablePlayerControls() ;Sister Function to Disable which by default enables all. EndEvent Edited November 19, 2014 by Arocide Link to comment Share on other sites More sharing options...
lFostelR Posted November 19, 2014 Author Share Posted November 19, 2014 (edited) this fails to compile, any idea why? Compiling "JTAeatscript"...C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\JTAeatscript.psc(7,6): a property cannot be used directly on a type, it must be used on a variableC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\JTAeatscript.psc(7,6): player is not a property on script game or one of its parentsC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\JTAeatscript.psc(7,13): none is not a known user-defined typeC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\JTAeatscript.psc(11,9): variable EscapeClause is undefinedC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\JTAeatscript.psc(11,25): variable player is undefinedC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\JTAeatscript.psc(11,32): none is not a known user-defined typeC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\JTAeatscript.psc(11,52): variable player is undefinedC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\JTAeatscript.psc(11,59): none is not a known user-defined typeC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\JTAeatscript.psc(12,8): a property cannot be used directly on a type, it must be used on a variableC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\JTAeatscript.psc(12,8): player is not a property on script game or one of its parentsC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\JTAeatscript.psc(12,15): none is not a known user-defined typeC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\JTAeatscript.psc(12,29): none is not a known user-defined typeNo output generated for JTAeatscript, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on JTAeatscript Edited November 19, 2014 by foster xbl Link to comment Share on other sites More sharing options...
lFostelR Posted November 19, 2014 Author Share Posted November 19, 2014 edit, I'm sorry I posted wrong info the script I want to add to looks like this Scriptname JTAeatscript extends ActiveMagicEffect Idle Property IdleEatingStandingStart AUTOIdle Property chaireatingstart AUTOEvent OnEffectStart (actor akactor, actor akCaster)if Game.Getplayer().GetSitState() == 0Game.Getplayer().playidle(IdleEatingStandingStart)endifif Game.Getplayer().GetSitState() == 3Game.Getplayer().playidle(chaireatingstart)endif EndEvent Link to comment Share on other sites More sharing options...
Arocide Posted November 19, 2014 Share Posted November 19, 2014 (edited) On 11/19/2014 at 2:59 AM, foster xbl said: this fails to compile, any idea why? I quite simply copy pasted what you posted, there are numerous errors in the script which need to be addressed. On 11/19/2014 at 3:02 AM, foster xbl said: edit, I'm sorry I posted wrong info the script I want to add to looks like this Scriptname JTAeatscript extends ActiveMagicEffect Idle Property IdleEatingStandingStart AUTOIdle Property chaireatingstart AUTOEvent OnEffectStart (actor akactor, actor akCaster)if Game.Getplayer().GetSitState() == 0Game.Getplayer().playidle(IdleEatingStandingStart)endifif Game.Getplayer().GetSitState() == 3Game.Getplayer().playidle(chaireatingstart)endif EndEvent now that makes a lot more sense. It would be pretty simple, just add PlayerControls functions like this:Scriptname JTAeatscript extends ActiveMagicEffect Idle Property IdleEatingStandingStart AUTO Idle Property chaireatingstart AUTO Event OnEffectStart (actor akactor, actor akCaster) Game.DisablePlayerControls() ; Which by default disables movement, fighting (attacking input), activating and entering menus If akactor.GetSitState() == 0 akactor.playidle(IdleEatingStandingStart) ElseIf akactor.GetSitState() == 3 akactor.playidle(chaireatingstart) endif EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) Game.EnablePlayerControls() ;Sister Function to Disable which by default enables all. EndEvent I assume the target of the magic effect is the player Edited November 19, 2014 by Arocide Link to comment Share on other sites More sharing options...
lFostelR Posted November 19, 2014 Author Share Posted November 19, 2014 well this compiles, but doesn't work :(my character still is able to move during the animations the script plays Link to comment Share on other sites More sharing options...
Arocide Posted November 19, 2014 Share Posted November 19, 2014 (edited) On 11/19/2014 at 3:47 AM, foster xbl said: well this compiles, but doesn't work :sad:my character still is able to move during the animations the script plays How exactly is your magic effect applied? is it an Ability or a Spell, is it a constant effect or concentration or fire and forget? Edited November 19, 2014 by Arocide Link to comment Share on other sites More sharing options...
lFostelR Posted November 19, 2014 Author Share Posted November 19, 2014 I attach this script to food/drinks via magiceffectsthe script calls a new animation to playfor example, eat an apple, and animation of eating an apple playsit works, but the animations are long and the characters still move during play,so they look like ghost floating around eating apples http://www.nexusmods.com/skyrim/mods/26271/? Link to comment Share on other sites More sharing options...
lFostelR Posted November 19, 2014 Author Share Posted November 19, 2014 I attach this script to food/drinks via magiceffectsthe script calls a new animation to playfor example, eat an apple, and animation of eating an apple playsit works, but the animations are long and the characters still move during play,so they look like ghost floating around eating apples http://www.nexusmods.com/skyrim/mods/26271/? Link to comment Share on other sites More sharing options...
Arocide Posted November 19, 2014 Share Posted November 19, 2014 (edited) I thought your name looked familiar, I've used your mod before :smile: . This makes it much simpler, they are set as fire and forget so it won't work the way I set it out, my bad. The most simple solution I could think of that requires little rewriting would be something like this:Scriptname JTAeatscript extends ActiveMagicEffect Idle Property IdleEatingStandingStart AUTO Idle Property chaireatingstart AUTO Float Property animationDuration = 1.2 auto ;1.2 default, what you would want to do is change this to the duration (in seconds) of the animation, this will prevent movement for the duration of the animation, but is a property so you can customise the duration if need be per script instance via creation kit. Event OnEffectStart (actor akactor, actor akCaster) Game.DisablePlayerControls() ; Which by default disables movement, fighting (attacking input), activating and entering menus If akactor.GetSitState() == 0 akactor.playidle(IdleEatingStandingStart) ElseIf akactor.GetSitState() == 3 akactor.playidle(chaireatingstart) endif ;if the duration will always be the same then you can just skip creating a property and directly place a float in the wait function. Utility.Wait(animationDuration) ; Pauses Script execution for x seconds Game.EnablePlayerControls() ;Sister Function to Disable which by default enables all. EndEvent Didn't test it but it should do what you want... I hope. You may also want to setDontMove as well, to prevent the player from being pushed around while the animations are playing, otherwise they could still ghost :wink: Edited November 19, 2014 by Arocide Link to comment Share on other sites More sharing options...
Recommended Posts