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

[Custom Feature Question] Help needed with creating a new Item(s)

3
Posts
3
Years
    • Seen Apr 28, 2021
    So I guess you all know that every generation since gen 6 has a "gimmick" like megas or dynamax, and i'm trying to make my own with no avail so far. Basically, i'm trying to create an item that changes the secondary type of the user depending on the type of item (there would be 18 different items, kinda like Arceus plates)

    The only problem is, I don't have a single clue on how to do this, and that's why i'm seeking help.

    A couple things to note if someone were to attempt a code for this; giving this item to hold to a single type pokemon with the same type as the item should not fail, but should do nothing. As for dual type pokemon, giving them an item with one of their type would make them single typed (if that makes sense)(eg. Water Item on a Sharpedo gets rid of the dark type). It would also be nice if there was a message at the start of the battle, who warns your opponent that your type is changed.

    A thousand thanks to anyone willing to help me with this project. Feel free to ask any question, I'll try to answer them the best I can :)
     

    StCooler

    Mayst thou thy peace discover.
    9,301
    Posts
    4
    Years
    • Seen yesterday
    I will assume that you are interested in changing the second type only in battles. This will make it easier and, I believe, safer.

    So basically type2 is an attribute of the class PokeBattle_Battler. Ruby allows you to define a accessor function. By default, if not written, it will do something like this:
    Code:
    def type2
      return @type2
    end
    (It doesn't appear in Essentials though).
    Now, you want to change how this function behaves, depending on your item. I suggest you check Arceus' multiform code, the part that starts with:
    Code:
    MultipleForms.register(:ARCEUS,{
    It defines a dictionary, and it runs a loop over that dictionary, so that it gets the number of the form depending on the item. You should mimic this, so that you get the new type of the Pokémon, depending on their item.

    Try this, and when you're done, I'll tell you how to optimise it.
     
    3
    Posts
    3
    Years
    • Seen Apr 28, 2021
    The thing is, I'm sure this is a great explanation for someone that is familiar with coding, but the thing is, I have no idea where to start, litteraly. I don't even know where I should input my "code" for it to work. I know this is not the place to ask for a full course on how to code, but I'm genuinely lost. So i'm asking any kind soul for a sketch of a code I could start working on and polishing. And again, a thousand thanks to you StCooler for the pointers, I hope I'll be able to use them down the line :)
     

    JulyArt

    New Developer
    70
    Posts
    3
    Years
    • Seen Dec 17, 2021
    It's going to be slightly different due to type not coming from PKMN form, rather from assigning attr_accessor/variable

    https://essentialsdocs.fandom.com/wiki/Defining_an_item

    This is one way to do it per se. Logic flow wise.

    Code:
    #Array to keep all 'plates' in. Corresponding 'index' number to type array that's coming up next.
    ItemAndTypeArray = [
    FireItemName,
    WaterItemName,
    GrassItemName,
    etc
    ]
    
    #Type array, correspond to previous array.
    TypeArray = [Fire, Water, Grass, etc]
    
    
    #Check if PKMN is holding 'plate' item somewhere at beginning of battle script.
    
    def CheckCustomPlate(_target)
        type = ItemAndTypeArray.index (_target.helditem)
        if type != nil
             _target.type2 = TypeArray[type]
             pbDisplay("#{_target.helditem} has changed #{_target.name}'s secondary type to #TypeArray[type]")
       end
    end
     
    Last edited:
    1,406
    Posts
    10
    Years
    • Seen today
    The thing is, I'm sure this is a great explanation for someone that is familiar with coding, but the thing is, I have no idea where to start, litteraly. I don't even know where I should input my "code" for it to work. I know this is not the place to ask for a full course on how to code, but I'm genuinely lost. So i'm asking any kind soul for a sketch of a code I could start working on and polishing. And again, a thousand thanks to you StCooler for the pointers, I hope I'll be able to use them down the line :)

    The best coding examples are in Essentials itself. Chances are, if you have an idea for something, there's already something you can find in the script that would provide a solid starting point. Hardly anybody is THAT original that their idea is something never before seen in some form.

    For your type idea, theres already a plethora of mechanics in the Pokemon series itself that do this sort of thing, in some way. The Arceus code that StCooler mentioned is a good example of this. Start off small, and build your way up. Instead of thinking of this as a universal new gimmick, try making ONE item that will change the type of ONE Pokemon into ONE type. If you can figure out something that doesnt consistently crash and burn, youve got no where to go but up.
     
    3
    Posts
    3
    Years
    • Seen Apr 28, 2021
    Thanks for all your responses, I think this is putting me on the right path! I will add to this thread if the final code works, hopefully I'll be able to share it with everyone here. Thanks again!
     
    Back
    Top