Posts: 867
Threads: 15
Joined: Nov 2009
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^^
Posts: 91
Threads: 9
Joined: Feb 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.
Posts: 867
Threads: 15
Joined: Nov 2009
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
Posts: 91
Threads: 9
Joined: Feb 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
Posts: 867
Threads: 15
Joined: Nov 2009
OK now there is no error but the bars are not there :O
But thank you :D
Posts: 91
Threads: 9
Joined: Feb 2010
Forgot to ask... what is the scope of your skill ?
Posts: 867
Threads: 15
Joined: Nov 2009
Posts: 91
Threads: 9
Joined: Feb 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.
Posts: 867
Threads: 15
Joined: Nov 2009
yeah perfect, it works :D Merci infiniment ^^
Posts: 867
Threads: 15
Joined: Nov 2009
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!!^^