I'm hoping this will be a quick and easy question. I would like to write a variable operation (using the normal Control Variable function off of the event commands list) that will set the variable's value to the database ID # of enemy #X of the current enemy troop. How would I go about writing the script that is evaluated for the variable operation? I know pretty much nothing about Ruby's syntax, so I am not even sure where to start trying possible expressions.
Quick Question - Getting Enemy ID
● ARCHIVED · READ-ONLY
-
-
I do believe the syntax to get a troop member's id would be:
Code:Which you can use in an event script call like so:$game_troop.members[index_of_battler].enemy_id
Code:Be wary that if the enemy in $game_troop.members[index] is nil, then the method call enemy_id will fail, because nil doesn't have said method.id = $game_troop.members[index].enemy_id$game_variables[some_variable_index] = id