Greetings this is the second trigger related to combat I'm seeking to be looked over (yes it's two but they basically do the same thing). I've done limited testing myself and the appear to be working as intended, however due to the small number of players on the MUD I'm hoping to get some others to look them over and provide pointers on optimizing them or fixing them if there are any issues I don't see/haven't encountered. Thanks Kastil
Trigger 2 (and 2a) Goal - Damage attackers. Would like some pointers on where and what checks I need, to get it to not hit only attackers and not bystanders.
Code:
Trigger Intended Assignment: Mobiles
Trigger Type: Fight, Numeric Arg: 5, Arg list: none
Commands:
*Mob does unresisted damage to all enemies randomly
*Will get a set of errors 'msend' and 'mdamage' : victim (}252) does not exist if immortal in room
*Set the rooms ID to a variable. (not sure this is needed for this)
set room_var %actor.room%
*Change the echo to something appropriate for the mobs special
%echo% %self.name% lashes out, sweeping the whole area with a powerful blow!
*To provide a simple plug and play template damage is based on 2 x the mobs level
eval mob_damage %self.level% * 2
*Target the first char
set target_char %room_var.people%
*Now loop through everyone in the room and hurt them
while %target_char%
*Set the next target before this one perhaps dies.
set tmp_target %target_char.next_in_room%
%send% %target_char% The blow knocks the breath out of you.
%damage% %target_char% %mob_damage%
*Set the next target
set target_char %tmp_target%
*Loop back
done
and/or this one
Code:
Trigger Intended Assignment: Mobiles
Trigger Type: Fight, Numeric Arg: 5, Arg list: none
Commands:
*Mob does unresisted damage to all enemies randomly
*First figure out what room you are in@n
eval room_var %self.room%
*Change the echoes to something appropriate for the mobs special
%echo% %self.name% drops and does an amazing sweep kick!
*Target the first character@n
set target %room_var.people%
*Make a loop so everyone in the room is targeted
while %target%
*Set the next target before this one perhaps dies
set tmp_target %target.next_in_room%
*Don't let the mob kill itself
if (%target.name% != %self.name%)
*To provide a simple plug and play template damage is based on 2 x the mobs level
eval mob_damage %self.level% * 2
%send% %target% The kick hits you and others nearby.
%damage% %target% %mob_damage%
end
*Target to the temp target you created above
set target %tmp_target%
*Loop back to the next target
done
*Set the rooms ID to a variable. (not sure this is needed for this)
set room_var %actor.room%
these lines needed?
Thanks again, Kastil