Jump to content

Firing a magic effect with a condition


Recommended Posts

I am trying to activate the effect when the actor has their weapon out and deactivate it when they unequip their weapon. My thought was that I could use the condition isweapoout=2 but it doesnt seem to be starting the effect. Can anyone tell me how conditions work for spells and magic effects? The magic effect and spell this script is attached to is set on constant and self. My thought was that once the condition on the spell was met the effect would start.

Scriptname _Civ_AmmoTypeCheck extends activemagiceffect 

Ammo property WeaponAmmo auto
Ammo property thirtyeightCaliber auto
Actor property Shooter auto
Perk property thirtyeightCaliberEquip auto
Weapon property WeaponEquipped Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
		akTarget = Shooter
		WeaponEquipped = Shooter.GetEquippedWeapon()
		WeaponAmmo = WeaponEquipped.GetAmmo()
		debug.notification("effect started")
		if (WeaponAmmo == thirtyeightCaliber)
			Shooter.addperk(thirtyeightCaliberEquip)
			debug.messagebox(".38 ammo equipped")
		endif		
endevent
Event OnEffectFinish(Actor akTarget, Actor akCaster)
        Shooter.removeperk(thirtyeightCaliberEquip)
		debug.messagebox("perk removed")
endEvent

 

Link to comment
Share on other sites

Still not working. I also added an oninit event just to see if I could get a messagebox. Nothing happened. The console just says the spell was added.

Scriptname _Civ_AmmoTypeCheck extends activemagiceffect 

Ammo property WeaponAmmo auto
Ammo property thirtyeightCaliber auto
Actor property Shooter auto
Perk property thirtyeightCaliberEquip auto
Weapon property WeaponEquipped Auto
event OnInit()
	debug.messagebox("Is this thing on?")
endevent
Event OnEffectStart(Actor akTarget, Actor akCaster)
		akTarget = Shooter
		WeaponEquipped = Shooter.GetEquippedWeapon()
		WeaponAmmo = WeaponEquipped.GetAmmo()
		debug.notification("effect started")
		if (WeaponAmmo == thirtyeightCaliber)
			Shooter.addperk(thirtyeightCaliberEquip)
			debug.messagebox(".38 ammo equipped")
		endif		
endevent
Event OnEffectFinish(Actor akTarget, Actor akCaster)
        Shooter.removeperk(thirtyeightCaliberEquip)
		debug.messagebox("perk removed")
endEvent
Link to comment
Share on other sites

I'm not sure. I always run them from spell. And that condition works correctly I'm using it in my mod and what I see here should work. I'm out of ideas what can be a problem.

 

P.S try testing on clean save or better type coc qasmoke in console in main menu

Edited by shavkacagarikia
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...