Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[RESOLVED]Enemy stat changes

i've been trying to change the hp of a monster using a call script event and it works. but it only does it when the monster attacks or the hero attacks it, not automatically what i've been using is $data_enemies[1].maxhp += 11. am i missing something?

what i'm basically going for is automatically change the monster's maxhp thru an event
 
You never want to modify $data_enemies, unless you really really know what you are doing. If you are simply trying to change an enemies maxhp, or hp, use:

$game_troop.enemies[index].maxhp=n
$game_troop.enemies[index].hp=n


Also have to remember, windows and script addons are usually only set to "redraw" at specific moments. If you are wanting the damage to be displayed, you would need to also add:
$game_troop.enemies[index].damage = n
$game_troop.enemies[index].damage_pop = true


Hope that helps a little. If you still need help, care to explain exactly what you are doing? Might be able to help you even more. :thumb:
 
here's the situation: what i'm trying to do is change them automatically either thru a common event or battle event. '$game_troop.enemies[index].maxhp=n' and '$game_troop.enemies[index].hp=n' only just change these values to 'n'(i.e 11) but it doesn't add or subtract a number to it. for some reason these values only get changed (+ 0r -)when the enemy attacks or is damaged.

thats my problem.
 
Where are you putting this little script? In an event, common event or big script? This is also important, cause you may need to put "Autorun" if its an event (tool event like in ABS action systems). Other than that I cannot help I am sorry. You should use the mannual mode in eventlist!

EDIT: i see you describe that its in BATTLE EVENT or COMMON EVENT. Read the above text and put it under Common! If you want to call a script you can aslo put other fun stuff into the common event you call!
 
+= instead of =

They do change, you just probably on see it. Try adding:

$scene.update_phase4_step5

I'm not exactly 100% sure what that will do, but that forces the $scene to go to that method where damage is displayed (believe its step5, I didn't bother opening RMXP to check lol)
 
@Sephiroth that got me an error. this error actually:
Untitled-1a.png

i've been using '+=' that's where the problem arises
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top