Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Immunity message for XP

I am looking for a script that changes the "miss" text in battle when casting states upon those who are immune to them. Instead of saying "miss" every time, it displays a message like "immune," which is very useful since the player won't have to waste their time trying to figure out whether or not a certain status spell will work. I believe a script like this used to be up on gamebaker, but that site is no longer available and I have looked everywhere else for this script with no luck. If anybody still has this or knows of somewhere else that it could be found I would very much appreciate it.

EDIT: Just to be a little more specific, I need this to be compatible with the RTAB system. It would be preferable if it could be set up in a way that the "immune" message would be displayed even in the case of a miss, so long as the actor/enemy is immune to the state, but this is completely optional since I'm not sure how difficult it would be to make. An immunity for enemies would be any state that has an efficiency ranking of "F," and for actors it would display an immune message if they are wearing equipment that grants them state defense to the casted state.
 
I'm using the RTAB by Cogwheel. I've found the portion of the script that deals with the damage display texts, but I'm not familiar enough with the RGSS commands to change it myself. This is what I've been looking at, lines 2843-2884:


# In case of on-target hit
    if hit_result == true
      # In case of physical attack other than power 0
      if skill.power != 0 and skill.atk_f > 0
        # State shocking cancellation
        remove_states_shock
        # Setting the effective flag
        effective = true
      end
      # The fluctuation decision of HP
      last_hp = [[self.hp - self.damage[user], self.maxhp].min, 0].max      # Effective decision
      effective |= self.hp != last_hp
      # State change
      @state_changed = false
      effective |= states_plus(user, skill.plus_state_set)
      effective |= states_minus(user, skill.minus_state_set)
      unless $game_temp.in_battle
        self.damage_effect(user, 1)
      end
      # When power 0 is,
      if skill.power == 0
        # Setting the null line to the damage
        self.damage[user] = ""
        # When there is no change in the state,
        unless @state_changed
          # Setting "Miss" to the damage
          self.damage[user] = "Miss"
        end
      end
    # In case of miss
    else
      # Setting "Miss" to the damage
      self.damage[user] = "Miss"
    end
    # When it is not in the midst of fighting,
    unless $game_temp.in_battle
      # Setting nil to the damage
      self.damage[user] = nil
    end
    # Method end
    return effective
  end


It seems like I should be able to add another argument in there to determine when an "immune" message would be displayed, but though trial and error I just haven't been able to figure it out yet.
 
Do you want Miss AND Immune to be displayed, i.e. when a player is immune "immune" is shown but when they don't 'Miss" is shown? If so you'll I'll look into it. If not and you're ok with "Miss" being replaced with "Immune" then all you have to do is change

Code:
self.damage[user] = "Miss"

to

Code:
self.damage[user] = "Immune"
 
Yeah I figured out how to do that much, but I thought it wouldn't make much sense to say "immune" every time it misses because that wouldn't necessarily mean the character is immune to the effect, and could be very misleading to the player. If you could figure out how to make it so that each message would be displayed under the proper conditions I would be most appreciative. Thank you for your responses by the way.
 
alexanderpas":1anhep0w said:
to clarify: what you want is to display miss if it's a true miss, but display immune if it should have been a hit, bit it is a miss due to immunity...

That is precisely what I am looking for here. But I suppose it would also be fine if it said "immune" in the case of a miss, as long as the the target held an immunity to the state. I guess whatever way would be easier to do would be fine with me.
 
<scratching head>

Ok, you want the immune message to show up on an enemy that is "immune", right?

Just the enemy, or on a player character too?

For the enemies, by "Immune", do you mean that it's State Efficiency is set to "F"?

For characters, "Immune" could mean a State Efficiency of "F" on his class, or he's wearing armor that protects him from that state.

Which?  What?  :scruff:
 
Brewmeister":1mruzvx4 said:
Ok, you want the immune message to show up on an enemy that is "immune", right?

Just the enemy, or on a player character too?

For the enemies, by "Immune", do you mean that it's State Efficiency is set to "F"?

For characters, "Immune" could mean a State Efficiency of "F" on his class, or he's wearing armor that protects him from that state.

I would like this to work for both players and enemies. For enemies, the immune message should be displayed if their state efficiency is set to "F." For players, it should appear if they are wearing armors that grant them immunity to the state being casted. I don't have any classes with state immunites but I guess if I did I would want them to display immune messages for any state efficiencies set to "F" as well.
 
I think this is it

Code:
#==========================================================================
# ** SG State Immunity Message
#==========================================================================
# sandgolem 
# Version 3
# 4.06.06
#==========================================================================
#
# To check for updates or find more scripts, visit:
# http://www.gamebaker.com/rmxp/scripts/
#
# To use this script, copy it and insert it in a new section above "Main",
# but under the default scripts and the SDK if you're using it.
#
# Have problems? Official topic:
#   http://forums.gamebaker.com/showthread.php?t=11
#
#==========================================================================

begin
  SDK.log('SG State Immunity Message', 'sandgolem', 3, '4.06.06')
  if SDK.state('SG State Immunity Message') != true
    @sg_immunemsg_disabled = true
  end
  rescue
end

if !@sg_immunemsg_disabled
#--------------------------------------------------------------------------

module RPG
  class Sprite < ::Sprite
    if !method_defined?('sandgolem_immunemsg_sprite_dam')
      alias sandgolem_immunemsg_sprite_dam damage
    end
    def damage(value, critical)
      if @battler.sg_skill_immune == true
        if value == 'Miss'
          value = 'Immune'
        end
      end
      sandgolem_immunemsg_sprite_dam(value, critical)
      @battler.sg_skill_immune = nil
    end
  end
end

class Game_Battler
  attr_accessor :sg_skill_immune
  
  def sg_state_immune_check(statecheck)
    @sg_skill_immune = nil
    for i in statecheck
      if $data_states[i].nonresistance
        return
      end
      if self.state_ranks[i] != 0 && self.state_ranks[i] != 6
        return
      end
    end
    @sg_skill_immune = true
  end
  
  alias sandgolem_immunemsg_gamebat_statesplus states_plus
  def states_plus(plus_state_set)
    if plus_state_set != []
      sg_state_immune_check(plus_state_set)
    end
    sandgolem_immunemsg_gamebat_statesplus(plus_state_set)
  end
end

#--------------------------------------------------------------------------
end
 
That should do it. Except for the armor condition. This version should cover armor immunity as well.

Code:
#==========================================================================
# ** SG State Immunity Message
#==========================================================================
# sandgolem 
# Version 3
# 4.06.06
#==========================================================================
#
# To check for updates or find more scripts, visit:
# http://www.gamebaker.com/rmxp/scripts/
#
# To use this script, copy it and insert it in a new section above "Main",
# but under the default scripts and the SDK if you're using it.
#
# Have problems? Official topic:
#   http://forums.gamebaker.com/showthread.php?t=11
#
#==========================================================================

begin
  SDK.log('SG State Immunity Message', 'sandgolem', 3, '4.06.06')
  if SDK.state('SG State Immunity Message') != true
    @sg_immunemsg_disabled = true
  end
  rescue
end

if !@sg_immunemsg_disabled
#--------------------------------------------------------------------------

module RPG
  class Sprite < ::Sprite
    if !method_defined?('sandgolem_immunemsg_sprite_dam')
      alias sandgolem_immunemsg_sprite_dam damage
    end
    def damage(value, critical)
      if @battler.sg_skill_immune == true
        if value == 'Miss'
          value = 'Immune'
        end
      end
      sandgolem_immunemsg_sprite_dam(value, critical)
      @battler.sg_skill_immune = nil
    end
  end
end

class Game_Battler
  attr_accessor :sg_skill_immune
  
  def sg_state_immune_check(statecheck)
    @sg_skill_immune = nil
    for i in statecheck
      if $data_states[i].nonresistance
        return
      end
      if self.state_ranks[i] != 0 && self.state_ranks[i] != 6
        return
      end
      # ALSO CHECK FOR ARMOR WITH A STATE DEFENSE
      unless self.state_guard?(i)
        return
      end
    end
    @sg_skill_immune = true
  end
  
  alias sandgolem_immunemsg_gamebat_statesplus states_plus
  def states_plus(plus_state_set)
    if plus_state_set != []
      sg_state_immune_check(plus_state_set)
    end
    sandgolem_immunemsg_gamebat_statesplus(plus_state_set)
  end
end

#--------------------------------------------------------------------------
end
 
I really appreciate your help, but this script seems to be conflicting with the RTAB system. I get a message saying:

"Script' Real time active battle (RTAB)' line 2857: Argument error occurred
wrong number of arguments(2 for 1)

It seems to be confilcting with this part of the RTAB:

      effective |= states_plus(user, skill.plus_state_set)
      effective |= states_minus(user, skill.minus_state_set)

If I place the script above the RTAB then it won't work at all.....anyone know how this can be resolved?
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top