Hello everyone,
this is my very first post on this forum. I'm quite new to RM and ruby so please forgive me if this question sounds dumb or this is not the right place to post such questions. I already used the search feature to look for similar questions but apparently I am not lucky (or just very bad at using that search feature...which is also quite possible).
At the moment I am trying to understand how targeting works. I was looking into Game_Battler and I found a variable called last_target_index. I feel like if I miss something obvious but I cannot understand how this variable changes. My idea was to use it to keep track of the targed so i could do something like this:
1) when last_target_index is the enemy I want to attack I store its value into another variable;
2) when my conditions are met I do something on that target using the stored value to track it.
#-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :battler_name # battle graphic filename attr_reader :battler_hue # battle graphic hue attr_reader :action_times # action times attr_reader :actions # combat actions (action side) attr_reader :speed # action speed attr_reader :result # action result (target side) attr_accessor :last_target_index # last target attr_accessor :animation_id # animation ID attr_accessor :animation_mirror # animation flip horizontal flag attr_accessor :sprite_effect_type # sprite effect attr_accessor :magic_reflection # reflection flagHere is where I found this variable. Now my questions are: How does it change? How can I use it to keep track of my target?
Sorry again if my question is a dumb one but I am still new to ruby and I still have difficulties tracking everything.
this is my very first post on this forum. I'm quite new to RM and ruby so please forgive me if this question sounds dumb or this is not the right place to post such questions. I already used the search feature to look for similar questions but apparently I am not lucky (or just very bad at using that search feature...which is also quite possible).
At the moment I am trying to understand how targeting works. I was looking into Game_Battler and I found a variable called last_target_index. I feel like if I miss something obvious but I cannot understand how this variable changes. My idea was to use it to keep track of the targed so i could do something like this:
1) when last_target_index is the enemy I want to attack I store its value into another variable;
2) when my conditions are met I do something on that target using the stored value to track it.
#-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :battler_name # battle graphic filename attr_reader :battler_hue # battle graphic hue attr_reader :action_times # action times attr_reader :actions # combat actions (action side) attr_reader :speed # action speed attr_reader :result # action result (target side) attr_accessor :last_target_index # last target attr_accessor :animation_id # animation ID attr_accessor :animation_mirror # animation flip horizontal flag attr_accessor :sprite_effect_type # sprite effect attr_accessor :magic_reflection # reflection flagHere is where I found this variable. Now my questions are: How does it change? How can I use it to keep track of my target?
Sorry again if my question is a dumb one but I am still new to ruby and I still have difficulties tracking everything.