Combat Damage Trigger

  • WhiskyTest
  • WhiskyTest's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
1 year 5 months ago #7081 by WhiskyTest
Combat Damage Trigger was created by WhiskyTest
This snippet adds another trigger type, "combatdamage". Intended to trigger on a successful hit during combat. You can use it to simulate special combat effects like fire/ice/poison damage. You could stun or blind characters.. teleport them (hit so hard they fly through to the next room).. Heal someone, taunt characters, disarm them, oh so many fun things!

Here it is, very simple:

In constants.c add this to the end of const char *trig_typesp[]

In dg_scripts.h below the last MTRIG definition add:
#define MTRIG_COMBATDAMAGE     (1 << 18)    /* triggers on combat damage */
then below void hitprcnt_mtrigger(char_data *ch); add
void combatdamage_mtrigger(char_data *ch);

In dg_triggers.c just before void hitprcnt_mtrigger(char_data *ch) add:
void combatdamage_mtrigger(char_data *ch)
  struct char_data *actor;
  trig_data *t;
  char buf[MAX_INPUT_LENGTH];


  for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
        (rand_number(1, 100) <= GET_TRIG_NARG(t))){
      actor = FIGHTING(ch);
      if (actor)
        ADD_UID_VAR(buf, t, actor, "actor", 0);
        add_var(&GET_TRIG_VARS(t), "actor", "nobody", 0);

      script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);

In fight.c , just above where hitprcnt_mtrigger(tch); is called, add:

To use, write up your script as normal and set the trigger type to be CombatDamage. The num_arg is the percentage it will trigger per hit.
Example script:
Name: 'Spider Venom - 1d3',  VNum: [ 1000], RNum: [    0]
Trigger Intended Assignment: Mobiles
Trigger Type: CombatDamage , Numeric Arg: 100, Arg list: None
%echoaround% %actor% winces as spider venom burns into %actor.hisher% body!
%send% %actor% You wince as spider venom burns through your veins!
%damage% %actor% %random.3%

This script will trigger whenever the mob successfully hits another character - in this case it adds an additional 1d3 damage to simulate a venom effect.

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

Time to create page: 1.062 seconds