This tutorial was created by taz20241 on the original RealmCrafter Standard forums.
By checking the attacker npc name, we can make them cast spells, do animations or play emiters. There maybe other ways to do this, but this is easy and it works. You can either add this to an attack script, or add a thread execute in the if block section. If you use a execute, just add it into the name if block.
Remember you can`t execute your abilitys that a human player would use.
First thing we need to do is setup the npc name that will be checked as the boss.
BossName$ = Name(Player) ;check attackers name.
TinyName$ = "Tiny" ;boss name that you want to start boss script part. set to the name of your boss/npc
Now we will need to add a check, to see if the attacker has the same name as the boss/npc above.
If (BossName = TinyName) ;if boss name is = to npc boss run this or continue with attack
;Now we can add whatever we would like the boss/npc to do.
;you can execute your boss script or add what you need in here.
FireBallChan% = Rnd(1, 5) ;1 in 5 chance npc will run this spell/ability
If (FireBallChan = 1) ;if = to 1 run fireball (Countinue script)
AnimateActor(Actor(), "Spell Cast", 1.2) ;set to animation you want the npc to play.
CreateEmitter(ContextActor(), "Fireballl", 1, 400) ; play emitter
FireballDmg% = Rnd(355, 465) ;set damage to be done.
THP% = Attribute(ContextActor(), "Health") ;get target current hp
TotFireDmg% = THP - FireballDmg ;- target current hp - dam to do
CreateFloatingNumber(ContextActor(), TotFireDmg, 255, 0, 0) ;show floating dmg text
If (FireballDmg > THP) ;if target hp is less then damage to do kill target.
;add whatever else you need when target dies.
SetAttribute(ContextActor(), "Health", TotFireDmg) ;set target hp - damage thats done.
Return ; returning since npc ran there skills, don`t allow them to attack aswell.