- 155
- Posts
- 9
- Years
- Age 31
- Seen Jun 11, 2021
I've been trying to create an ability that has the effects of Destiny Bond, but for some reason, it's not working at all whenever I try to test it out.
This is one of the lines of code I've edited.
And I've added this section after Destiny Bond's code. Basically, the ability's supposed to have a 50% chance to make the attacker faint if the target with the ability faints, but so far, it hasn't worked at all.
Code:
if target.isFainted?
destinybond=destinybond || (target.effects[PBEffects::DestinyBond] [B][COLOR=Red]|| target.hasWorkingAbility(:FAINTINGSPIRIT))[/COLOR][/B]
end
Code:
if target.hasWorkingAbility(:FAINTINGSPIRIT,true) && @battle.pbRandom(50)<3# && target.pbIsOpposing?(user.index)
@battle.pbDisplayEffect(target)
PBDebug.log("[Ability triggered] #{target.pbThis}'s Fainting Spirit")
@battle.pbDisplay(_INTL("{1}'s {2} took {3} down!",target.pbThis,PBAbilities.getName(target.ability),user.pbThis))
user.pbReduceHP(user.hp)
user.pbFaint # no return
@battle.pbJudgeCheckpoint(user)
end