- Joined
- Jan 22, 2024
- Posts
- 10
I'm using Pokémon Essentials v20.1. I'm trying to create at least one of two ability effects. If one of them is too complicated or difficult to create, I'm fine with only using the other. If neither is possible, I'll come up with something different to use in my project.
I'm not very knowledgeable on programming in general but I've been making some simple move and ability effects by copying and slightly revising effects that already exist, such as variations of Lightning Rod (redirect single target move of specified type to self + user gets a boost to one stat) where one ability has several components with different locations in the script editor to make the ability work correctly.
I've also created abilities that combine aspects of multiple different simple abilities, such as Wonder Skin (affects all foes) with Heatproof (mults[:base_damage_multiplier] /= 2 if type == :FIRE) with Friend Guard (DamageCalcFromTargetAlly) to create abilities that cut in half the base power of all foes' moves of a certain type when dealing damage to either the ability user or the user's ally.
Thanks in advance for any help.
I'm not very knowledgeable on programming in general but I've been making some simple move and ability effects by copying and slightly revising effects that already exist, such as variations of Lightning Rod (redirect single target move of specified type to self + user gets a boost to one stat) where one ability has several components with different locations in the script editor to make the ability work correctly.
I've also created abilities that combine aspects of multiple different simple abilities, such as Wonder Skin (affects all foes) with Heatproof (mults[:base_damage_multiplier] /= 2 if type == :FIRE) with Friend Guard (DamageCalcFromTargetAlly) to create abilities that cut in half the base power of all foes' moves of a certain type when dealing damage to either the ability user or the user's ally.
The first ability effect I want to create is similar to Sand Rush, but instead of multiplying the speed of the ability user, would multiply the speed of the user's allies. If I want this ability to also multiply the user's speed I could simply copy the code for Sand Rush and change the ability tag.
I've attempted to create this ability by searching for instances of "AccuracyCalcFromAlly" from Victory Star and trying to replicate it with "SpeedCalcFromAlly" under instances of "SpeedCalc" (for the ability user). Here's what I added:
First addition: [[ Battle ]] > [[ Battler ]] > Battle_Battler > line 248:
Second addition: [[ Battle ]] > [[ Other battle code ]] > Battle_AbilityEffects > line 5:
Third addition: [[ Battle ]] > [[ Other battle code ]] > Battle_AbilityEffects > line 78:
Fourth addition: [[ Battle ]] > [[ Other battle code ]] > Battle_AbilityEffects > at the bottom where my custom abilities are:
Those are the only places I've added or changed anything involving this ability effect.
When I'm using the Pokémon with this ability in my party against a trainer while running the game through debug mode, here's the error message:
I don't know how to fix this since I'm not simply copying pre-existing functions.
I've attempted to create this ability by searching for instances of "AccuracyCalcFromAlly" from Victory Star and trying to replicate it with "SpeedCalcFromAlly" under instances of "SpeedCalc" (for the ability user). Here's what I added:
First addition: [[ Battle ]] > [[ Battler ]] > Battle_Battler > line 248:
Ruby:
if abilityActive?
speedMult = Battle::AbilityEffects.triggerSpeedCalc(self.ability, self, speedMult)
end
# Below is what I wrote:
user.allAllies.each do |b|
next if !b.abilityActive?
Battle::AbilityEffects.triggerSpeedCalcFromAlly(
b.ability, modifiers, user, target, self, @calcType
)
end
# Below this continues with "if itemActive?"
# When I try to test the ability I gave this effect, I think the error message that pops up is caused with this first part.
Ruby:
SpeedCalc = AbilityHandlerHash.new
# Below is what I wrote:
SpeedCalcFromAlly = AbilityHandlerHash.new
# Below this is "WeightCalc"
Ruby:
def self.triggerSpeedCalc(ability, battler, mult)
return trigger(SpeedCalc, ability, battler, mult, ret: mult)
end
# Below is what I wrote:
def self.triggerSpeedCalcFromAlly(ability, mods, user, target, move, type)
SpeedCalcFromAlly.trigger(ability, mods, user, target, move, type)
end
# Below this continues with "def self.triggerWeightCalc"
Ruby:
# Companion is the name of the ability.
Battle::AbilityEffects::SpeedCalcFromAlly.add(:COMPANION,
proc { |ability, battler, mult|
next mult *= 1.5
}
)
When I'm using the Pokémon with this ability in my party against a trainer while running the game through debug mode, here's the error message:
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]
[EBDX v1.4.2 (E20)]
Script error in event 85 (coords 50,3), map 32 (Developer Room)
Exception: NameError
Message: undefined local variable or method `user' for #<Battle::Battler>
***Full script:
TrainerBattle.start(:BIKER,"Test One")
Backtrace:
160:Battle_Battler:252:in `pbSpeed'
150:Battle_ActionAttacksPriority:152:in `block in pbCalculatePriority'
150:Battle_ActionAttacksPriority:147:in `each'
150:Battle_ActionAttacksPriority:147:in `pbCalculatePriority'
151:Battle_ActionSwitching:303:in `pbOnAllBattlersEnteringBattle'
148:Battle_StartAndEnd:312:in `pbStartBattleCore'
148:Battle_StartAndEnd:270:in `pbStartBattle'
242:Overworld_BattleStarting:513:in `block (2 levels) in start_core'
[Elite Battle: DX] Scene Battle.rb:437:in `pbSceneStandby'
242:Overworld_BattleStarting:512:in `block in start_core'
[v20.1 Hotfixes 1.0.7]
[EBDX v1.4.2 (E20)]
Script error in event 85 (coords 50,3), map 32 (Developer Room)
Exception: NameError
Message: undefined local variable or method `user' for #<Battle::Battler>
***Full script:
TrainerBattle.start(:BIKER,"Test One")
Backtrace:
160:Battle_Battler:252:in `pbSpeed'
150:Battle_ActionAttacksPriority:152:in `block in pbCalculatePriority'
150:Battle_ActionAttacksPriority:147:in `each'
150:Battle_ActionAttacksPriority:147:in `pbCalculatePriority'
151:Battle_ActionSwitching:303:in `pbOnAllBattlersEnteringBattle'
148:Battle_StartAndEnd:312:in `pbStartBattleCore'
148:Battle_StartAndEnd:270:in `pbStartBattle'
242:Overworld_BattleStarting:513:in `block (2 levels) in start_core'
[Elite Battle: DX] Scene Battle.rb:437:in `pbSceneStandby'
242:Overworld_BattleStarting:512:in `block in start_core'
This should be a lot easier to create. I thought it already existed, but apparently not for PE v20.1. The idea is to have an ability that deploys Tailwind, Magnet Rise, Light Screen, or similar effects when the ability user enters battle.
My first attempt at creating this ability was to copy code from another fangame, Pokémon Pathways, for a custom created ability that sets up gravity when the user enters battle:
What I did first while trying to create a Tailwind version of this ability is trim out the "if" branches related to gravity, then change the tag from PBEffects::Gravity to PBEffects::Tailwind.
This one didn't work so I edited the setup a bit to more closely resemble the formatting of other abilities:
When I test this one the text pops up but the effect doesn't activate. It was hard to test so I tried making a nearly identical version with Magnet Rise, which should cause the ability user to temporarily evade ground-type moves:
With this ability, I test it with a double battle where the ally of the ability user which doesn't have an ability that would ignore anything (such as Moldbreaker) uses a ground type attack on the ability user. The text appears upon the ability user entering the field. The ally's ground type attack still hits the supposedly hovering ability user.
Unlike my attempts with the first ability effect that passively boosts ally speed, I think my issue with these abilities that deploy Tailwind or similar effects is something as simple as using correct formatting with the line:
"next if battle.field.effects[PBEffects::Tailwind]>0"
My first attempt at creating this ability was to copy code from another fangame, Pokémon Pathways, for a custom created ability that sets up gravity when the user enters battle:
Ruby:
BattleHandlers::AbilityOnSwitchIn.add(:GRAVITYSURGE,
proc { |ability,battler,battle|
next if battle.field.effects[PBEffects::Gravity]>0
battle.pbShowAbilitySplash(battler)
battler.hasActiveItem?(:GRAVITYEXTENDER) ? battle.field.effects[PBEffects::Gravity] = 8 : battle.field.effects[PBEffects::Gravity] = 5
battle.pbDisplay(_INTL("Gravity intensified!"))
battle.eachBattler do |b|
if b.effects[PBEffects::MagnetRise]>0 || b.effects[PBEffects::Telekinesis]>0 || b.effects[PBEffects::SkyDrop]>=0
b.effects[PBEffects::MagnetRise] = 0
b.effects[PBEffects::Telekinesis] = 0
b.effects[PBEffects::SkyDrop] = -1
end
if b.inTwoTurnAttack?("0C9","0CC","0CE") # Fly/Bounce/Sky Drop
b.effects[PBEffects::TwoTurnAttack] = nil
battle.pbClearChoice(b.index) if !b.movedThisRound?
elsif b.airborne?
battle.pbDisplay(_INTL("{1} couldn't stay airborne because of gravity!", b.pbThis)) if showMessage
end
end
battle.pbHideAbilitySplash(battler)
}
)
Ruby:
BattleHandlers::AbilityOnSwitchIn.add(:COMPANION,
proc { |ability,battler,battle|
next if battle.field.effects[PBEffects::Tailwind]>0
battle.pbShowAbilitySplash(battler)
battle.field.effects[PBEffects::Tailwind] = 5
battle.pbDisplay(_INTL("A wind blows to your back!"))
battle.eachBattler do |b|
end
battle.pbHideAbilitySplash(battler)
}
)
Ruby:
Battle::AbilityEffects::OnSwitchIn.add(:COMPANION,
proc { |ability,battler,battle|
next if battle.field.effects[PBEffects::Tailwind]>0
battle.pbShowAbilitySplash(battler)
battle.field.effects[PBEffects::Tailwind] = 5
battle.pbDisplay(_INTL("A wind blows to your back!"))
battle.eachBattler do |b|
end
battle.pbHideAbilitySplash(battler)
}
)
Ruby:
Battle::AbilityEffects::OnSwitchIn.add(:CONVERGENCE,
proc { |ability,battler,battle|
next if battle.field.effects[PBEffects::MagnetRise]>0
battle.pbShowAbilitySplash(battler)
battle.field.effects[PBEffects::MagnetRise] = 5
battle.pbDisplay(_INTL("Magnetism causes the user to hover!"))
battle.eachBattler do |b|
end
battle.pbHideAbilitySplash(battler)
}
)
Unlike my attempts with the first ability effect that passively boosts ally speed, I think my issue with these abilities that deploy Tailwind or similar effects is something as simple as using correct formatting with the line:
"next if battle.field.effects[PBEffects::Tailwind]>0"