So looking at the monster hunter script I wanted to see if I could tweak it to add a conditional to check states, which would affect the monster's capture rate. Note I am also using stacked states for the stack_state check to see if states are stacked. If stacked it increases chance of capture.
The error I get after all of my actors use their battle commands is "nil cant be coerced to fixnum.
Default code, where enemy capture rate = enemy capture rate, self explanatory
alias monster_hunter_enemy_initialize initialize def initialize(index, enemy_id) monster_hunter_enemy_initialize(index, enemy_id) @capture_rate = enemy.capture_rate @no_capture = enemy.no_capture @last_hit_item = Game_BaseItem.new @last_hit_user = nil endWhen I modified it, didn't work.
The error I get after all of my actors use their battle commands is "nil cant be coerced to fixnum.
Default code, where enemy capture rate = enemy capture rate, self explanatory
alias monster_hunter_enemy_initialize initialize def initialize(index, enemy_id) monster_hunter_enemy_initialize(index, enemy_id) @capture_rate = enemy.capture_rate @no_capture = enemy.no_capture @last_hit_item = Game_BaseItem.new @last_hit_user = nil endWhen I modified it, didn't work.
Code:
alias monster_hunter_enemy_initialize initialize def initialize(index, enemy_id) monster_hunter_enemy_initialize(index, enemy_id) size = $game_troop.members.size i = 0 while i < size a = $game_troop.members[i] if a.state?(25) @capture_rate = ((a.state_stack(25)*10) + enemy.capture_rate) else @capture_rate = enemy.capture_rate end i = i+1 end @no_capture = enemy.no_capture @last_hit_item = Game_BaseItem.new @last_hit_user = nil end