• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best places on the 'net to talk Pokémon and more! Community members will not see the bottom screen advertisements.
  • Want to share your adventures playing Pokémon?
    Check out our new Travel Journals forum for sharing playthroughs of ROM Hacks, Fan Games, and other Pokémon content!
  • IMPORTANT: Following a takedown request, the following hacks have been delisted from PokéCommunity:

    • Pokémon Glazed
    • Pokémon: Giratina Strikes Back
    • Pokémon Flora Sky
    • Pokémon Stranded
    The downloads and discussion threads for these hacks will no longer be accessible, and staff will be unable to return questions regarding accessing this content.

[Error] Pokemon Essentials is failing again. Let me know if anyone on the planet knows how to make 3v6 work in this engine.

429
Posts
4
Years
[Pokémon Essentials version 20.1]

Script error in event 5 (coords 26,8), map 3 (Red's house)
Exception: TypeError
Message: nil can't be coerced into Integer

***Full script:
TrainerBattle.start(:YOUNGSTER, "Ben")
Backtrace:
191:Battle_Scene_Menus:489:in `-'
191:Battle_Scene_Menus:489:in `block in initialize'
191:Battle_Scene_Menus:477:in `initialize'
191:Battle_Scene_Menus:477:in `new'
191:Battle_Scene_Menus:477:in `initialize'
188:Scene_Initialize:48:in `new'
188:Scene_Initialize:48:in `pbInitSprites'
221:BugContestBattle:8:in `pbInitSprites'
188:Scene_Initialize:21:in `pbStartBattle'
148:Battle_StartAndEnd:282:in `pbStartBattleCore'


Why is this happening?

Everything

def setBattleMode(mode)
@sideSizes =
case mode
when "triple", "3v3" then [3, 3]
when "3v6" then [3, 6]
when "3v1" then [3, 1]
when "2v3" then [2, 3]
when "double", "2v2" then [2, 2]
when "2v1" then [2, 1]
when "1v3" then [1, 3]
when "1v2" then [1, 2]
else [1, 1] # Single, 1v1 (default)
end
end

seems fine

def pbGetOpposingIndicesInOrder(idxBattler)
case pbSideSize(0)
when 1
case pbSideSize(1)
when 1 # 1v1 single
return [0] if opposes?(idxBattler)
return [1]
when 2 # 1v2
return [0] if opposes?(idxBattler)
return [3, 1]
when 3 # 1v3
return [0] if opposes?(idxBattler)
return [3, 5, 1]
end
when 2
case pbSideSize(1)
when 1 # 2v1
return [0, 2] if opposes?(idxBattler)
return [1]
when 2 # 2v2 double
return [[3, 1], [2, 0], [1, 3], [0, 2]][idxBattler]
when 3 # 2v3
return [[5, 3, 1], [2, 0], [3, 1, 5]][idxBattler] if idxBattler < 3
return [0, 2]
end
when 3
case pbSideSize(1)
when 1 # 3v1
return [2, 0, 4] if opposes?(idxBattler)
return [1]
when 2 # 3v6
return [[8, 6, 4, 2, 0], [7, 5, 3, 1], [6, 4, 2, 0], [5, 3, 1], [4, 2, 0], [3, 1]][idxBattler]
when 3 # 3v3 triple
return [[5, 3, 1], [4, 2, 0], [3, 5, 1], [2, 0, 4], [1, 3, 5], [0, 2, 4]][idxBattler]
end
end
return [idxBattler]
end

to me.

def opposes?(idxBattler1, idxBattler2 = 0)
idxBattler1 = idxBattler1.index if idxBattler1.respond_to?("index")
idxBattler2 = idxBattler2.index if idxBattler2.respond_to?("index")
return (idxBattler1 & 1) != (idxBattler2 & 1)
end

def nearBattlers?(idxBattler1, idxBattler2)
return false if idxBattler1 == idxBattler2
return true if pbSideSize(0) <= 2 && pbSideSize(1) <= 2
# Get all pairs of battler positions that are not close to each other
pairsArray = [[0, 4], [1, 5]] # Covers 3v1 and 1v3
case pbSideSize(0)
when 3
case pbSideSize(1)
when 3 # 3v3 (triple)
pairsArray.push([0, 1])
pairsArray.push([4, 5])
when 2 # 3v2
pairsArray.push([0, 1])
pairsArray.push([3, 4])
end
when 2 # 2v3
pairsArray.push([0, 1])
pairsArray.push([2, 5])
when 6 # 3v6
pairsArray.push([0, 1], [0, 4], [0, 2], [1, 5], [1, 3], [2, 3], [4, 5])
end
# See if any pair matches the two battlers being assessed
pairsArray.each do |pair|
return false if pair.include?(idxBattler1) && pair.include?(idxBattler2)
end
return true
end

def add_battle_rule(rule, var = nil)
rules = self.battle_rules
case rule.to_s.downcase
when "single", "1v1", "1v2", "2v1", "1v3", "3v1",
"double", "2v2", "2v3", "3v6", "triple", "3v3"
rules["size"] = rule.to_s.downcase
when "canlose" then rules["canLose"] = true
when "cannotlose" then rules["canLose"] = false
when "canrun" then rules["canRun"] = true
when "cannotrun" then rules["canRun"] = false
when "roamerflees" then rules["roamerFlees"] = true
when "noexp" then rules["expGain"] = false
when "nomoney" then rules["moneyGain"] = false
when "disablepokeballs" then rules["disablePokeBalls"] = true
when "forcecatchintoparty" then rules["forceCatchIntoParty"] = true
when "switchstyle" then rules["switchStyle"] = true
when "setstyle" then rules["switchStyle"] = false
when "anims" then rules["battleAnims"] = true
when "noanims" then rules["battleAnims"] = false
when "terrain"
rules["defaultTerrain"] = GameData::BattleTerrain.try_get(var)&.id
when "weather"
rules["defaultWeather"] = GameData::BattleWeather.try_get(var)&.id
when "environment", "environ"
rules["environment"] = GameData::Environment.try_get(var)&.id
when "backdrop", "battleback" then rules["backdrop"] = var
when "base" then rules["base"] = var
when "outcome", "outcomevar" then rules["outcomeVar"] = var
when "nopartner" then rules["noPartner"] = true
else
raise _INTL("Battle rule "{1}" does not exist.", rule)
end
end
end
 
Back
Top