RGSS2 - ENEMY STATS
Posts
Pages:
1
How do I access, say, the HP of an enemy in a certain Troop via RGSS2? I'm guessing the RPG::Enemy data class has something to do with it but I'm not too sure where to go from there.
Help would be much appreciated. Happy holidays!
Help would be much appreciated. Happy holidays!
RPG::Enemy has the base values of all enemies like their MaxHP and base attack. The current values of enemies is stored in $game_troop.troop as an array of Game_Enemy's. If you want to pull the HP of the first enemy in the current troop you'll have to do something like
hp = $game_troop.troops[1].hp
Ahh, sorry, that was a horrid example. I actually wanted to be able to access Max HP (and all other base values). :\ (And also, being able to access this data from a troop with a certain ID, and not a troop the party's currently battling)
Ahh, $data_troops is an array of all enemy troops (RPG::Troop) which has an an array of members of the troop (RPG::Troop::Member) which has an ID of the enemy used. Enemy base values are in $data_enemies which you can use the ID for.
To pull enemy info, you need:
Or to do something with every troop without caring about the ###
And enemy is a RPG::Enemy (check the help file under RGSS Reference Manual -> Game Library -> RPG VX Data Strucutre -> RPG :: Enemy to see what values you can pull from it)
To pull enemy info, you need:
$data_enemies[ $data_troops[TROOP_ID].members[###].enemy_id].maxhp/maxmp/atk/def/spi/agi/ect
Or to do something with every troop without caring about the ###
$data_troops[TROOP_ID].members.each do |member|
enemy = $data_enemies[member.enemy_id]
end
Pages:
1















