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,674
Reaction score
566
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
84
Reaction score
114
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,674
Reaction score
566
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
84
Reaction score
114
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 Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,034
Messages
1,018,447
Members
137,820
Latest member
georg09byron
Top