Needs some help with my logic in this script.

Post » Thu Feb 21, 2013 12:52 am

First off, this effect is almost completely run off of my Quest script, its to keep it small and organized.

I thought I would test this on more dead targets as a final test before wrapping this up and putting my global lines in. Then I ran into a issue with the logic I think:

It's supposed to only work on dead targets that are non beast races. That part works fine, but the issue comes when its more than one of the same race. It only works on the first target of a given race. It returns none on subsequent targets.
Spoiler
Scriptname SoulburnEffectScript extends Activemagiceffectimport debugimport utilityQuest property TestingQuest AutoActor property playerRef AutoRace property BretonRace AutoRace property ImperialRace AutoRace property DarkElfRace AutoRace property HighElfRace AutoRace property NordRace AutoActor kTargetActorEvent OnEffectStart(Actor akTarget, Actor akCaster)	kTargetActor = akTarget	ActorSoulburnQuestScript ActorSoulburnS = TestingQuest as ActorSoulburnQuestScript	Race TargetRace = kTargetActor.GetActorBase().GetRace()	bool TargetIsDead = kTargetActor.isDead()		if TargetIsDead == FALSE			debug.notification("Cannot cast Soulburn on live targets.")		return		endif			if (TargetRace == NordRace) && ActorSoulburnS.IsSoulburned(kTargetActor)					ActorSoulburnS.Soulburn(kTargetActor)							elseif (TargetRace == BretonRace) && ActorSoulburnS.IsSoulburned(kTargetActor)					ActorSoulburnS.Soulburn(kTargetActor)									elseif (TargetRace == ImperialRace) && ActorSoulburnS.IsSoulburned(kTargetActor)					ActorSoulburnS.Soulburn(kTargetActor)									elseif (TargetRace == DarkElfRace) && ActorSoulburnS.IsSoulburned(kTargetActor)					ActorSoulburnS.Soulburn(kTargetActor)									elseif (TargetRace == HighElfRace) && ActorSoulburnS.IsSoulburned(kTargetActor)					ActorSoulburnS.Soulburn(kTargetActor)								else					debug.notification("Failed Check.")			endif			EndEvent

IsSoulburned() is a function that checks if the target is wearing something specific. If false, the spell fails.

here's the log error ; Line 29 is the second if statement in the script above. 61 in the ASBQuestScript is the function.

error: Cannot call IsEquipped() on a None object, aborting function callstack:	[TestingQuest (19015030)].actorsoulburnquestscript.IsSoulburned() - "ActorSoulburnQuestScript.psc" Line 61	[None].SoulburnEffectScript.OnEffectStart() - "SoulburnEffectScript.psc" Line 29[02/20/2013 - 12:58:56PM] warning: Assigning None to a non-object variable named "::temp6"stack:	[TestingQuest (19015030)].actorsoulburnquestscript.IsSoulburned() - "ActorSoulburnQuestScript.psc" Line 61	[None].SoulburnEffectScript.OnEffectStart() - "SoulburnEffectScript.psc" Line 29

Any help would be appreciated.
User avatar
Sammi Jones
 
Posts: 3407
Joined: Thu Nov 23, 2006 7:59 am

Return to V - Skyrim