Erenna Posted December 18, 2012 Share Posted December 18, 2012 Ok, so I'm trying to start out making a combat overhaul for oblivion, simply because I feel that Unnecessary Violence isn't complete enough, and I don't like Deadly Reflex's gore. However, I've run into a bit of a snag. I'm trying to create code that will let me press the J key to trigger an animation, to see how it looks in-game, but it's not working. Here's my code. scn ParryMagic begin ScriptEffectStart message "ParryMagic script enabled." short mindex ref PL ref playervar set PL to NewHtHparryL set playervar to playerref short played set mindex to getmodindex Cyrodiilic_Combat setdebugmode 1 mindex end begin GameMode if OnKeyDown 36 if played != 1 message "Parry Animation Initialized" playervar.playidle PL 1 set played to 1 endif set played to 0 endif end This takes on the form of a passive ability, added at the beginning of an invisible starting quest. The ability adds properly, even the onkeydown part works properly. The, 'Animation initialized' message shows up but for some strange, strange reason the animation itself doesn't player. Any thoughts? Thanks. Link to comment Share on other sites More sharing options...
Hickory Posted December 18, 2012 Share Posted December 18, 2012 Variables need to be declared outside of functions, right before the first 'Begin' block. Link to comment Share on other sites More sharing options...
DKZZ2 Posted December 18, 2012 Share Posted December 18, 2012 (edited) if magiceffect use ==begin scripteffectupdate== And this command(playidle) works only for the view - the third person. To animate the view from the first person need to give Idle objects.(And of course have the first person animation) Edited December 18, 2012 by DKZZ2 Link to comment Share on other sites More sharing options...
Erenna Posted December 18, 2012 Author Share Posted December 18, 2012 (edited) Nah, the 'If magiceffect use' thing isn't the problem. I'm seeing the, 'ParryMagic Script Enabled' message so the variables are being set. Also, changed the variable definitions to right after the scn portion, still not working. Here's my new code. Also? Yes, I am trying to animate this in third person... Hold on. Do I need a first person animation and an animation object to go with it, to get it to play even in the third person? scn ParryMagic short played short mindex ref PL ref playervar begin ScriptEffectStart Message "ParryMagic script enabled." set PL to NewHtHparryL set mindex to GetModIndex Cyrodiilic_Combat set playervar to PlayerRef SetDebugMode 1 mindex end begin GameMode if OnKeyDown 36 if played != 1 Message "Parry Animation Initialized" playervar.PlayIdle PL 1 set played to 1 endif set played to 0 endif end Edited December 18, 2012 by Erenna Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted December 18, 2012 Share Posted December 18, 2012 I discourage use of ScriptEffectUpdate, as you never know when it will update or if at all. GameMode is much more reliable for this purpose.But have you tried using "player" instead of "PlayerRef" already? I've never seen "PlayerRef.PlayIdle" called that way, as far as I remember. Link to comment Share on other sites More sharing options...
DKZZ2 Posted December 18, 2012 Share Posted December 18, 2012 (edited) 1/Do not reinvent the wheel. The structure of the script magical effect: scn ParryMagic float ttt short played short mindex ref PL ref playervar begin scripteffectstart Message "ParryMagic script enabled." set PL to NewHtHparryL set mindex to GetModIndex Cyrodiilic_Combat set playervar to PlayerRef SetDebugMode 1 mindexset ttt to 0end begin scripteffectupdate if (IsKeyPressed2 36)&&(ttt<=0);!!!!!!!!!!!!!!!!!!!!!!!! if played != 1 Message "Parry Animation Initialized" set playervar to Player ;(refresh refs) set PL to NewHtHparryL playervar.PlayIdle PL 1 set played to 1set ttt to 3 endif set played to 0 endif if ttt>0let ttt:=ttt-getsecondspassedendifend 2/ No Edited December 18, 2012 by DKZZ2 Link to comment Share on other sites More sharing options...
Erenna Posted December 18, 2012 Author Share Posted December 18, 2012 (edited) Fixed it. Apparently, I forgot to put, "Specialidle_" before the name in nifskope. Now, problem 2: When the animation finishes, the character's mesh spazzes out, momentarily moving off to the side while some lower parts stretch, and coming back standing at an odd angle. Any thoughts? EDIT: Finally fixed. The spazzing animation was due to a lack of a return to the neutral position, and the crash was caused by empty frames. Thanks for all your help! Edited December 19, 2012 by Erenna Link to comment Share on other sites More sharing options...
Recommended Posts