Ive been making a script for a project im working on, and ATB system that allows skills to have a delay or recharge value added to them.
The recharge works fine, but im having problems getting the delayed skills to work properly. Everything works just fine, the skill is saved and the battler can carry on fighting as normal, even queuing up more delayed skills, then once the timer runs down, combat pauses and the saved skill fires off, but if the original target of the skill has been killed since it was saved the screen just blinks, the mesage pops up and nothing happens.
I need to find a way of checking the saved targets variable at the ##### mark so that it can either randomize a new one or display a miss message, ive tried a few different things but none of them work.
The recharge works fine, but im having problems getting the delayed skills to work properly. Everything works just fine, the skill is saved and the battler can carry on fighting as normal, even queuing up more delayed skills, then once the timer runs down, combat pauses and the saved skill fires off, but if the original target of the skill has been killed since it was saved the screen just blinks, the mesage pops up and nothing happens.
I need to find a way of checking the saved targets variable at the ##### mark so that it can either randomize a new one or display a miss message, ive tried a few different things but none of them work.
Code:
alias non_delay_use_item use_item def use_item(has_delay = false, i = 0) if has_delay @subject = DELAY.delay_a[i][1] targets = DELAY.delay_a[i][2] ####### item = DELAY.delay_a[i][3] DELAY.delay_a.delete_at(i) show_animation(targets, item.animation_id) refresh_status @log_window.add_text("Delayed attack hits") targets.each {|target| item.repeats.times { invoke_item(target, item) } } else item = @subject.current_action.item targets = @subject.current_action.make_targets.compact if item.delay <= 0 Sound.play_buzzer @log_window.display_use_item(@subject, item) @subject.use_item(item) refresh_status show_animation(targets, item.animation_id) targets.each {|target| item.repeats.times { invoke_item(target, item) } } else DELAY.add_item(@subject, targets, item) @log_window.display_use_item(@subject, item) @log_window.add_text("Attack delayed!") @subject.use_item(item) refresh_status end @subject.time_loss end end