ArcticZero Posted June 27, 2012 Share Posted June 27, 2012 Basically, I'm trying to get a script to detect when the player is attacking, and apply certain buffs to the player's stats. I don't see anything under the CK scripting reference that seems to address this condition. Second question, is it possible to "trick" the game into thinking that the player is performing a certain action (e.g. blocking, jumping) even if they aren't? Thanks in advance to anyone who can help! :) Link to comment Share on other sites More sharing options...
tox2ik Posted June 27, 2012 Share Posted June 27, 2012 I think you may be looking for: http://www.creationkit.com/GetCombatState_-_Actor I'm not sure about the other question. Link to comment Share on other sites More sharing options...
Sjogga Posted June 27, 2012 Share Posted June 27, 2012 As far as I know you can't detect when the player is attacking. However, using SKSE you can detect when the attack button is pressed. Link to comment Share on other sites More sharing options...
pauderek Posted June 27, 2012 Share Posted June 27, 2012 if Player.GetAnimationVariableInt("iRightHandType") for attacks with right handif Player.GetAnimationVariableInt("iLeftHandType") for attacks with left hand If you want them to only trigger if the player is using weapons you'll have to add extra conditionals like the GetEquippedItemType conditional Link to comment Share on other sites More sharing options...
tox2ik Posted June 28, 2012 Share Posted June 28, 2012 As far as I know you can't detect when the player is attacking. However, using SKSE you can detect when the attack button is pressed. Its possible. The engine is not -that- crippled :) Link to comment Share on other sites More sharing options...
steve40 Posted June 28, 2012 Share Posted June 28, 2012 (edited) Script: Scriptname Monitor_Combat_State extends Actor { Trigers when the player enters combat. } ;================================= Event OnCombatStateChanged(Actor akTarget, int aeCombatState) aeCombatState = GetCombatState() ; I find "aeCombatState" to be unreliable. This is a reliable bugfix. akTarget = GetCombatTarget() ; I find "aktarget" to be unreliable. This is a reliable bugfix. If aeCombatState == 2 ; I'm in searching mode. ; Debug.Notification("[Monitor_Combat_State] CombatState = 2") ; do my cool stuff Return ElseIf aeCombatState == 1 ; I started combat ; Debug.Notification("[Monitor_Combat_State] CombatState = 1") ; do my cool stuff Return ElseIf aeCombatState == 0 ; I have ceased combat ; Debug.Notification("[Monitor_Combat_State] CombatState = 0. No longer in combat") ; combat has ended, so here we need to remove any special stuff that we did earlier. Return Else ; Debug.notification("[Monitor_Combat_State] Something unexpected has gone wrong.") EndIf EndEvent I designed the script written above to be put on an NPC. If you put this script on a player quest alias, you will probably need to make the script extend ReferenceAlias instead of Actor. Edit: there are also Condition Functions such as "GetCombatState", "IsAttacking" and "GetAttackState" that you could use to make a Magic Effect activate/deactivate when in combat or not. Edited June 28, 2012 by steve40 Link to comment Share on other sites More sharing options...
ArcticZero Posted June 28, 2012 Author Share Posted June 28, 2012 Thanks for the replies! @steve40 - Looks like a great script to try, however what I'm trying to do is determine if the player is actually in the process of swinging his weapon (attacking), and not simply if he is in combat mode. I'm sorry for all the questions, but I'm new at Skyrim scripting and absolutely none of my web development/programming knowledge is helping me at all. Not to mention all the documentation on the wiki isn't very beginner-friendly.. So I'm a total noob at this point. :P I'm trying to attach this script to the player so that it activates each time the player attacks with his weapon. It doesn't necessarily have to be hitting anything though. Right now I'm doing it by creating a quest and using OnUpdate() and RegisterForUpdate(0.1). I'm sure there are better ways of doing this so the script only runs when it detects the player attacking. Perhaps there's a better way of attaching the script to the player that I'm not aware of. :) Again, thanks for the replies! Much appreciated. Link to comment Share on other sites More sharing options...
ArcticZero Posted June 29, 2012 Author Share Posted June 29, 2012 Anyone? :) Link to comment Share on other sites More sharing options...
steve40 Posted June 29, 2012 Share Posted June 29, 2012 (edited) Read the last line of my last post (about condition functions) carefully and follow the links ;) . Edited June 29, 2012 by steve40 Link to comment Share on other sites More sharing options...
gulogulo Posted June 30, 2012 Share Posted June 30, 2012 Try this: Event OnEffectStart(Actor akTarget, Actor akCaster) RegisterForAnimationEvent(akCaster, "BashStart") RegisterForAnimationEvent(akCaster, "BowRelease") RegisterForAnimationEvent(akCaster, "WeaponLeftSwing") RegisterForAnimationEvent(akCaster, "WeaponSwing") Debug.Trace("Registering for animation event!") EndEvent Link to comment Share on other sites More sharing options...
Recommended Posts