home » builders » builder's lessons » fight prog
Fight programs
Fight programs activate a certain percentage of the time while the mobile is fighting. It should be noted than when there is no fight program on the mobile, it will fight according to its class. For instance if it has been set to CLASS_MAGES then it will cast spells from the mages guild file in battle. A fight program overwrites these default actions.
>fight_prog 30~ mpechoat $n You flinch at the stab of the Velvet Hands Leader. mpechoaround $n $N flinches at the stab of the Velvet Hands Leader. mpmadd $n currhp -10 ~ |
This program is on the Velvet Hands Leader in Faerdale. It has a 30% chance of triggering each round of battle. It echos to the PC that the stab hurts them and then it deducts 10 hps from their current hps. This could kill them if their hps are low enough. This sort of program allows you to put in attacks that are not standard.
>fight_prog 20~ yell Guards! Guards! Elves in the palace! yell Vermin! Worse than bloody mice! if rand(20) if quest(0, 2, $i) < 3 mpmload 15125 mpforce guard mpkill $r mpmadd $i quest 0 2 1 endif endif ~ |
Fight progs can be used to allow the mobile to call upon aid. This program is on Abrum in Zazesspur when he gets attacked in his castle. He calls upon his guards for aid. In this particular prog he does not load a guard every time he yells for the guards. The fight prog has a 20% chance of occuring each round, and within that there is a 20% chance of a guard being loaded. In order to stop too many guards being loaded, we have set quest bits on Abrum himself not the PC. $i refers to the mobile that has the program on it. You can set quest bits on mobiles just the same as PC's, and often it is a good economical way to use quest bits in an area. This one makes sure that Abrum cannot load more than 3 guards.
>fight_prog 70~ mpecho Blackstaff mutters an incarnation and heals his wounds. mpmadd self currhp 40 if rand(20) cast fireball $r else if rand(20) cast earthquake say I am the greatest of mages. All shall quake at the sight of me! else if rand(20) cast 'acid blast' $r say Feel the strength of my spell $r mpechoat $r Ouch! mpechoaround $r $r winces in pain. else if rand(20) cast 'lightning bolt' $r mpecho Blackstaff calls upon the elements to aid him in battle. else cast 'flame strike' $r mpecho A candle flickers as Blackstaff draws upon the power of fire. mpechoat $r Ouch! That hurt! mpechoaround $r $r whimpers as the flamestrike burns them. endif endif endif endif ~ |
This program is one that allows Blackstaff to cast random spells in battle. First of all he "heals" himself. I could have him cast heal, BUT he would probably still be chanting when he went to cast his next spell. This means you cant give him two spells in the one round. He needs time to chant the spells.
The use of mpaffect or mpcast would work here, as there is no lag associated with these like there is for cast.