Welcome to the Builder Academy

Question stun in a skill with case

More
22 Apr 2025 14:42 #10673 by JTP
working on a skill and I can't get this to stun the character, I have also tried to move the POS_STUNNED further down. But it just doesn't stun the victim, any ideas ? :

    case 16:
      dam = 100;
        if (GET_POS(vict) > POS_STUNNED)
        GET_POS(vict) = POS_STUNNED;
        if (!IS_AFFECTED(vict, AFF_PARALYSIS)) {
        new_affect(&af);
        af.spell = SPELL_PARALYSIS;
        af.duration = 100;
        af.location = APPLY_NONE;
        af.modifier = 0;
        SET_BIT_AR(af.bitvector, AFF_PARALYSIS);
        affect_to_char(vict, &af);
        }
      break;

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

More
22 Apr 2025 18:05 #10674 by ironfist
Replied by ironfist on topic stun in a skill with case
One possible scenario off the top of my head is that the position is being updated in battle if health is still normal.  (still with a bit of damage bonus before update_pos).  You could add some log statements to check the position to be sure though.  If that is the case, maybe you could say if affected by paralysis -> don't update and give a message or something similar.

Are you seeing the paralysis affect on them?

in fight.c in damage()
Code:
  /* Set the maximum damage per round and subtract the hit points */   dam = MAX(MIN(dam, 100), 0);   GET_HIT(victim) -= dam;   /* Gain exp for the hit */   if (ch != victim)     gain_exp(ch, GET_LEVEL(victim) * dam);   update_pos(victim);


Code:
void update_pos(struct char_data *victim) {   if ((GET_HIT(victim) > 0) && (GET_POS(victim) > POS_STUNNED))     return;   else if (GET_HIT(victim) > 0)     GET_POS(victim) = POS_STANDING;   else if (GET_HIT(victim) <= -11)     GET_POS(victim) = POS_DEAD;   else if (GET_HIT(victim) <= -6)     GET_POS(victim) = POS_MORTALLYW;   else if (GET_HIT(victim) <= -3)     GET_POS(victim) = POS_INCAP;   else     GET_POS(victim) = POS_STUNNED; }

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

More
22 Apr 2025 18:08 - 22 Apr 2025 18:17 #10675 by JTP
Replied by JTP on topic stun in a skill with case
My code does the damage I want it to do

The mob is also being affected by AFF_PARALYSIS

I also get the right message, but I cut the message out for simplicity


So in the code I’m working on the only thing that isn’t happening is to set POS_STUNNED. So the mob keeps fighting.
Last edit: 22 Apr 2025 18:17 by JTP.

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

More
22 Apr 2025 18:28 #10676 by ironfist
Replied by ironfist on topic stun in a skill with case
Yeah the problem is probably that the combat or stopping combat calls update_pos which gets rid of the stun unless the person is low on health. For example on this skill pummel, normally I'd set stun which gives a damage bonus, but in order to make it leave them stunned, I need to set stun after stopping combat.  (stop_fighting calls update_pos) The other option is to set an if statement to keep them in combat and stunned inside of update_pos.  Several functions call update_pos... including damage function
Code:
  if (percent > prob) {     damage(ch, vict, 0, SKILL_PUMMEL);     if(!IS_NPC(ch))       GET_POS(ch) = POS_SITTING;   } else {     if (damage(ch, vict, MIN((GET_LEVEL(ch) / 5), 15), SKILL_PUMMEL) > 0) {       if (FIGHTING(ch) && IN_ROOM(ch) == IN_ROOM(FIGHTING(ch))) {         if(GET_DEX(vict) < rand_number(1, 75)) { ->          stop_fighting(vict); ->          stop_fighting(ch);           GET_POS(vict) = POS_STUNNED;           WAIT_STATE(vict, PULSE_VIOLENCE);         }       }     }   }


Code:
500H 100V 82V > m Your pummel wastes Helm. 500H 100V 82V > l [ 1204] Pantheon of the Gods  [ NO_MOB INDOORS NO_RECALL NO_PORTAL NO_FLOOR ] [ Inside ][T 8 4]    The main hang out of the Gods, the Immortal Board Room is the place to be. Gods exchange messages here most every day.  The mortal board room is to the east and the meeting room for the gods is to the south.  To the north is the Gods' Inn and to the west is a post office for Gods.  There is a large staircase leading down to the Old Skull Inn in the town of Shadowdale.  In the northeast corner you spot a small staircase leading upwards.    [ Exits: n e s w u (d) ] [3098] A large bulletin board is mounted on a wall here.  It glows with a faint aura. [1203] Helm is lying here, stunned. 500H 100V 82V > You are now able to use kick again. 500H 100V 82V >

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

More
22 Apr 2025 18:30 - 22 Apr 2025 18:32 #10677 by JTP
Replied by JTP on topic stun in a skill with case
I have also tried to add a stop_fighting and also tried having the update_pos

They didn’t help at all


I want the mob stunned and the player to still be able to damage the mob
Last edit: 22 Apr 2025 18:32 by JTP.

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

More
22 Apr 2025 19:10 #10678 by ironfist
Replied by ironfist on topic stun in a skill with case
Looks like there could be other things updating position also that have to be handled if you want them stunned in combat.  

Code:
void update_pos(struct char_data *victim) {   if ((GET_HIT(victim) > 0) && (GET_POS(victim) > POS_STUNNED))     return; +  if(affected_by_spell(victim, SPELL_FAERIE_FIRE)) { +    send_to_room(IN_ROOM(victim), "%s is still stunned because of faerie fire\r\n", GET_NAME(victim)); +    return; +  }   else if (GET_HIT(victim) > 0)     GET_POS(victim) = POS_STANDING;   else if (GET_HIT(victim) <= -11)     GET_POS(victim) = POS_DEAD;   else if (GET_HIT(victim) <= -6)     GET_POS(victim) = POS_MORTALLYW;   else if (GET_HIT(victim) <= -3)     GET_POS(victim) = POS_INCAP;   else     GET_POS(victim) = POS_STUNNED; }

There is a switch statement in damage() that provides the consciousness message, so it works at least up to there.

Code:
500H 95V 82V > um Your pummel wastes Helm. 500H 95V 82V > Helm parries your attack! -> Helm is still stunned because of faerie fire Your pierce LIQUIDATES Helm!! -> Helm is stunned, but will probably regain consciousness again. Your pierce slaughters Helm. ** Helm has a few scratches. ** 500H 95V 82V > Helm's crush misses you. Helm's crush misses you. Helm's crush misses you. You strike a critical blow! Your pierce ANNIHILATES Helm! Your pierce OBLITERATES Helm! Your pierce massacres Helm. ** Helm has a few scratches. **

after that, there is this inside of damage which could be a culprit also because stop_fighting updates position to standing...

  /* stop someone from fighting if they're stunned or worse */
  if (GET_POS(victim) <= POS_STUNNED && FIGHTING(victim) != NULL)
    stop_fighting(victim);

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

Time to create page: 0.272 seconds