Why can't I Mod my summon?

Post » Thu Jun 21, 2012 10:05 am

I'm working on a Necromancy mod and trying to make my script that will Buff my summoned Skeletons in different ways if the player has certain perks. I have everything in my initial script working except for the actual buff. Ive got it setup so that each summon costs a certain ammount in Magicka for Upkeep but will be permanent with no duration and give the magicka back to the player when it dies. And all of that works except for the part about giving the Health buff to the summon As it stands here are my two scripts where everything works except for the health buff, although I do get a debug message saying the summon has been buffed. It just never actually applies the Health Mod.

Scriptname PsiNecromancyQuestScript extends Quest  Int Property PsiUpkeepcharge  autoInt Property PsiHasHastenDead autoInt Property PsiHastenDeadHealthBonus autoQuest Property PsiNecroQuest AutoFloat CheckonceAEvent OnInit()	  	PsiUpkeepcharge = 30	CheckonceA = 0	   RegisterForUpdate(5)	   Debug.Messagebox("Registered")EndEventEvent Onupdate()	If PsiNecroQuest.GetStage() == 150		   If CheckonceA == 0					 PsiHasHastenDead = 1				  PsiHastenDeadHealthBonus = 40					Debug.Messagebox("Player Has Gained the Hasten Dead Bonus")					CheckonceA = 1.0			  Endif		 Endif		 If PsiNecroQuest.GetStage() == 10000			UnregisterForUpdate()  ; when we're done with it, make sure to unregister			   Debug.Messagebox("Got what we needed, so stop polling!")		EndifEndEvent

Scriptname PsiSummonScript extends activemagiceffect  PsiNecromancyQuestScript Property PsiNecroQuest Autofloat Checkonce1Event Oninit()	Checkonce1 = 0	   Actor target  = GetTargetActor()	Debug.Messagebox("Summon script is running")EndEventEvent OnEffectStart(Actor Target, Actor Caster)	Debug.Messagebox("The Effect is starting")	if Checkonce1 == 0		Checkonce1 = 1.0			Debug.Messagebox("Player Charged Magicka Upkeep!")		if PsiNecroQuest.PsiHasHastenDead == 1			Target.ModActorValue("Health", PsiNecroQuest.PsiHastenDeadHealthBonus)				Debug.Messagebox("The Summon Has been buffed!")		Endif	Endif			Game.GetPlayer().ModActorValue("Magicka", - PsiNecroQuest.PsiUpkeepcharge)EndEventEvent OnEffectFinish(Actor Target, Actor Caster)	Checkonce1 = 0	   Debug.Messagebox("Player No longer Charged Magicka Upkeep!")		if PsiNecroQuest.PsiHasHastenDead == 1			Target.ModActorValue("Health", - PsiNecroQuest.PsiHastenDeadHealthBonus)		Endif		Game.GetPlayer().ModActorValue("Magicka", PsiNecroQuest.PsiUpkeepcharge)EndEvent 


Is it possible that I just cannot mod both the player and the target in the same event? or is there a way to declare the target that I have not done. Ive tried several different ways but it either does nothing or gives me a compile error. Ive been working on this for 3 days now with no luck. The only other thing I know to try is maybe put a script on the summon itself which I may do to see if that works But I think it gives me a script that extends objectreference and I don't think you can do ModActorValue in an objectreference script so I need an Actor script... But I'm hoping someone with more experience can just spot my problem here a little more easily.
User avatar
Sunnii Bebiieh
 
Posts: 3454
Joined: Wed Apr 11, 2007 7:57 pm

Post » Wed Jun 20, 2012 8:50 pm

The only thing I can think of is that your summon isn't actually the target of the spell. Tell me more about the spell, how is it used and cast?
User avatar
Shirley BEltran
 
Posts: 3450
Joined: Wed Jul 26, 2006 4:14 pm

Post » Wed Jun 20, 2012 6:54 pm

Well actually it appears that there may be a problem with ModAV for something like a summon. I did as I said and created a seperate script for the summon itself and used SetAV instead of ModAV and it is working now. I dont know why ModAV isnt working but its not.. The working scripts are as follows.

 Scriptname PsiSummonScript extends activemagiceffect PsiNecromancyQuestScript Property PsiNecroQuest Autofloat Checkonce1Event Oninit()    Checkonce1 = 0	   Actor target  = GetTargetActor()    Debug.Messagebox("Summon script is running")EndEventEvent OnEffectStart(Actor Target, Actor Caster)    Debug.Messagebox("The Effect is starting")    if Checkonce1 == 0        Game.GetPlayer().ModActorValue("Magicka", - PsiNecroQuest.PsiUpkeepcharge)        Checkonce1 = 1.0	        Debug.Messagebox("Player Charged Magicka Upkeep!")    Endif       EndEventEvent OnEffectFinish(Actor Target, Actor Caster)    Checkonce1 = 0	   Debug.Messagebox("Player No longer Charged Magicka Upkeep!")    Game.GetPlayer().ModActorValue("Magicka", PsiNecroQuest.PsiUpkeepcharge)EndEvent

 Scriptname PsiSummonMob extends Actor Perk Property PsiHastenDead AutoPsiNecromancyQuestScript Property PsiNecroQuest Autofloat Checkonce1Event OnInit()	    Checkonce1 = 0	    RegisterForUpdate(5)	    Debug.Messagebox("The Actor Script is running")EndEventEvent Onupdate()    if Checkonce1 == 0        if (Game.GetPlayer().HasPerk(PsiHastenDead))              Debug.Messagebox("The player has the HastenDead perk")                self.SetAV("Health", 40 + PsiNecroQuest.PsiHastenDeadHealthBonus)                self.evaluatePackage()                Debug.Messagebox("The Summon Has been buffed by the actorscript!")                Checkonce1 = 1.0			   Endif	    Endif	    UnregisterForUpdate()  ; when we're done with it, make sure to unregister	    Debug.Messagebox("Got what we needed, so stop polling!")EndEvent

I would have prefered to use ModAV because then I could just use the same exact script for all my different summons because the base Health for each might be different. But then again I may end up using different modifiers for the health bonus anyways depending on the mob type. So in the end I got what I wanted, just not how I wanted it.
User avatar
Nikki Hype
 
Posts: 3429
Joined: Mon Jan 01, 2007 12:38 pm

Post » Wed Jun 20, 2012 9:18 pm

Also I dont really know if the
 self.evaluatePackage()
is neccisary or not. But I came across a bethesda script doing something similar to what I did and they used that after SetAV. Either way it doesnt hurt.
User avatar
Roisan Sweeney
 
Posts: 3462
Joined: Sun Aug 13, 2006 8:28 pm


Return to V - Skyrim