- 428
- Posts
- 5
- Years
- Zekko
- Seen Nov 21, 2023
Code:
Battle::ItemEffects::OnSwitchIn.add(:CALTROPS,
proc { |item, user, battler, target, move, battle|
next if user.pbOpposingSide.effects[PBEffects::Spikes] >= 3
user.pbOpposingSide.effects[PBEffects::Spikes] += 1
battler.pbConsumeItem
}
)
Code:
Battle::ItemEffects::OnSwitchIn.add(:CALTROPS,
proc { |item, battler, battle|
next if user.pbOpposingSide.effects[PBEffects::Spikes] >= 3
user.pbOpposingSide.effects[PBEffects::Spikes] += 1
battle.pbDisplay(_INTL("{1} scatters Caltrops on the foe's side of the field!",
battler.pbThis, battler.itemName))
}
)
Which version of this code is closer to correct, and what will fix it?
The goal is for the held item to use Spikes once, and then consume itself, when the Pokemon holding it is sent out.
Sometimes the error message claims the engine doesn't know what "User" or "Battle" or "Battler" is, and sometimes it claims to not know what "pbOpposingSide" or "PBEffects::Spikes" is.
Last edited: