Hello again Yal! Hope you're having a good summer,
I've been working on a shield system by copying how HP works and changing all the variables to ShieldHP essentially. I'm having trouble figuring out how to get the damage to "jump" over to reducing normal HP after the shield bar has been destroyed. ( I have separate dmgapply scripts for shield dmg and normal dmg below) It seems like the damage is stuck on trying to take from the sheildHP pool even after it has reached zero. Probably some simple thing i've overlooked :) Here's what I'm working with:
//Damage
if(pow > 0){
var dmgdata = compute_damage(a_user,trg,a_comm);
if(sheildcheck >0){
n = instance_create_depth(trg.x,trg.y,depth,obj_dmgapplyshld)
n.my_dmg = ceil(dmgdata[0]*ail_power_multiplier)
n.my_mul = dmgdata[1]
n.my_eff = dmgdata[2]
n.my_mon = trg
n.my_user = a_user
n.my_move = a_comm
n.this_is_an_attack = true
}
//********************
if(sheildcheck < 1){
n = instance_create_depth(trg.x,trg.y,depth,obj_damageapply)
n.my_dmg = ceil(dmgdata[0]*ail_power_multiplier)
n.my_mul = dmgdata[1]
n.my_eff = dmgdata[2]
n.my_mon = trg
n.my_user = a_user
n.my_move = a_comm
n.this_is_an_attack = true
//User might hold an item that improves attack effectiveness
if(battle_item_might_affect_this(a_user.amp_id,itemvalidflag_AUTO_ATTACKING)){
var it = amp_read_var(a_user.amp_id,amp_HELDITEM)
n.my_mul *= script_execute(global.item_data[it,id_USESCRIPT],[a_user.amp_id,trg.amp_id,a_comm],global.item_data[it,id_USEARG])
}
}
}
Thanks!!