• 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 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

PiaCRT

Orange Dev
940
Posts
13
Years
  • 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.
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    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?
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    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.
     

    PiaCRT

    Orange Dev
    940
    Posts
    13
    Years
  • 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)
    })
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    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.
     

    PiaCRT

    Orange Dev
    940
    Posts
    13
    Years
  • 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.
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    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.
     

    PiaCRT

    Orange Dev
    940
    Posts
    13
    Years
  • 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
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    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
     

    PiaCRT

    Orange Dev
    940
    Posts
    13
    Years
  • Another question, do I need to add a next 2 or something at the end so it isn't consumed? I noticed that on a few of the handlers as well.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    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