07-02-2023, 01:52 AM
(This post was last modified: 07-02-2023, 02:17 AM by DerVVulfman.)
Well, the removal of the Morale bar itself could be as simple as wrapping the bar-drawing code in an if...endif block, or just adding some code before the stat is even drawn:
Examples:
First, let's assume we're dealing with a list of 'actors' and/or enemies with no Morale to work with
We can refer to these battlers at the very 'beginning' of a method like so:
This example merely revents the 'text' of the Morale statistic from showing when the 'draw_actor_morale' is showing, just by exiting when an inappropriate battler is detected. I don't know if your method to draw the morale stat and the morale bar are combined in one... though that would make it SO convenient.
An increase or decrease of the morale stat could be just as simple:
Of course, this is conjecture as I don't see your code and the above clode assumes you (the developer) may pick and choose what actors and/or enemies have morale.
It would be entertaining if an enemy's morale drops so badly he ESCAPES from combat!
Examples:
First, let's assume we're dealing with a list of 'actors' and/or enemies with no Morale to work with
Code:
IGNORE_ACTOR = [2,4,6,8]
IGNORE_ENEMY = [1,5,6,12]
We can refer to these battlers at the very 'beginning' of a method like so:
Code:
def draw_actor_morale(actor, x, y, width = 144)
# Just exit if the battler is in an excluded list
# (Added Enemies into the method for kicks)
if actor.is_a?(Game_Actor)
return if IGNORE_ACTOR.include?(actor.id)
else
return if IGNORE_ENEMY.include?(actor.id)
end
# Draw "Morale" text string
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Morale")
# Calculate if there is draw space for MaxMorale
if width - 32 >= 108
morale_x = x + width - 108
flag = true
elsif width - 32 >= 48
morale_x = x + width - 48
flag = false
end
# Draw Morale
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.morale <= actor.maxmorale / 4 ? crisis_color : normal_color
self.contents.draw_text(morale_x, y, 48, 32, actor.morale.to_s, 2)
# Draw MaxMorale
if flag
self.contents.font.color = normal_color
self.contents.draw_text(morale_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(morale_x + 60, y, 48, 32, actor.maxmorale.to_s)
end
end
This example merely revents the 'text' of the Morale statistic from showing when the 'draw_actor_morale' is showing, just by exiting when an inappropriate battler is detected. I don't know if your method to draw the morale stat and the morale bar are combined in one... though that would make it SO convenient.
An increase or decrease of the morale stat could be just as simple:
Code:
# Assume morale change is permitted
allow_morale = true
# Test if the actor or enemy doesn't change morale
if target.is_a?(Game_Actor)
allow_morale = false if IGNORE_ACTOR.include?(target.id)
else
allow_morale = false if IGNORE_ENEMY.include?(target.id)
end
# Change the morale if permitted
if allow_morale == true
target.morale += morale_change_value
end
Of course, this is conjecture as I don't see your code and the above clode assumes you (the developer) may pick and choose what actors and/or enemies have morale.
It would be entertaining if an enemy's morale drops so badly he ESCAPES from combat!