Editing on this forum with a phone is also a pain as it's hard to expand the field without a lot of fiddling.
Hmm.. I think that should be fixable. I'll look into it.
About the original question - this is a case where there is no relevant triggers. As the suggestions show, a command trigger for this quickly becomes unwieldy. If you add all of your damaging skills here, what do you do with casters? And when you add a spell, it's another place to make sure you add it.
So, no trigger types make sense here. Let's make a new one. I'll just show you the general idea:
- Add new mob trigger type in dg_, and add one to the max in dg_olc.h.
- Add the text for it in constants.h
- Add a trigger handler in dg_triggers.c/h
- Now, add a trigger check in damage() in fight.c, just after the peaceful room check
Make it respect the return value, -1 means disallow damage (as if room was peaceful), 0 means miss, >0 means do this damage. Default is just to do the same damage.
I've created a branch in github showing how it works:
github.com/tbamud/tbamud/compare/damager...er-addition?expand=1
Also, a trigger to show it off - this one stops the fight from starting:
Code:
1) Name : Damage trigger example
2) Intended for : Mobiles
3) Trigger types: Damage
4) Numeric Arg : 100
5) Arguments :
6) Commands:
%echo% Damage trigger triggered
%echo% actor: %actor.name%
%echo% victim: %victim.name%
%echo% dam: %damage%
%echo% attacktype: %attacktype%
return -1