On activateitem question
#1
Posté 27 mai 2016 - 04:17
#2
Posté 27 mai 2016 - 04:53
hmm, interesting question.....
There is no on hit or damage event on a PC......unless there is a hook using NWNX????
Otherwise it might be doable but by a very circuitous route through scripting...I have something developing in my mind, but it would be a logic bender....ouch, head hurts
![]()
Anyone else?
#3
Posté 27 mai 2016 - 05:09
I don't think there is any native way to get the action queue items - is there?
So what you initially asked for -
When you use an item, can you cancel using the item when hit.
Once the item animation has played, that's when the script plays - so its too late at this point.
The only chance to stop the item being used before that, is when it is in the action queue, and all you can do is
ClearAllIActions(); or whatever it is called - which will empty the action queue.
You could put that in a creatures Claw / Sword etc impact script - so it clears the actions of the player it strikes - but then that could disrupt normal combat actions too.
You can make a pseudo onHit event via using the default.nss script.
By monitoring your current hp each hb, you can determine if you have suffered any damage.
You can then modify your idea so the onActivate item plays a casting animation for 2 seconds.
During those two seconds - if your health changes - then you know you suffered a hit.
Then you set a local variable 'OnHit' to 1
In your onActivate script - you wait for those 2 seconds, then check the value of the variable.
If it is equal to 1 = play spell fizzle animation.
If it is equal to 0 = complete the casting, and do the desired effect
Without nwnx - there is no nice clean way to do it.
#4
Posté 28 mai 2016 - 03:15
#5
Posté 28 mai 2016 - 04:00
I believe there is a way to do this without the use of nwnx.....have to verify it though. Here's the skinny....
Armor and shield respond to being hit if I remember right, have an event tied to the strike. You might be able to script a method to catch all strikes to the equipped armor slot and use it to set a variable on the player equal to the instant of the strike time in seconds plus a modifier of a few seconds and have your on activate event script check the stored time value to see if they are allowed to use their item........or something like that?
![]()





Retour en haut







