Other Pickup Messages after battle?

This thread does not pertain to a related version of Pokémon Essentials.

BiggusWeeabus

"What's so funny about Biggus Dickus?"
Member
Joined
Sep 1, 2020
Posts
20
Age
19
So, there's a mod for Reborn and Rejuvenation that changes the behavior of the ability Pickup to show a message whenever your Pokémon picks up an item and then automatically stores it in the bag.
This is a great QoL feature that i want to implement in my own game, but i need to know how and where to modify the ability.

Thank you in advance :)
 

NettoHikari

Trainer
Member
Joined
Jan 4, 2019
Posts
97
Look in script section PField_Battles, under the function "def pbPickup(pkmn)". The line where the Pokemon actually gains an item is this:
Ruby:
pkmn.setItem(items[i])
So you can edit this line to instead store the item in the Bag and display a message, like so:
Ruby:
$PokemonBag.pbStoreItem(items[i])
pbMessage(_INTL("{1} found a {2}!", pkmn.name, PBItems.getName(items[i])))
 

BiggusWeeabus

"What's so funny about Biggus Dickus?"
Member
Joined
Sep 1, 2020
Posts
20
Age
19
Look in script section PField_Battles, under the function "def pbPickup(pkmn)". The line where the Pokemon actually gains an item is this:
Ruby:
pkmn.setItem(items[i])
So you can edit this line to instead store the item in the Bag and display a message, like so:
Ruby:
$PokemonBag.pbStoreItem(items[i])
pbMessage(_INTL("{1} found a {2}!", pkmn.name, PBItems.getName(items[i])))
Thank you for the Reply!
 

BiggusWeeabus

"What's so funny about Biggus Dickus?"
Member
Joined
Sep 1, 2020
Posts
20
Age
19
Look in script section PField_Battles, under the function "def pbPickup(pkmn)". The line where the Pokemon actually gains an item is this:
Ruby:
pkmn.setItem(items[i])
So you can edit this line to instead store the item in the Bag and display a message, like so:
Ruby:
$PokemonBag.pbStoreItem(items[i])
pbMessage(_INTL("{1} found a {2}!", pkmn.name, PBItems.getName(items[i])))
I get this error whenever the ability is triggered:


---------------------------
Pokemon Immortal X/Oblivion Y
---------------------------
[Pokémon Essentials version 17.2]

Exception: NameError

Message: undefined local variable or method `pkmn' for Kernel:Module

PField_Battles:519:in `pbPickup'

PField_Battles:515:in `each'

PField_Battles:515:in `pbPickup'

PField_Battles:420

PField_Battles:419:in `each'

PField_Battles:419

PField_Battles:409:in `call'

EventHandlers:54:in `trigger'

EventHandlers:49:in `each'

EventHandlers:49:in `trigger'



This exception was logged in

C:\Users\Darci\Saved Games\Pokemon Immortal X_Oblivion Y\errorlog.txt.

Press Ctrl+C to copy this message to the clipboard.
---------------------------
OK
---------------------------
 

NettoHikari

Trainer
Member
Joined
Jan 4, 2019
Posts
97
I get this error whenever the ability is triggered:


---------------------------
Pokemon Immortal X/Oblivion Y
---------------------------
[Pokémon Essentials version 17.2]

Exception: NameError

Message: undefined local variable or method `pkmn' for Kernel:Module

PField_Battles:519:in `pbPickup'

PField_Battles:515:in `each'

PField_Battles:515:in `pbPickup'

PField_Battles:420

PField_Battles:419:in `each'

PField_Battles:419

PField_Battles:409:in `call'

EventHandlers:54:in `trigger'

EventHandlers:49:in `each'

EventHandlers:49:in `trigger'



This exception was logged in

C:\Users\Darci\Saved Games\Pokemon Immortal X_Oblivion Y\errorlog.txt.

Press Ctrl+C to copy this message to the clipboard.
---------------------------
OK
---------------------------
Oh sorry, I didn't know you were on v17.2, the code I wrote above is for v18. In that case, the variable name is actually "pokemon" instead of "pkmn". So the code you actually need to replace is:
Ruby:
pokemon.setItem(items[i])
and the code you need to replace it with is:
Ruby:
$PokemonBag.pbStoreItem(items[i])
Kernel.pbMessage(_INTL("{1} found a {2}!", pokemon.name, PBItems.getName(items[i])))
 

BiggusWeeabus

"What's so funny about Biggus Dickus?"
Member
Joined
Sep 1, 2020
Posts
20
Age
19
Oh sorry, I didn't know you were on v17.2, the code I wrote above is for v18. In that case, the variable name is actually "pokemon" instead of "pkmn". So the code you actually need to replace is:
Ruby:
pokemon.setItem(items[i])
and the code you need to replace it with is:
Ruby:
$PokemonBag.pbStoreItem(items[i])
Kernel.pbMessage(_INTL("{1} found a {2}!", pokemon.name, PBItems.getName(items[i])))
Oh right, i really could've figured out this myself, haha 😅.
Thank you Again!
 
Top