• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
Charm Case

Resource Charm Case V1.5

OkunoShio

Cooltrainer
Member
Joined
Oct 22, 2022
Posts
129
Hmmm, there might be something off with the new modifiable "maxCharm" addition, I get this error whenever I want to open the Charm Case (in my existing save file as well as on a new game)

Code:
Expand Collapse Copy
=================

[2023-10-30 16:46:18 +0100]
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Exception: NoMethodError
Message: undefined method `maxCharms' for #<Player Pokémon Trainer Andy @party=[:MAREANIE, :DRIFBLIM, :LARVITAR, :DOLLIV, :BRAIXEN, :CRABOMINABLE]>

Backtrace:
[Charms Case] Charm Case Script.rb:269:in `drawItem'
085:SpriteWindow_text:1129:in `block in refresh'
085:SpriteWindow_text:1127:in `times'
085:SpriteWindow_text:1127:in `refresh'
085:SpriteWindow_text:1056:in `initialize'
[Charms Case] Charm Case Script.rb:219:in `initialize'
[Charms Case] Charm Case Script.rb:377:in `new'
[Charms Case] Charm Case Script.rb:377:in `pbCharmSetupScene'
[Charms Case] Charm Case Script.rb:401:in `pbStartCharmScene'
[Charms Case] Charm Case Script.rb:568:in `pbBuyScreen'
 

drdoom76

Cooltrainer
Member
Joined
Aug 1, 2023
Posts
212
Hmmm, there might be something off with the new modifiable "maxCharm" addition, I get this error whenever I want to open the Charm Case (in my existing save file as well as on a new game)

Code:
Expand Collapse Copy
=================

[2023-10-30 16:46:18 +0100]
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Exception: NoMethodError
Message: undefined method `maxCharms' for #<Player Pokémon Trainer Andy @party=[:MAREANIE, :DRIFBLIM, :LARVITAR, :DOLLIV, :BRAIXEN, :CRABOMINABLE]>

Backtrace:
[Charms Case] Charm Case Script.rb:269:in `drawItem'
085:SpriteWindow_text:1129:in `block in refresh'
085:SpriteWindow_text:1127:in `times'
085:SpriteWindow_text:1127:in `refresh'
085:SpriteWindow_text:1056:in `initialize'
[Charms Case] Charm Case Script.rb:219:in `initialize'
[Charms Case] Charm Case Script.rb:377:in `new'
[Charms Case] Charm Case Script.rb:377:in `pbCharmSetupScene'
[Charms Case] Charm Case Script.rb:401:in `pbStartCharmScene'
[Charms Case] Charm Case Script.rb:568:in `pbBuyScreen'
Re-uploaded. Only a minor change for you.
At the top of the Charm List file, remove the # from attr_accessor :maxCharms.
From
Ruby:
Expand Collapse Copy
class Player
  attr_accessor :charmsActive
  attr_accessor :eleCharmsActive
  attr_accessor :charmlist
  attr_accessor :elementCharmlist
  attr_accessor :last_wish_time
  attr_accessor :link_charm_data
  attr_accessor :ball_for_apricorn
  attr_accessor :next_run
  attr_accessor :activeNature
  #attr_accessor :maxCharms
to
Ruby:
Expand Collapse Copy
class Player
  attr_accessor :charmsActive
  attr_accessor :eleCharmsActive
  attr_accessor :charmlist
  attr_accessor :elementCharmlist
  attr_accessor :last_wish_time
  attr_accessor :link_charm_data
  attr_accessor :ball_for_apricorn
  attr_accessor :next_run
  attr_accessor :activeNature
  attr_accessor :maxCharms
 

drdoom76

Cooltrainer
Member
Joined
Aug 1, 2023
Posts
212
I'm constantly doing 100 things at a time.. Need to slow down a bit. Let me know if you find anything else. Sorry about that. Constantly testing new things out and have 3 different files that I'm tabbing through when making changes.. That edit should fix your problem, though.
 

OkunoShio

Cooltrainer
Member
Joined
Oct 22, 2022
Posts
129
Yeah I just saw that as well and was experimenting with un-commenting it, however it gave me a new error when trying to open the Charm Case ingame :(

Code:
Expand Collapse Copy
=================

[2023-10-30 17:25:33 +0100]
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Exception: ArgumentError
Message: Invalid argument passed to method.
Expected nil to be one of [Symbol, GameData::Item, String], but got NilClass.

Backtrace:
015:Validation:29:in `validate'
103:GameData:92:in `get'
[Charms Case] Charm Case Script.rb:182:in `getName'
[Charms Case] Charm Case Script.rb:186:in `getDisplayName'
[Charms Case] Charm Case Script.rb:208:in `getDisplayName'
[Charms Case] Charm Case Script.rb:282:in `drawItem'
085:SpriteWindow_text:1129:in `block in refresh'
085:SpriteWindow_text:1127:in `times'
085:SpriteWindow_text:1127:in `refresh'
085:SpriteWindow_text:1056:in `initialize'
 

drdoom76

Cooltrainer
Member
Joined
Aug 1, 2023
Posts
212
Yeah I just saw that as well and was experimenting with un-commenting it, however it gave me a new error when trying to open the Charm Case ingame :(

Code:
Expand Collapse Copy
=================

[2023-10-30 17:25:33 +0100]
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Exception: ArgumentError
Message: Invalid argument passed to method.
Expected nil to be one of [Symbol, GameData::Item, String], but got NilClass.

Backtrace:
015:Validation:29:in `validate'
103:GameData:92:in `get'
[Charms Case] Charm Case Script.rb:182:in `getName'
[Charms Case] Charm Case Script.rb:186:in `getDisplayName'
[Charms Case] Charm Case Script.rb:208:in `getDisplayName'
[Charms Case] Charm Case Script.rb:282:in `drawItem'
085:SpriteWindow_text:1129:in `block in refresh'
085:SpriteWindow_text:1127:in `times'
085:SpriteWindow_text:1127:in `refresh'
085:SpriteWindow_text:1056:in `initialize'
Sorry you're having all the issues.. 😅
Try the one i just uploaded, please.
 

Enurta

Rookie
Member
Joined
Dec 30, 2020
Posts
2
Using 21.1

Receive error when attempting to utilize an elemental charm, when no elemental charms have been given to the player. Empty box will appear and due to no input validation you can select to activate nothing. The condition that you had is always true. I have posted the fix and resolved error message below.

Charm Case Script Fix:
Expand Collapse Copy
def pbOpenElementalCharmMenu
  elementalCharmList = $player.elementCharmlist
  if $player.elementCharmlist.length < 1
    pbMessage("You don't have any Elemental Charms.")
    return
  end

  commands = []
  elementalCharmList.each do |charm|
    charm_name = GameData::Item.get(charm).name
    charm_status = activeCharm?(charm) ? "Active" : "Inactive"
    commands.push(_INTL("{1} ({2})", charm_name, charm_status))
  end

  cmd = pbMessage("Choose an Elemental Charm.", commands, -1)
  if cmd >= 0
    selected_charm = elementalCharmList[cmd]
    pbToggleCharm(selected_charm)  # Toggle the charm
    pbMessage(
      _INTL("The {1} was {2}.",
      GameData::Item.get(selected_charm).name,
      (activeCharm?(selected_charm) ? _INTL("activated") : _INTL("deactivated")))
    )
  end
end
end

Error Message:
Expand Collapse Copy
[2023-10-30 18:52:31 -0600]
[Pokémon Essentials version 21.1]
[v21.1 Hotfixes 1.0.3]
[EBDX v1.4.1 (E21)]

Exception: ArgumentError
Message: Invalid argument passed to method.
Expected nil to be one of [Symbol, GameData::Item, String], but got NilClass.

Backtrace:
Validation:29:in `validate'
GameData:100:in `get'
[Charms Case] Charm Case Script.rb:495:in `pbOpenElementalCharmMenu'
[Charms Case] Charm Case Script.rb:450:in `block (2 levels) in pbSelectCharm'
[Charms Case] Charm Case Script.rb:425:in `loop'
[Charms Case] Charm Case Script.rb:425:in `block in pbSelectCharm'
MessageConfig:721:in `pbActivateWindow'
[Charms Case] Charm Case Script.rb:423:in `pbSelectCharm'
[Charms Case] Charm Case Script.rb:515:in `block in pbBuyScreen'
[Charms Case] Charm Case Script.rb:514:in `loop'
 

drdoom76

Cooltrainer
Member
Joined
Aug 1, 2023
Posts
212
Using 21.1

Receive error when attempting to utilize an elemental charm, when no elemental charms have been given to the player. Empty box will appear and due to no input validation you can select to activate nothing. The condition that you had is always true. I have posted the fix and resolved error message below.

Charm Case Script Fix:
Expand Collapse Copy
def pbOpenElementalCharmMenu
  elementalCharmList = $player.elementCharmlist
  if $player.elementCharmlist.length < 1
    pbMessage("You don't have any Elemental Charms.")
    return
  end

  commands = []
  elementalCharmList.each do |charm|
    charm_name = GameData::Item.get(charm).name
    charm_status = activeCharm?(charm) ? "Active" : "Inactive"
    commands.push(_INTL("{1} ({2})", charm_name, charm_status))
  end

  cmd = pbMessage("Choose an Elemental Charm.", commands, -1)
  if cmd >= 0
    selected_charm = elementalCharmList[cmd]
    pbToggleCharm(selected_charm)  # Toggle the charm
    pbMessage(
      _INTL("The {1} was {2}.",
      GameData::Item.get(selected_charm).name,
      (activeCharm?(selected_charm) ? _INTL("activated") : _INTL("deactivated")))
    )
  end
end
end

Error Message:
Expand Collapse Copy
[2023-10-30 18:52:31 -0600]
[Pokémon Essentials version 21.1]
[v21.1 Hotfixes 1.0.3]
[EBDX v1.4.1 (E21)]

Exception: ArgumentError
Message: Invalid argument passed to method.
Expected nil to be one of [Symbol, GameData::Item, String], but got NilClass.

Backtrace:
Validation:29:in `validate'
GameData:100:in `get'
[Charms Case] Charm Case Script.rb:495:in `pbOpenElementalCharmMenu'
[Charms Case] Charm Case Script.rb:450:in `block (2 levels) in pbSelectCharm'
[Charms Case] Charm Case Script.rb:425:in `loop'
[Charms Case] Charm Case Script.rb:425:in `block in pbSelectCharm'
MessageConfig:721:in `pbActivateWindow'
[Charms Case] Charm Case Script.rb:423:in `pbSelectCharm'
[Charms Case] Charm Case Script.rb:515:in `block in pbBuyScreen'
[Charms Case] Charm Case Script.rb:514:in `loop'
Thank you. I didn't notice that error before but I will get it fixed.
 

OkunoShio

Cooltrainer
Member
Joined
Oct 22, 2022
Posts
129
I was toying around a bit with the Link Charm, and received the following error

Code:
Expand Collapse Copy
=================

[2023-11-01 12:18:48 +0100]
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Exception: NoMethodError
Message: undefined method `keys' for []:Array

Backtrace:
[Charms Case] Charm Case Charm Effects.rb:524:in `choose_wild_pokemon'
[Visible Overworld Wild Encounters] 001_visible overworld wild encounters script.rb:379:in `pbSpawnOnStepTaken'
[Max Spawn - Visible Overworld Wild Encounters Add On] 004_add_on_max_spawn.rb:58:in `pbSpawnOnStepTaken'
[Visible Overworld Wild Encounters] 001_visible overworld wild encounters script.rb:349:in `pbOnStepTaken'
[Aggressive Encounters - Overworld Encounters Add On] 001_add_on_aggressive_encounters.rb:164:in `pbOnStepTaken'
047:Game_Player:544:in `update_event_triggering'
047:Game_Player:439:in `update'
032:Scene_Map:161:in `block in update'
032:Scene_Map:159:in `loop'
032:Scene_Map:159:in `update'
r:

Might be a compatibility issue with the Visible Overworld Encounter plugin by derFischae, though.
 

drdoom76

Cooltrainer
Member
Joined
Aug 1, 2023
Posts
212
I'll have to look into that plugin, as I don't use it, but from initial glance it looks like onsteptaken, that plugin modifies spawning which could interfere with the choose_wild_pokemon method mine changes.
 

OkunoShio

Cooltrainer
Member
Joined
Oct 22, 2022
Posts
129
Tested a bit more and removed all the Visible Overworld Encounter stuff, still getting the error:

Code:
Expand Collapse Copy
=================

[2023-11-01 12:28:59 +0100]
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Exception: NoMethodError
Message: undefined method `keys' for []:Array

Backtrace:
[Charms Case] Charm Case Charm Effects.rb:524:in `choose_wild_pokemon'
227:Overworld:207:in `pbBattleOnStepTaken'
227:Overworld:196:in `block in <main>'
035:Event_Handlers:89:in `block in trigger'
035:Event_Handlers:89:in `each_value'
035:Event_Handlers:89:in `trigger'
036:Event_HandlerCollections:63:in `trigger'
047:Game_Player:148:in `turn_generic'
045:Game_Character:796:in `turn_up'
047:Game_Player:460:in `update_command_new'

PS: Don't worry too much about immediately fixing the issues I bring up ;) especially in the case of the Link Charm, I was just curious to test how it works, but not actually planning on using it. However I really appreciate your quick replies and solutions!
 

drdoom76

Cooltrainer
Member
Joined
Aug 1, 2023
Posts
212
Tested a bit more and removed all the Visible Overworld Encounter stuff, still getting the error:

Code:
Expand Collapse Copy
=================

[2023-11-01 12:28:59 +0100]
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Exception: NoMethodError
Message: undefined method `keys' for []:Array

Backtrace:
[Charms Case] Charm Case Charm Effects.rb:524:in `choose_wild_pokemon'
227:Overworld:207:in `pbBattleOnStepTaken'
227:Overworld:196:in `block in <main>'
035:Event_Handlers:89:in `block in trigger'
035:Event_Handlers:89:in `each_value'
035:Event_Handlers:89:in `trigger'
036:Event_HandlerCollections:63:in `trigger'
047:Game_Player:148:in `turn_generic'
045:Game_Character:796:in `turn_up'
047:Game_Player:460:in `update_command_new'

PS: Don't worry too much about immediately fixing the issues I bring up ;) especially in the case of the Link Charm, I was just curious to test how it works, but not actually planning on using it. However I really appreciate your quick replies and solutions!
Thank you for the clarification. I didn't encounter any issues with testing that charm so I didn't catch it.
The idea was a cool idea. If you beat or catch pokemon, encounter rate goes up. If you run from, rate goes down. I added extra shiny chances and chance for better ivs to the idea for a bit more rewarding feel. I thought it'd be useful for min/maxing or shiny hunting. Was a pain to implement though.
I'll try to get a fix out sometime today.
Please continue to let me know if anything else comes up. I'm testing on my v20.1 and a fresh v21.1 so it's hard to really gage whether or not something will pop up in other circumstances.
 

drdoom76

Cooltrainer
Member
Joined
Aug 1, 2023
Posts
212
drdoom76 updated Charm Case with a new update entry:

V1.4!

# V1.4 - Fixed potential issue with Elemental charmlist
# Added Nature Charm - Allows player to select a nature and has a chance to encounter a Pokemon with that nature. (setting)
# Finally added the long awaiting hiding of the "special" charms.
# Wishing Charm, Elemental Charm, and Nature Charm texts are all hidden until player receives them.
# Added image for elemental charm icon.
# Fixed issue where Link Charm would cause on_step issue.
# Fixed max charm text not properly being displayed...

Read the rest of this update entry...
 

ClessioTV

Elite Trainer
Member
Joined
Sep 24, 2022
Posts
270
drdoom76 updated Charm Case with a new update entry:

V1.4!



Read the rest of this update entry...
Hello, following the addition of the new version in my project when loading this happens:
[2023-11-05 19:57:49 +0100]
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Error in Plugin: [Charms Case]
Exception: SyntaxError
Message: [Charms Case] Charm Case Charm Effects.rb:2170: syntax error, unexpected `end', expecting ')'
end
^~~
[Charms Case] Charm Case Charm Effects.rb:2174: class definition in method body
class PokemonPauseMenu
^~~~~~~~~~~~~~~~~~~~~~
[Charms Case] Charm Case Charm Effects.rb:2190: class definition in method body
class SafariBattle
^~~~~~~~~~~~~~~~~~
[Charms Case] Charm Case Charm Effects.rb:2278: class definition in method body
class TriadScreen
^~~~~~~~~~~~~~~~~
[Charms Case] Charm Case Charm Effects.rb:2683: class definition in method body
class KurtEventPage
^~~~~~~~~~~~~~~~~~~
[Charms Case] Charm Case Charm Effects.rb:2838: class definition in method body
class ItemCraft_Scene
^~~~~~~~~~~~~~~~~~~~~
[Charms Case] Charm Case Charm Effects.rb:3036: syntax error, unexpected `end', expecting ')'
end
^~~
[Charms Case] Charm Case Charm Effects.rb:3077: syntax error, unexpected end-of-input, expecting `end'

Backtrace:
Section008:653:in `eval'
Section008:653:in `block (2 levels) in runPlugins'
Section008:643:in `each'
Section008:643:in `block in runPlugins'
Section008:634:in `each'
Section008:634:in `runPlugins'
Section395:28:in `mainFunctionDebug'
Section395:18:in `block in mainFunction'
Section014:80:in `pbCriticalCode'
Section395:18:in `mainFunction'
 

drdoom76

Cooltrainer
Member
Joined
Aug 1, 2023
Posts
212
Hello, I'd like to know if you have a solution for this issue: once I gain access to the Charm Case item, here's what happens when I hover over the HM/TM or any other item usable on Pokémon from the bag (using the plugin: Bag Screen with Interactable Party).

View attachment 22264
This issue should now be fixed. Please let me know if you run into anymore issues.
 
Back
Top