I want to create a spell that returns the targeted actor, or, if no actor was hit by the spell, return the caster/player.
So far I've made a spell and a magic effect (both are of type "Target Actor"), attached the magic effect to the spell and the following script to the magic effect:
spell property Fireball autoevent OnSpellCast(Form akSpell) Spell spellCast = akSpell as Spell if spellCast && spellCast == Fireball debug.Notification("We just cast a fireball!") else debug.Notification("We cast something, but we don't know what it is") endIf endEventevent OnEffectStart(actor target, actor caster) if target == None debug.Notification("No target") else debug.Notification("Target found") endIf endEvent
The "OnEffectStart" part works fine, if I target an actor I get the message "Target found", however the "OnSpellCast" doesn't seem to be triggered. Does "OnSpellCast" doesn't trigger because a spell of the type "Target Actor" isn't actually cast when there's no target?
Bascially I look for a way to find out if a targeted spell doesn't hit anything, it doesn't have to use "OnSpellCast".