Actors & enemies without Morale - Printable Version +- Save-Point (https://www.save-point.org) +-- Forum: Games Development (https://www.save-point.org/forum-4.html) +--- Forum: Code Support (https://www.save-point.org/forum-20.html) +--- Thread: Actors & enemies without Morale (/thread-8776.html) |
Actors & enemies without Morale - Bennerdeben - 07-01-2023 It has been a while since I last posted here. I’ve been using Kitsune's Extra Statistics combined with health/sp bars and such, and all works well. I added a stat called Morale which also uses its own bar. When a battler for example has less than 25% morale this will give him/her a state with negative effects (low morale), but if a battler has more than 75% of the morale bar filled it will give a state with positive effects (high morale). A battler can lose morale by missing an enemy or losing a partymember, or can increase morale by defeating enemies and winning a battle. But there is a problem. 1.png (Size: 727.04 KB / Downloads: 7) There will be friends and enemies which shouldnt have a mental state, for example, elementals, robots, zombies etc. (see where the red arrows point to in the picture). This means their state shouldnt change depending on their morale and their morale bar shouldnt show either. In fact, they shouldnt have it at all. I tried working around it with a permanent state for those without morale called “no morale”. It sort of worked, but it quickly became a mess when I also tried removing the stat from showing for said friends/enemies inbattle. Does anyone know what to do? RE: Actors & enemies without Morale - DerVVulfman - 07-02-2023 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 Code: IGNORE_ACTOR = [2,4,6,8] 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) 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 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! RE: Actors & enemies without Morale - kyonides - 07-02-2023 Just a minor correction here... Code: if actor.is_a?(Game_Actor) You don't conjugate the verb in Ruby. RE: Actors & enemies without Morale - DerVVulfman - 07-02-2023 Updated. Been dealing with other coding recently. And neglected to include a minor consideration in the second example. RE: Actors & enemies without Morale - Bennerdeben - 07-15-2023 Finally had time to work on the issue (wish I had more time for this). Works properly now. Thanks! |