[ITEMDEF i_revenant_follower_check]
ID=i_memory
NAME=Revenant following
TYPE=T_EQ_SCRIPT

ON=@Timer
REF1=<TOPOBJ.TAG0.TARGET.UID> //target of the revenant
IF (!(<REF1>))
TOPOBJ.HITS=0
ELIF (<REF1.FLAGS>&STATF_DEAD)
TOPOBJ.HITS=0
ELIF (<REF1.FLAGS>&STATF_RIDDEN)
TOPOBJ.HITS=0
ELIF (<TOPOBJ.DISTANCE <REF1.UID>> > 17)
TOPOBJ.GO <REF1.P>
ELSE
TOPOBJ.ATTACK <REF1.UID>
ENDIF
TIMER=1
RETURN 1

[CHARDEF c_revenant]
ID=c_man
NAME=Revenant
DAM=20,30
ARMOR=50
CAN=MT_WALK|MT_USEHANDS|MT_EQUIP
MOVERATE=85
TAG.FOLLOWERCONSUME=3

ON=@Create
NPC=BRAIN_MONSTER
STR={401 500}
DEX={296 319}
INT={101 200}
MAXHITS={241 300}
WRESTLING={90.0 100.0}
SWORDSMANSHIP={90.0 100.0}
TACTICS={90.0 100.0}
MAGICRESISTANCE={100.0 150.0}
ITEMNEWBIE=i_hooded_shroud
COLOR=colors_black
ITEMNEWBIE=i_halberd
COLOR=colors_black

ON=@Attack
IF (<SRC.UID> != <TAG0.TARGET.UID>)
RETURN 1
ENDIF

ON=@SpellEffect
IF (<ARGN1> == 41) || (<ARGN1> == 54) //dispel & mass dispel
HITS=0
RETURN 1
ENDIF

ON=@PetDesert
HITS=0
RETURN 1

ON=@Death
FINDID.i_revenant_follower_check.REMOVE
REF1=<OWNER>
IF (<REF1>)
	IF (<REF1.ISPLAYER>)
	REF1.CURFOLLOWER -= 3
	ELSE
	REF1.TAG0.CURFOLLOWER -= 3
	ENDIF
ENDIF

ON=@Kill
IF (<ARGO.UID> == <TAG0.TARGET.UID>)
HITS=0
ENDIF

ON=@NPCActFollow
REF1=<MEMORYFINDTYPE.MEMORY_IPET.LINK>
IF (<SRC.UID> == <REF1.UID>)
FLAGS |= <DEF.STATF_WAR>
ATTACK <TAG0.TARGET.UID>
RETURN 1
ENDIF

[Spell 114]
DEFNAME=s_Vengeful_Spirit
NAME=Vengeful Spirit
SOUND=0
RUNES=
CAST_TIME=2.0
RESOURCES=1 i_reag_batwing,1 i_reag_grave_dust,1 i_reag_pig_iron
RUNE_ITEM=0
SCROLL_ITEM=0
FLAGS=spellflag_playeronly|spellflag_targ_char|spellflag_summon|spellflag_harm
EFFECT_ID=
EFFECT=
DURATION=0.0
MANAUSE=41
SKILLREQ=SKILL_NECROMANCY 80.0
INTERRUPT=0.0,0.0

ON=@Start
IF (<ISPLAYER>)
SAY @,3,1 Kal Xen Bal Beh
ENDIF
IF (<EVAL <CURFOLLOWER>+3> > <MAXFOLLOWER>)
SYSMESSAGELOC -1,1049645 // You have too many followers to summon that creature.
RETURN 1
ENDIF

ON=@Effect
IF (<SRC.UID> == <UID>)
SRC.SYSMESSAGELOC -1,1061832 // You cannot exact vengeance on yourself.
RETURN 1
ENDIF
IF (!(<SRC.ISPLAYER>))
	IF (<EVAL <SRC.TAG0.CURFOLLOWER>+3> > 5)
	RETURN 1
	ENDIF
SRC.TAG0.CURFOLLOWER += 3
ENDIF
LOCAL.DURATION=<EVAL ((<SRC.SPIRITSPEAK>*80)/1200)+10>
SERV.NEWNPC C_REVENANT
NEW.TAG.TARGET.UID=<UID>
NEW.GO <P>
NEW.UPDATEX
NEW.ATTACK <UID>
SRC.TAME <NEW>
NEW.FLAGS |= <HVAL <DEF.STATF_CONJURED>|<DEF.STATF_WAR>>
NEW.KARMA=-8000
REF1=<NEW.UID> //revenant
REF1.TIMERF <dLOCAL.DURATION>,KILL
SERV.NEWITEM i_revenant_follower_check,1,<REF1.UID>
NEW.TIMER=1
REF1.TIMERF 1,EFFECT 3,0373A,16,30
REF1.UPDATE

[EOF]