Victor's Incapacitate States : "Incapacitate State" will not give Money or EXP

Panda_Artist

Humble RPG Fan
Veteran
Joined
Dec 22, 2018
Messages
241
Reaction score
15
First Language
Portuguese
Primarily Uses
RMVXA
Good Morning / Day / Afternoon / Evening everyone.

I have a request for a bit of support regarding a script:


This script is neat as it allows to create states that incapacitate an enemy and can result in battle victory or game over if all enemies are afflicted. It has an option for a "kill state" and an "incapacitate state", like a Stone state.

However:

When enemies are applied an "incapacitate state" they don't grant EXP or money at the end of battle.

Is there a way to fix this? I really would like to have the enemies drop EXP and money with an "incapacitate state".
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
you could change part of the script.
Ruby:
  alias :all_dead_ve_incapacitate_states? :all_dead?
  def all_dead?
        for i in $game_troop.members.each { |e|
            if e.incapacitated?
                e.die
            end }
    end
    all_dead_ve_incapacitate_states? || all_incapacitated?
  end
*scratch that. kills as soon as the enemy is incapacitated.
 

Featherbrain

Prehistoric Gamer
Veteran
Joined
Jan 12, 2020
Messages
81
Reaction score
89
First Language
English
Primarily Uses
RMMV
Following because I eventually need to fix this for Yanfly Group Categories and the category "Group Defeat." It behaves similarly. If a fix is found for this one I may be able to apply it to that plugin or just switch to this plugin for that functionality.
 

Panda_Artist

Humble RPG Fan
Veteran
Joined
Dec 22, 2018
Messages
241
Reaction score
15
First Language
Portuguese
Primarily Uses
RMVXA
Yes I tried it and it does kill the enemy. It's not exactly what I want. is there a way to make sure the enemy graphic stays in the battle screen for incapacitate states and still recieve EXP and money?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
not exactly what I want
I know, me neither. I could not find a way to add the extra exp to the $game_troop.exp_total it keeps giving an error no matter which way I tried.
But here is a workaround.
Ruby:
module BattleManager
  def self.process_victory
    @expsum = $game_troop.exp_total
    @goldsum = $game_troop.gold_total
        for i in $game_troop.members.each_with_index { |e, enemy|
            if e.incapacitated?
        @expsum += e.exp
        @goldsum += e.gold
                e.die
            end }
    end
    play_battle_end_me
    replay_bgm_and_bgs
    $game_message.add(sprintf(Vocab::Victory, $game_party.name))
    display_exp
    gain_gold
    gain_drop_items
    gain_exp
    SceneManager.return
    battle_end(0)
    return true
  end

  #--------------------------------------------------------------------------
  # * Display EXP Earned
  #--------------------------------------------------------------------------
  def self.display_exp
    if $game_troop.exp_total > 0 || @expsum > 0
      text = sprintf(Vocab::ObtainExp, @expsum)
      $game_message.add('\.' + text)
    end
  end
  #--------------------------------------------------------------------------
  # * Gold Acquisition and Display
  #--------------------------------------------------------------------------
  def self.gain_gold
    if $game_troop.gold_total > 0 || @goldsum > 0
      text = sprintf(Vocab::ObtainGold, @goldsum)
      $game_message.add('\.' + text)
      $game_party.gain_gold(@goldsum)
    end
    wait_for_message
  end
  #--------------------------------------------------------------------------
  # * EXP Acquisition and Level Up Display
  #--------------------------------------------------------------------------
  def self.gain_exp
    $game_party.all_members.each do |actor|
      actor.gain_exp(@expsum)
    end
    wait_for_message
  end
end
 

Panda_Artist

Humble RPG Fan
Veteran
Joined
Dec 22, 2018
Messages
241
Reaction score
15
First Language
Portuguese
Primarily Uses
RMVXA
Do I paste this below the incapacitate states?
 

Featherbrain

Prehistoric Gamer
Veteran
Joined
Jan 12, 2020
Messages
81
Reaction score
89
First Language
English
Primarily Uses
RMMV
Yeah, I realized that after I posted, lol. Living up to my username there. However, the code logic does seem fairly similar. I actually already fixed it for gold and exp last night. I considered changing the battle manager functions but I ended up changing the game troop functions (for ruby it looks like that's $game_troop.exp_total), that worked really seamlessly for MV at least.

ETA: FWIW, here is the code I used for MV. If the Ruby functions are similar this could probably translate. Like I said, it seamlessly adds the extra exp/gold directly to the total earned from the troop at the end of battle so you don't have to edit the additional display functions. I hard-coded my one custom death state (12), you would probably want to reference the "incapacitated" variable from the plugin instead. I'm still working on the item function today, it's a little bit different and I'm not exactly a coding whiz.


JavaScript:
Game_Troop.prototype.expTotal = function() {
    var deadMemberExp = this.deadMembers().reduce(function(r, enemy) {
        return r + enemy.exp();
    }, 0);
    var groupDefeatExp = 0;   
    for (var i = 0; i < this.aliveMembers().length; ++i) {
        var member = this.aliveMembers()[i];
        if (member && member.isStateAffected(12)) {
            groupDefeatExp += member.enemy().exp;
        }
    }
    return deadMemberExp + groupDefeatExp;
};

Game_Troop.prototype.goldTotal = function() {
    var deadMemberGold = this.deadMembers().reduce(function(r, enemy) {
        return r + enemy.gold();
    }, 0);
    var groupDefeatGold = 0;
    for (var i = 0; i < this.aliveMembers().length; ++i) {
        var member = this.aliveMembers()[i];
        if (member && member.isStateAffected(12)) {
            groupDefeatGold += member.enemy().gold;
        }
    }
    return (deadMemberGold + groupDefeatGold) * this.goldRate();
};
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,090
Members
137,586
Latest member
Usagiis
Top