Welcome to the Builder Academy

Question Trigger of the Day - Mob Random dg_cast Example

More
24 Apr 2013 17:42 - 26 Apr 2013 00:32 #1998 by Rumble
Code:
Name: 'Mob Random Example', VNum: [ 61], RNum: [ 61] Trigger Intended Assignment: Mobiles Trigger Type: Random , Numeric Arg: 2, Arg list: None Commands: * By Rumble of The Builder Academy tbamud.com 9091 * With random triggers ACTOR is NOT defined. So set it. set actor %random.char% wait 1 sec say Hey! You don't belong here! emote mumbles, 'Now what was that spell...' wait 1 sec * Senile old guard casts random spells on intruders. * Don't cast if incapacitated if %self.hitp% > 0 switch %random.17% case 1 dg_cast 'cure light' %actor% break case 2 dg_cast 'magic missile' %actor% break case 3 dg_cast 'detect invisibility' break case 4 dg_cast 'detect magic' break case 5 dg_cast 'bless' %actor% break case 6 dg_cast 'heal' %actor% break case 7 dg_cast 'infravision' break case 8 dg_cast 'invisibility' %actor% break case 9 dg_cast 'armor' %actor% break case 10 dg_cast 'strength' %actor% break case 11 dg_cast 'sleep' %actor% break case 12 dg_cast 'blindness' %actor% break case 13 dg_cast 'detect poison' %actor% break case 14 dg_cast 'curse' %actor% break case 15 dg_cast 'poison' %actor% break case 16 if %actor.align% > 0 dg_cast 'dispel good' %actor% else dg_cast 'dispel evil' %actor% end break default * Senile magi "almost" kills himself. say That wasn't right... %echo% A failed spell backfires on the mage! %damage% %self% %self.hitp% break done end
If this was helpful please vote or leave a review for TBA.

Rumble
The Builder Academy
tbamud.com 9091
rumble@tbamud.com
Last edit: 26 Apr 2013 00:32 by Rumble.

Please Log in or Create an account to join the conversation.

More
25 Apr 2013 23:26 #2004 by Fizban
It might be better to just encapsulate the script inside:
Code:
if %self.hitp% > 0 end

so that way he still won't try to cast while incapacitated but will as soon as he has positive HP again.

Please Log in or Create an account to join the conversation.

More
26 Apr 2013 00:32 #2005 by Rumble
Good point, updated.

Rumble
The Builder Academy
tbamud.com 9091
rumble@tbamud.com

Please Log in or Create an account to join the conversation.

Time to create page: 0.203 seconds