• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Adding an item that changes player ID

Hello, I am working on an online project and I want admins to have their own trainer skins. I figure an effective way of doing this is by either adding a debug item or an item that changes the player ID (Player A, B, etc.). Say I added a new item called "ADMINDOTE" on a hypothetical ID of 800, how would I make it function so that it changes the player id to, say, ID "H"?

If anyone has done something similar and could share, that would be great. I can't find the code relating to the defining of the player's ID except for the backsprite.
 
So are you editing Essentials? Because I wouldn't of thought this belonged here... Why don't you just use their name instead of an ID?
 
You know that a player's trainer type and appearance are set when they choose a gender, right? That means the script that does this is in Oak's lecture. It's def pbChangePlayer.

I don't know how you're dealing with multiple players in the same world, so saying anything further may well be inaccurate. Have a look at the method and see what it does.
 
You know that a player's trainer type and appearance are set when they choose a gender, right? That means the script that does this is in Oak's lecture. It's def pbChangePlayer.

I don't know how you're dealing with multiple players in the same world, so saying anything further may well be inaccurate. Have a look at the method and see what it does.

Players are defined individually, so it will function like a normal game.

This is what I've done, in a new script above main:
ItemHandlers::UseFromBag.add(:ADMINSKIN,proc{|item|
next pbChangePlayer(0)
})
 
Does that script work?
Cause I can't imagine it does... You'll need to call it, or at least check if the item is owned... I don't think we can help fully without more details... As Maruno already said, anything we suggest could be widely inaccurate.
 
I'm looking at how items like how the Bike is handled, and I figure it should work :s

The game is no different from Essentials 11, you may treat it as such. I'm just trying to make an item that changes the player id.

I cannot test it yet because my server is not up yet. I can, however, test it in a fresh copy of essentials.
 
So you want the admin to have the skin once the item is clicked... Oh okay, I was under the impression you wanted it to automatically work, nevermind.
 
Yeah, after working this out I figure I could get other items to work for non-admins as well. To get it to work automatically is kind of pointless as there are only a couple of admins anyway :s
 
I see, but what you could do, is start the game, find their ID, then edit the script to use their specific ID's ;) just a suggestion
 
If it's a UseFromBag handler, then it should "next" a number depending on how the item was used or not.

0 or something else = item wasn't used.
1 = item was used.
2 = close the Bag and then try the item's UseInField handler.
3 = 1 plus consume the item
4 = 2 plus consume the item
 
Back
Top