Difference between revisions of "Distinguishing Between Physical and Magickal Hits"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Diablerie
 
Tag: Manual revert
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
I'd like to script behaviour that occurs when an actor is hit by a weapon, but not by a spell.
{{Unfinished}}


I have noticed that "Begin OnHit" triggers if an actor is hit by a melee weapon, projectile weapon, or a spell. Is there any way of determining what the actor was hit by? -- [[User:Diablerie|Diablerie]] 12:28, 15 April 2006 (EDT)
To determine whether an attack upon a trigger or NPC is either physical or magical, the following script should be used:


[[Category:Questions]]
<pre>
scriptname WeaponHitScript
 
begin OnMagicEffectHit
    return
end
 
begin OnHit Player
    <do stuff...>
end
</pre>
 
The [[Return]] command terminates the entire script, and not just the block that it's called from. This can be used to have one trigger override another if they are triggered at the same time.
 
[[Category:Useful Code]]
[[Category:Solutions]]

Latest revision as of 15:40, 21 December 2023


To determine whether an attack upon a trigger or NPC is either physical or magical, the following script should be used:

scriptname WeaponHitScript

begin OnMagicEffectHit
    return
end

begin OnHit Player
    <do stuff...>
end

The Return command terminates the entire script, and not just the block that it's called from. This can be used to have one trigger override another if they are triggered at the same time.