Magic Effect of an arrow ( Script not working )

Post » Wed Jun 20, 2012 12:27 am

Ok here is the enchantment magic effects script I have working off the explosion of an arrow. Any one want to point to me why it is not working ?

Scriptname HitByAnArrow extends ObjectReference
actor victim

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \
bool abBashAttack, bool abHitBlocked)

Victim = (akAggressor as actor)

debug.trace("The Victim just got hit")
victim.ModAV("Health", -500) ; Test to see if character dies :banana:


EndEvent



Thank you for any help :biggrin:
User avatar
RUby DIaz
 
Posts: 3383
Joined: Wed Nov 29, 2006 8:18 am

Post » Wed Jun 20, 2012 6:34 am

If its part of the explosions<-Enchantment<-Magic Effect then it should extend ActiveMagicEffect instead of ObjectReference.

And OnHit does not work in magic effects.

This is a script I have on one of my explosions that will 'disintigrate' the left over bodies in its area of effect. It also removes all their items to a chest, and will kill them if they are not dead yet. But it works from an explosion like you said you are doing.

Scriptname LevelersArenaDeathScript extends activemagiceffectObjectReference Property LevelersArenaChestREF  AutoEvent OnEffectStart(Actor akTarget, Actor akCaster)if akTarget.IsDead()  akTarget.RemoveAllItems(akTransferTo = LevelersArenaChestREF)  akTarget.Delete()else  If akTarget != Game.GetPlayer()   akTarget.Kill()  endifendifendEvent

I have plans to make a 'death' arrow, that will do about the same thing.
User avatar
SamanthaLove
 
Posts: 3565
Joined: Mon Dec 11, 2006 3:54 am

Post » Wed Jun 20, 2012 1:02 pm

Actually OnHit does work in magic effect scripts, as well as a couple of other events like OnSpellCast, OnTranslationComplete, OnCombatStateChanged, etc. Not sure if you can use all the events that actor scripts can, but quite a few for sure.
User avatar
Jerry Cox
 
Posts: 3409
Joined: Wed Oct 10, 2007 1:21 pm

Post » Wed Jun 20, 2012 11:16 am

Well you said it was not working so I assumed.

In case you missed my point by concentrating on the other point, did you change it to extend activeMagicEffect?
User avatar
Claire Jackson
 
Posts: 3422
Joined: Thu Jul 20, 2006 11:38 pm

Post » Wed Jun 20, 2012 2:50 am

How does the script not work? not compiling, nothing happening? Is teh debug trace not showing?
I remember reading somewhere that giving arrows some form of enchantment was not possible because projectiles aren't tracked as objects?

Only way I can see this *maybe* working is if having an arrow equipped provides a constant effect which procs this extra damage when you hit someone with a projectile attack?

But I do not know how the game reacts to arrows being equipped in comparison to normal armour/weapons?
User avatar
Melung Chan
 
Posts: 3340
Joined: Sun Jun 24, 2007 4:15 am

Post » Wed Jun 20, 2012 8:28 am

Yes you can.

>Ammo - Arrow has a projectile attached.
>Projectile - Projectile has an explosion attached.
>Explosion - Explosion has an enchantment attached.
>Enchantment - Enchantment has a magic effect attached.
>Magic Effect - Magic effect has the script attached to it. This will be applied to all objects within the explosion's range when it goes off.

I learned all this when Fallout 3 came out with these features.
User avatar
Adrian Powers
 
Posts: 3368
Joined: Fri Oct 26, 2007 4:44 pm

Post » Wed Jun 20, 2012 1:03 pm

I did try this but could not get it to work?


ScriptName ZZSnowwhite extends ActiveMagicEffect
;======================================================================================;
; Knockout /
;=============/
Actor victim
bool Property knockedout Auto


bool function knockout()
debug.trace("The Victim just got knocked")

victim.SetUnconscious(true)
victim.SetGhost(true)
victim.SetDestroyed(True)

endFunction

bool function wakeup()
debug.trace("The Victim just woke up")

victim.SetUnconscious(false)
victim.SetGhost(false)
victim.SetDestroyed(false)
endFunction


Event OnEffectStart(Actor Target, Actor Caster)
Debug.Trace("Start of Knockout")
Victim = Target
if knockedout == False
knockout()
knockedout = True
endif


EndEvent



Event OnEffectFinish(Actor Target, Actor Caster)
Debug.Trace("End of Knockout")
Victim = Target
if knockedout == true
wakeup()
knockedout = false
endif

EndEvent
User avatar
REVLUTIN
 
Posts: 3498
Joined: Tue Dec 26, 2006 8:44 pm

Post » Wed Jun 20, 2012 2:02 pm

Try This:

ScriptName ZZSnowwhite extends ActiveMagicEffect;=============/; Knockout	/;=============/bool function knockout(Actor Victim)	debug.trace("The Victim just got knocked")	victim.SetUnconscious(true)	victim.SetGhost(true)	victim.SetDestroyed(True)endFunctionbool function wakeup(Actor Victim)	debug.trace("The Victim just woke up")	victim.SetUnconscious(false)	victim.SetGhost(false)	victim.SetDestroyed(false)endFunctionEvent OnEffectStart(Actor Target, Actor Caster)	Debug.Trace("Start of Knockout")	if !Target.IsUnconscious()		knockout(Target)	endifEndEventEvent OnEffectFinish(Actor Target, Actor Caster)	Debug.Trace("End of Knockout")	if Target.IsUnconscious()		wakeup(Target)	endifEndEvent
User avatar
Isabell Hoffmann
 
Posts: 3463
Joined: Wed Apr 18, 2007 11:34 pm


Return to V - Skyrim