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

Ho-oh 112's Mystery gift system

Ho-oh 112

Advance Scripter
311
Posts
13
Years
    • Seen Mar 8, 2014
    Right, It's been a while SOOOOOOO I gave a new update + re-did my post...

    HOW TO USE:
    make a text file like this (text.txt or something)
    REMEMBER TO USE NEW LINES
    write in it:
    Message (Hello this is a message)
    Type (0 pokemon, 1 egg, 2 item, 3 none)
    Pokemon/item (depends on it)
    level
    form
    shiny (0 normal, 1 shiny, 2 shadow, 3 both)
    move1
    move2
    move3
    move4
    ot (Owner Name)
    id (id CAN'T START WITH 0, 5 numbers long)
    nature
    ability (0, 1, 2 Hidden)
    item (0 for none)
    ribbon (0 for none)
    gender (0 male, 1 female)
    ivs (1 HP, 2 ATK, 3 DEF, 4 SPEED, 5 SPEC. ATK, 6 SPEC. DEF) (0-5) SERPERATE LINES FOR ALL OF THEM!
    varswitch ("Switch" if a switch "Var" or "Variable" if a Variable)
    varswutchnum (number of the switch/var)
    varswitchvalue (var/switch value)
    OK NOW I RECOMEND USING WEBS.COM TO MAKE A SITE FOR YOUR GAME THEN UPLOAD GIFT THERE AS YOU CAN CHANGE TEXT DOCUMENTS WITHOUT REUPLOADING.
    =end
    To load a gift: pbMysteryGift


    Code:
    def pbMysteryGift
      message=nil
      type=nil
      species=nil
      level=nil
      form=nil
      shiny=nil 
      move1=nil 
      move2=nil 
      move3=nil 
      move4=nil 
      ot=nil 
      id=nil 
      nature=nil 
      abillity=nil 
      item=nil 
      ribbon=nil 
      iv1=nil 
      iv2=nil 
      iv3=nil 
      iv4=nil 
      iv5=nil 
      iv6=nil
      switchvar = "Switch" # Var/Variable if it's a variable
      switchvarnum = 50 # switch/var number
      switchvarvalue = false
      #second value: If a var it can be string/number/ or bool switches only bool
      badgecount = 0 # Number of badges needed to get pokemon
    link="[URL]http://rmxpmysterygift.webs.com/Gifts/Gift.txt[/URL]"
    code=pbDownloadToString(link)
    if code == ""
      return false
    end
    file = File.open('text.txt', 'wb'){|f|
    f.write(code)
    }
    array = IO.readlines('text.txt')
    message=array[0]
    type=array[1]
    type = type.to_i + 1 - 1
    if type == 3
      Kernel.pbMessage(_INTL("There are no gifts avaible."))
      return true
    else
      Kernel.pbMessage(_INTL("A gift was found!"))
      if $game_variables[6] == message && $DEBUG == false
      Kernel.pbMessage(_INTL("You already got the gift!"))
      return true
      end
    end
      Kernel.pbMessage(_INTL(message)) # displays custom message
    $game_variables[6] = message # The "detection code"
    switchvar=array[23]
    switchvarvalue=[array[24],array[25]]
    badgecount=array[26]
    badgecount=badgecount.to_i
    pbNextCheck(switchvar,switchvarvalue,badgecount)
    species=array[2]
    species = species.to_i + 1 - 1
    if type == 2
    Kernel.pbReceiveItem(species)
    $game_variables[1] = PBItems.getName(species)
    return true
    end
    if $Trainer.party.length == 6
      Kernel.pbMessage(_INTL("Your party is full!"))
      $game_variables[1] = 0
      return true
    end
      $game_variables[1] = PBSpecies.getName(species)
    if type == 1
      pbGenerateEgg(species)
      $game_variables[1] = "Mystery Egg"
      return true
    end
    level=array[3]
    level = level.to_i + 1 - 1
    form=array[4]
    form = form.to_i + 1 - 1
    shiny=array[5]
    shiny = shiny.to_i + 1 - 1
    move1=array[6]
    move1 = move1.to_i + 1 - 1
    move2=array[7]
    move2 = move2.to_i + 1 - 1
    move3=array[8]
    move3 = move3.to_i + 1 - 1
    move4=array[9]
    move4 = move4.to_i + 1 - 1
    ot=array[10]
    id=array[11]
    id = id.to_i + 1 - 1
    nature=array[12]
    nature = nature.to_i + 1 - 1
    ability=array[13]
    ability = ability.to_i + 1 - 1
    item=array[14]
    item = item.to_i + 1 - 1
    ribbon=array[15]
    ribbon = ribbon.to_i + 1 - 1
    gender=array[16]
    gender = gender.to_i + 1 - 1
    iv1=array[17]
    iv1 = iv1.to_i + 1 - 1
    iv2=array[18]
    iv2 = iv2.to_i + 1 - 1
    iv3=array[19]
    iv3 = iv3.to_i + 1 - 1
    iv4=array[20]
    iv4 = iv4.to_i + 1 - 1
    iv5=array[21]
    iv5 = iv5.to_i + 1 - 1
    iv6=array[22]
    iv6 = iv6.to_i + 1 - 1
    iv = [iv1, iv2, iv3, iv4, iv5, iv6]
    moves=[move1, move2, move3, move4]
    # Checks badge count if it's more than 0 if not it ignores this...
    if badgecount > 0
      if $Trainer.badges[badgecount] != true
        Kernel.pbMessage(_INTL("You do not have enough badges to get this gift. badges required: {1}", badgecount))
        return
      end
    end
    if switchvar == "Switch"
      $game_switches[switchvarvalue[0]] = switchvarvalue[1]
    elsif switchvar == "Variable" or switchvar == "Var"
      $game_variables[switchvarvalue[0]] = switchvarvalue[1]
    end
    if species == nil
      return false
    end
    if level == nil
      return false
    end
    gift = PokeBattle_Pokemon.new(species,level)
    gift.trainerID = id
    gift.ot = ot
    gift.form = form
    gift.ballused = pbGetBallType(:CHERISHBALL) # All Pokemon are in these.
    if shiny == 1
      gift.makeShiny
    elsif shiny == 2
      gift.makeShadow
    elsif shiny == 3
      gift.makeShiny
      gift.makeShadow
    end
    if ribbon > 0
      gift.setRibbon(ribbon)
    end
    if item > 0
      gift.item = item
    end
    gift.setNature(nature)
    gift.abilityflag=ability
    # Teaches moves
    for i in 0..3
      gift.moves[i]=PBMove.new(moves[i])
    end
    pbAddToPartySilent(gift)
    pbSave
    rescue
    Kernel.pbMessage(_INTL("The gift is corrupted"))
    return
    end
     
    def pbNextCheck(var1,var2,badge)
    # Checks badge count if it's more than 0 if not it ignores this...
    if badge > 0
      if $Trainer.badges[badge] != true
        Kernel.pbMessage(_INTL("You do not have enough badges to get this gift. badges required: {1}", badgecount))
        return
      end
    end
    if var1 == "Switch"
      var2[1].to_b
      $game_switches[var2[0]] = var2[1]
    elsif var1 == "Variable" or var1 == "Var"
      $game_variables[var2[0]] = var2[1]
    end
    end

    Whats New:
    Removed the mySql thing because it didn't work....
    Added badge counter (not tested but should work)
    Added Var/Switch setting (not tested....)

    Todo:
    None as of now

    Bugs:
    None as of now
     
    Last edited:

    Ho-oh 112

    Advance Scripter
    311
    Posts
    13
    Years
    • Seen Mar 8, 2014
    Currently Testing Code

    Right, I'm currently test this code.
    Code:
    @@+4605TetHello1000000=@@
     
    Last edited:

    Pharetra

    zzzz
    451
    Posts
    12
    Years
    • Seen Apr 22, 2024
    Heh, this is going to make the DLC in my game so much easier :3
    Small question though, what am I supposed to put in the Gifts folder and in Gifts.txt?

    Excuse me, I am not an experienced scripter (yet).
     

    Ho-oh 112

    Advance Scripter
    311
    Posts
    13
    Years
    • Seen Mar 8, 2014
    Heh, this is going to make the DLC in my game so much easier :3
    Small question though, what am I supposed to put in the Gifts folder and in Gifts.txt?

    Excuse me, I am not an experienced scripter (yet).


    Auto creates it for you, you just make the gifts folder in project.
     

    Ho-oh 112

    Advance Scripter
    311
    Posts
    13
    Years
    • Seen Mar 8, 2014
    I actually meant the gift the player obtains, the Pokémon.


    open an event, look for something called "script" write: pbWriteGift

    activate event and follow steps.

    to load the event

    open an event, look for something called "script" write: pbLoadMGift

    activate event and test it.

    MAKE SURE TO HAVE PLACED THE SCRIPT INTO THE SCRIPT EDITOR.
     

    Pharetra

    zzzz
    451
    Posts
    12
    Years
    • Seen Apr 22, 2024
    open an event, look for something called "script" write: pbWriteGift

    activate event and follow steps.

    to load the event

    open an event, look for something called "script" write: pbLoadMGift

    activate event and test it.

    MAKE SURE TO HAVE PLACED THE SCRIPT INTO THE SCRIPT EDITOR.

    I think you've misunderstood me and thought I am completely new to RMXP. I wanted to know how to create the Pokemon the player obtains, the gift. I have figured it out by myself now. I am not used to the way this script works, it is completely different from most scripts I've seen. This doesn't make it a bad script though, it's pretty good for what I've seen as of now.
     

    Ho-oh 112

    Advance Scripter
    311
    Posts
    13
    Years
    • Seen Mar 8, 2014
    I think you've misunderstood me and thought I am completely new to RMXP. I wanted to know how to create the Pokemon the player obtains, the gift. I have figured it out by myself now. I am not used to the way this script works, it is completely different from most scripts I've seen. This doesn't make it a bad script though, it's pretty good for what I've seen as of now.


    I then have no idea what you mean by "create the Pokemon" because I thought you meant create the gift or loading it... anyways good thing you figured it out.
     

    Pharetra

    zzzz
    451
    Posts
    12
    Years
    • Seen Apr 22, 2024
    I love this new update, it's great. It all works well, except for the items and the eggs. When I set a gift's type to 1 or 2, it keeps giving me the Pokémon I'd get when type was set to 0. It's like the Type field is completely ignored. If you want the text file of the Item:
    Spoiler:

    I don't think they work yet, but that aside, this is a fantastic script. I'm definitely using this.
     

    Ho-oh 112

    Advance Scripter
    311
    Posts
    13
    Years
    • Seen Mar 8, 2014
    I love this new update, it's great. It all works well, except for the items and the eggs. When I set a gift's type to 1 or 2, it keeps giving me the Pokémon I'd get when type was set to 0. It's like the Type field is completely ignored. If you want the text file of the Item:
    Spoiler:

    I don't think they work yet, but that aside, this is a fantastic script. I'm definitely using this.


    Fixed (I think)
    added:
    type = type.to_i + 1 - 1

    which will change it to an integer...
     

    Pharetra

    zzzz
    451
    Posts
    12
    Years
    • Seen Apr 22, 2024
    Fixed (I think)
    added:
    type = type.to_i + 1 - 1

    which will change it to an integer...
    Ok, it works. I am able to obtain multiple copies of the item and the egg though, so you might want to fix that ;)
     

    Ho-oh 112

    Advance Scripter
    311
    Posts
    13
    Years
    • Seen Mar 8, 2014
    Ok, ummmmm easy, where it says pbReceiveItem put this down:
    $game_variables[6] == message

    Ok, it works. I am able to obtain multiple copies of the item and the egg though, so you might want to fix that ;)



    Alright, fixed... (I can't believe I missed SO MANY ERRORS!!!!)
     
    Last edited:

    Pharetra

    zzzz
    451
    Posts
    12
    Years
    • Seen Apr 22, 2024
    I've found a new problem, the script keeps telling me the gift is corrupt while it isn't. I've used the gift.txt I've used succesfully a few days ago, before your last update, and your own gift.txt . None of them work.
     

    Ho-oh 112

    Advance Scripter
    311
    Posts
    13
    Years
    • Seen Mar 8, 2014
    Really, were you connected to the internet?

    Works fine for me....

    EDIT: I saw your problem, my post tried putting everything on 1 line.....
     
    Last edited:

    Nyndyll

    PD : O Creator
    34
    Posts
    12
    Years
    • Seen Apr 10, 2014
    k, i'm having trouble myself...
    like P-Sign i cant get this script to work...
    can you just give me a full out tutorial???
     
    Back
    Top