Save-Point
Analyse show HP Bars - 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: Analyse show HP Bars (/thread-151.html)

Pages: 1 2


Analyse show HP Bars - Ace - 06-12-2010

Hey again it's me :O
First, I use a analyse script and I use the CTB by Charlie Fleed.

Now in the CTB there is the feature that Enemy HP Bars are shown if an enemy is killed.

for enemy in $game_troop.enemies
if $game_system.killed_enemies_ids.include?(enemy.id)
enemy.show_hp_bar=true
end

Now I tried to show the HP Bars when the skill Analyse is used. How could I do this? Please help^^


[Resolved] Analyse show HP Bars - Kread-EX - 06-12-2010

I guess you could make your Analyze skill activate a common event in which you use a Call Script command with this: $game_troop.enemies[$scene.active_battler.current_action.target_index].show_hp_bar = true.

In this case, you would have to comment out the part of the code you wrote in your post.


[Resolved] Analyse show HP Bars - Ace - 06-12-2010

Thank you for your answer^^ I tried to paste it in a common event but I get:
SyntaxError occured while running script.

When I paste it in a common event it looks like this:

$game_troop.enemies
[$scene.active_battler.current_action
.target_index].show_hp_bar = true

Maybe that causes the error


[Resolved] Analyse show HP Bars - Kread-EX - 06-12-2010

Yes. The lines are broken in a bad way. You can try something like this:
enemies = $game_troop.enemies
actor = $scene.active_battler
action_t = actor.current_action.target_index
target = enemies[action_t]
target.show_hp_bar = true


[Resolved] Analyse show HP Bars - Ace - 06-12-2010

OK now there is no error but the bars are not there :O
But thank you :D


[Resolved] Analyse show HP Bars - Kread-EX - 06-12-2010

Forgot to ask... what is the scope of your skill ?


[Resolved] Analyse show HP Bars - Ace - 06-12-2010

One Enemy ^^


[Resolved] Analyse show HP Bars - Kread-EX - 06-12-2010

In the Damage and Colors section of the CTB script, starting at line 197 (within the update method), you should find this:
Code:
# Support for HP bars
if HP_BARS and @battler != nil and @battler.is_a?(Game_Enemy) and
$game_system.killed_enemies_ids.include?(@battler.id) and
@battler.show_hp_bar and @battler_visible
Try to remove $game_system.killed_enemies_ids.include?(@battler.id) and. The show_hp_bar flag should only be on when the skill is used, so I guess it's safe.


[Resolved] Analyse show HP Bars - Ace - 06-12-2010

yeah perfect, it works :D Merci infiniment ^^


[Resolved] Analyse show HP Bars - Ace - 06-15-2010

Sorry to bother you again but I realized that it works not perfectly. The problem is, that the bar shows up, but if I attack the enemy the bar is not updated. It keeps filled. Maybe you could help me with that? Oh and also the bar should just show up if I analyze an enemy, not when I kill one.
ty very much^^

EDIT: Oh damn I just realized the scope is one enemy but it analyzes nevertheless every enemy on the field, so the scope is all enemys!!^^