Jump to content

Script issue with requireing a npc to be a follower


LurkerGG

Recommended Posts

So I am working with my evolving follower script and attempting to improve it.

 

So far the transformation between races happens for the Follower. I am trying to add a requirement that the NPC has to be a certain rank in the CurrentFollowerFaction for the race changes to take place.

 

The script is intended to do the follower

 

Check npcs current race, check the npcs rank in the Currentfollowerfaction and check the npcs level.

 

Based on that information the npcs race is changed to the appropriate race.

 

So far the race changes work but the npc is still being changed even though they are not 0 or higher rank with the CurrentFollowerFaction.

 

I will be honest. I pretty much have no idea what I am doing and the script so far is just a hodge podge of other scripts I have pieced together.

 

Thank you for any help you may be able to provide :)

 

 Scriptname Npc_evolutionscript_notext extends ActiveMagicEffect  
{NPC evolving through polymorph effect}

Spell Property PolymorphSpell auto
FormList Property WerewolfDispelList auto
Race Property PolymorphRace1 auto
Race Property PolymorphRace2 auto
Race Property PolymorphRace3 auto
Faction Property CurrentFollowerFaction auto
Weapon Property MonsterWeapon auto
Explosion Property EndExplosion auto
ImageSpaceModifier Property ChangeFX auto
Idle Property IdleWerewolfTransformation auto

; EVENTS

Event OnEffectStart(Actor Target, Actor Caster)
GetTargetActor().PlayIdle(IdleWerewolfTransformation)
PrepShift()
Utility.Wait(1.5)
GetTargetActor().placeAtMe(EndExplosion)

IF (Target.GetActorBase().GetRace() != PolymorphRace1) || (Target.GetActorBase().GetRace() != PolymorphRace2) || (Target.GetActorBase().GetRace() != PolymorphRace3) && (Target.GetFactionRank(CurrentFollowerFaction) >= 1)

IF(Target.Getlevel() <= 29)
GetTargetActor().SetRace(PolymorphRace1)
ELSEIF (Target.Getlevel() <= 39)
GetTargetActor().SetRace(PolymorphRace2)
ELSE
GetTargetActor().SetRace(PolymorphRace3)
AnimationEnd()
ENDIF

ENDIF

EndEvent

Event OnEffectFinish(Actor Target, Actor Caster)
Target.placeAtMe(EndExplosion)
ChangeFx.Apply()
endEvent

Function AnimationEnd()

EndFunction
Function PrepShift()
; Debug.Trace("WEREWOLF: Prepping shift...")
Actor player = GetCasterActor()

int count = 0
while (count < WerewolfDispelList.GetSize())
Spell gone = WerewolfDispelList.GetAt(count) as Spell
if (gone != None)
GetTargetActor().DispelSpell(gone)
endif
count += 1
endwhile
EndFunction
[/Code]

Link to comment
Share on other sites

I don't know if this will work (it compiles). I've cleaned the script up a bit.

 

 

Scriptname Npc_evolutionscript_notext extends ActiveMagicEffect  
{NPC evolving through polymorph effect}

FormList Property WerewolfDispelList auto

Race Property PolymorphRace1 auto
Race Property PolymorphRace2 auto
Race Property PolymorphRace3 auto

Faction Property CurrentFollowerFaction auto

Explosion Property EndExplosion auto

ImageSpaceModifier Property ChangeFX auto

Idle Property IdleWerewolfTransformation auto

Event OnEffectStart(Actor Target, Actor Caster)
Target.PlayIdle(IdleWerewolfTransformation)
PrepShift(Target)
Utility.Wait(1.5)
Target.PlaceAtMe(EndExplosion)
Race myRace = Target.GetActorBase().GetRace()
       
IF (myRace != PolymorphRace1) && (myRace != PolymorphRace2) && (myRace != PolymorphRace3) && (Target.GetFactionRank(CurrentFollowerFaction) >= 1) 
	IF(Target.Getlevel() <= 29)
		Target.SetRace(PolymorphRace1)
	ELSEIF (Target.Getlevel() <= 39)
		Target.SetRace(PolymorphRace2)
	ELSE
		Target.SetRace(PolymorphRace3)
	ENDIF
ENDIF
EndEvent

Event OnEffectFinish(Actor Target, Actor Caster)
Target.PlaceAtMe(EndExplosion)
ChangeFX.Apply()
endEvent

Function PrepShift(Actor akTarget)
; Debug.Trace("WEREWOLF: Prepping shift...")
int count = 0
while (count < WerewolfDispelList.GetSize())
	Spell gone = WerewolfDispelList.GetAt(count) as Spell
	if (gone != None)
		akTarget.DispelSpell(gone)
	endif
	count += 1
endwhile
EndFunction

 

Edited by steve40
Link to comment
Share on other sites

  • Recently Browsing   0 members

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