Hello! I'm currently working on implementing custom battle parameters. It's similar to that of Yanfly's Skill Cost Manager. I want to make a bp (Battle Points) Bar that works similar to TP, but just takes longer to fill up and allows for stronger attacks. I've got the UI complete now I just need to actually attach some variables to the UI so that it functions the way I want it.
I have a couple of questions. First I've already been attempting to implement this and I think I'm almost done, however, I've reached a road block due to an error. I've been reading up on documentation and glossing through other similar scripts since yesterday to try to figure this out, but I'm stumped.
My code: http://pastebin.com/3CSjMwvr
My Error: Line 55, Comparison of fixnum with nil failed.
I'm not sure how bp_cost is returning as nil, it's obviously being set. I've seen other scripts that do this same thing without a problem so I'm completely lost. If there's someone out there who's more experience with Ruby than me I'd like some insight as to what I'm doing wrong.
Also, is there a way I can call and change the bp variable I have to match a custom calculation I've made.
As you can see I tried to call it using "actor.bp = @burst_cw" but that didn't yield any results. Could it be because bp is an attr_reader instead of an accessor?
I usually like to try to figure these things out myself but I'm completely lost here.
Thanks in advance!
I have a couple of questions. First I've already been attempting to implement this and I think I'm almost done, however, I've reached a road block due to an error. I've been reading up on documentation and glossing through other similar scripts since yesterday to try to figure this out, but I'm stumped.
My code: http://pastebin.com/3CSjMwvr
My Error: Line 55, Comparison of fixnum with nil failed.
I'm not sure how bp_cost is returning as nil, it's obviously being set. I've seen other scripts that do this same thing without a problem so I'm completely lost. If there's someone out there who's more experience with Ruby than me I'd like some insight as to what I'm doing wrong.
Also, is there a way I can call and change the bp variable I have to match a custom calculation I've made.
Code:
def calculate_tp
actor = {}
max_actors = item_max - 1
for i in 0..max_actors
actor[i] = $game_party.battle_members[i]
end
@gauge_variable = (
actor[0].tp +
actor[1].tp +
actor[2].tp +
actor[3].tp
)
end
def update_gauge
return if @gauge_meter == nil
sprite_visible(@gauge_meter)
if @sprite_visible
calculate_tp
actor = $game_party.battle_members[0]
actor.bp = 400
burst_rate(actor)
if(@gauge_width <= @burst_mw)
@gauge_width = @burst_cw
end
@gauge_meter_rect = Rect.new(@scroll, 0, @gauge_width, 9)
@gauge_meter.bitmap.blt(0, 0, @gauge_sprite, @gauge_meter_rect)
@scroll += 1
if(@scroll >= @scroll_max)
@scroll = 20
end
end
end
def sprite_visible(sprite)
if @sprite_visible
sprite.opacity += 2 unless @sprite_visible_wait > 0
else
sprite.opacity -= 10 ; @sprite_visible_wait = 5
end
end
def burst_rate(actor)
@burst_iw = 0
@burst_cw = (@burst_iw + (@gauge_variable / item_max)).to_i
@burst_mw = (actor.hp / 2).to_i
#actor.bp = @burst_cw
#actor.bp_cost = 400
end
As you can see I tried to call it using "actor.bp = @burst_cw" but that didn't yield any results. Could it be because bp is an attr_reader instead of an accessor?
I usually like to try to figure these things out myself but I'm completely lost here.
Thanks in advance!
