• 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's Award System

Ho-oh 112

Advance Scripter
311
Posts
13
Years
    • Seen Mar 8, 2014
    Intro: Just another script I made....

    Version: 1.0

    Features:
    Saves the award data (see the tutorial for it to work)
    Allows array to string conversion
    Allows String to array conversion (in progress)
    Allows online award downloads (in progress)
    Allows writing a string version of an award to a file (doesn't overwrite older awards you converted it just adds)
    Allows for simple and semi-flexible award/completion types

    Notice: THE DOWNLOAD AWARDS WON'T WORK YET I NEED TO FINISH THE STRING TO ARRAY AND TEST OUT THE DOWNLOAD...

    Code:
    =begin
    functions:
    pbSetAward(award id) - Sets an award and gives you the prize
    pbResetAwards - Resets the rewards to default...
    pbCheckForAwards - ONLINE, downloads new awards and saves them
    pbCompileAward - Compiles an Award from $PokemonGlobal.Awards
    pbDisplayAwards - Displays a selected award from $PokemonGlobal.Awards(used wuth pbGetAwards)
    pbGetAwards - Shows a list of all Awards in $PokemonGlobal.Awards
    pbAwardCheck - Checks to see if an award is completed with the values if true it goes to pbSetAward
    =end
    
    =begin
    Awards Example: $PokemonGlobal.push(["Award Name","Award Discription","Award Type", "Award Value", unlocked(leave as false), Requirements To Check,Requirements Value,Compare])
    Award Name: Name of Award
    Award Discription: Discription of the award
    Award Type: Type of Award (Switch,Variable/Var,Pokemon,Egg,Item,Money)
    Switches: ["Switch",switchnum], Variables: ["Variable or Var",varnum], Pokemon: "Pokemon", Egg: "Egg", Item: "Item", Money: "Money"
    Award Value: Value of award: Switch true/false, Var/Variable anything, Pokemon [Pokemon,level], Egg: Species, Item: Item name, Money: Amount
    Award Unlocked: LEAVE AT FALSE IT WILL GO TRUE WHEN COMPLETED
    Award Requirements: Requirements to complete: Switch: Switch, Variable: Var/Variable,
    Pokedex Seen Entry: dexSeen, Pokedex Owned Entry: dexOwned, badges: badge
    Award Requirement Value: Switch: true/false Var/Variable: anything, Pokedex Seen: number(looks for greater than-equal),
    Pokedex Owned: number (searches for greater than-equal), badge: number looks to see if that specific badge is true
    Award Compare: Variables only this is used with: greater, less, equal, not each doing what should do (greater searchs with > ect.)
    NOTE: THESE DISCRIPTIONS ARE IN ORDER FOR THE AWARDS TO BE INPUTED WITH.
    =end
    
    def pbStartupAwards
    viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
      viewport.z=99999
      sprites={}
      commands=CommandList.new
      commands.add("check",_INTL("Check for new awards"))
      commands.add("list",_INTL("Award List"))
      commands.add("search",_INTL("Search for new Awards (Online)"))
      commands.add("compile",_INTL("Compile existing Award DEBUG ONLY")) if $DEBUG
      sprites["cmdwindow"]=Window_CommandPokemonEx.new(commands.list)
      cmdwindow=sprites["cmdwindow"]
      cmdwindow.viewport=viewport
      cmdwindow.resizeToFit(cmdwindow.commands)
      cmdwindow.height=Graphics.height if cmdwindow.height>Graphics.height
      cmdwindow.x=0
      cmdwindow.y=0
      cmdwindow.visible=true
      pbFadeInAndShow(sprites)
      ret=-1
          loop do
        loop do
          cmdwindow.update
          Graphics.update
          Input.update
          if Input.trigger?(Input::B)
            ret=-1
            break
            return ret
          end
          if Input.trigger?(Input::C)
            ret=cmdwindow.index
            break
          end
        end
        break if ret==-1
        cmd=commands.getCommand(ret)
        if cmd == "check"
          pbAwardCheck
        elsif cmd == "list"
          pbDisplayAwards
        elsif cmd == "search"
          pbCheckForAwards
        elsif cmd == "compile"
          pbCompileAward
        end
      end
      return if ret < 1
    end
    
    def pbSetAward(id)
      award=$PokemonGlobal.Awards[id]
      return if award[4] == true # if you got it already
      Kernel.pbMessage(_INTL("You have completed {1}!",award[0]))
      if award[2] == "Switch"
        Kernel.pbMessage(_INTL("You have received a mystery award! Search to find what has been unlocked!"))
        $game_switches[award[3][0]] = award[3][1]
        $game_map.refresh
      end
      if award[2] == "Pokemon"
        pbAddPokemon(award[3][0],award[3][1])
      end
      if award[2] == "Money"
        Kernel.pbMessage(_INTL("You got ${1}",award[3]))
        $Trainer.money+=award[3]
      end
      if award[2] == "Item"
        pbReceiveItem(award[3][0],award[3][1])
      end
      if award[2] == "Egg"
        if $Trainer.party.length == 6
          Kernel.pbMessage(_INTL("Your party is full!"))
          return
        end
        pbGenerateEgg(award[3])
      end
      if award[2] == "Var" or award[2] == "Variable"
        Kernel.pbMessage(_INTL("You have received a mystery award! Search to find what has been unlocked!"))
        $game_variables[award[3][0]] == award[3][1]
        $game_map.refresh
      end
      $PokemonGlobal.Awards[id][4]=true
    end
    
    def pbCheckForAwards
      new=false
      url="http://www.linkhere.com/DLC/awards.txt"
      string=pbDownloadToString(url)
      x=false
      x=true if string == ""
      awards=string.split("/,,/")
      for i in $PokemonGlobal.Awards
        break if x == true
        for j in awards
          break if x == true
          if i != j
            # Displays A new award has been found, the name, and discription
            Kernel.pbMessage(_INTL("A new award has been found! {1}: {2}",i[0],i[1]))
            $PokemonGlobal.Awards.push(i)
            new=true
          end
        end
      end
      if new == false
        Kernel.pbMessage(_INTL("There are no new awards...."))
      end
    end
    
    def pbStringIt(ary,ary2=nil)
      ret = ""
      sub = ""
      for i in ary
        if i.is_a?(Array)
          for j in i
            sub="#{sub},,#{j}" if sub != ""
            sub="#{j}" if sub == ""
          end
          ret="#{ret},,,#{sub}"
          sub=""
        else
          ret="#{ret},,,#{i}" if ret != ""
          ret="#{i}" if ret == ""
        end
      end
      return ret if ary2 == nil
      ret="#{ret}/,,/"
      for i in ary2
        if i.is_a?(Array)
          for j in i
            sub="#{sub},,#{j}" if sub != ""
            sub="#{j}" if sub == ""
          end
          ret="#{ret},,,#{sub}"
          sub=""
        else
          ret="#{ret},,,#{i}" if ret != "#{ary}/,,/"
          ret="#{ret}#{i}" if ret == "#{ary}/,,/"
        end
      end
      return ret
    end
    
    def pbArrayIt(string)
      return string.split(",,,")
    end
    
    def pbCompileAward
      cmp=pbGetAwards
      compile=pbStringIt($PokemonGlobal.Awards[cmp])
      if FileTest.exist?('CompiledAwards.txt')
        File.open('CompiledAwards.txt'){|f|
        codes=f.read
        compile=pbStringIt(codes,compile) if codes != ""
        }
      end
      File.open('CompiledAwards.txt','wb'){|f|
      f.write(compile)
      }
      print "Your code has been saved in 'CompiledAwards.txt'"
    end
    
    def pbDisplayAwards
      # Note: You must add your own Awards to pokemon global!
      slct=pbGetAwards
      return if slct == -1
      award=$PokemonGlobal.Awards[slct]
      if award[4] == true
        got = "Unlocked"
      else
        got = "Locked"
      end
      # Displays differently because money has a different type of award type...
      if award[2] == "Money"
        Kernel.pbMessage(_INTL("{1}: {2}, Award: {3}, {4}",award[0],award[1],award[3],got)) 
      elsif award[2] == "Pokemon"
        Kernel.pbMessage(_INTL("{1}: {2}, Award: {3}, {4}",award[0],award[1],PBSpecies.getName(award[3][0]),got))
      elsif award[2] == "Switch" or award[2] == "Var" or award[2] == "Variable"
        Kernel.pbMessage(_INTL("{1}: {2}, Award: ???, {3}",award[0],award[1],got))
      else
        Kernel.pbMessage(_INTL("{1}: {2}, Award: {3}, {4}",award[0],award[1],award[3][1],got))
      end
    end
      
    def pbGetAwards
      default=1
      cmdwin=pbListWindow([],200)
      commands=[]
      for i in 1..$PokemonGlobal.Awards.length
        commands.push(_ISPRINTF("{1:s}",$PokemonGlobal.Awards[i-1][0]))
      end
      ret=pbCommands2(cmdwin,commands,-1,default-1,true) 
      cmdwin.dispose
      return ret
    end
    
    def pbAwardCheck
      for j in 0..$PokemonGlobal.Awards.length-1
        i=$PokemonGlobal.Awards[j]
        return if i == nil
        if i[5][0] == "Switch"
          if $game_switches[i[5][1]] == i[6]
            pbSetAward(j)
          end
        end
        if i[5][0] == "Var" or i[5][0] == "Variable"
          i[7] = "equal" if i[7]==nil 
          if i[7] == "equal"
            if $game_variables[i[5][1]] == i[6]
              pbSetAward(j)
            end
          end
          if i[7] == "greater"
            if $game_variables[i[5][1]] > i[6]
              pbSetAward(j)
            end
          end
          if i[7] == "less"
            if $game_variables[i[5][1]] < i[6]
              pbSetAward(j)
            end
          end
          if i[8] == "not"
            if $game_variables[i[5][1]] != i[6]
              pbSetAward(j)
            end
          end
        end
        if i[5] == "badge"
          if $Trainer.badges[i[6]] == true
            pbSetAward(j)
          end
        end
        if i[5] == "dexSeen"
          if $Trainer.pokedexSeen >= i[6]
            pbSetAward(j)
          end
        end
        if i[5] == "dexOwned"
          if $Trainer.pokedexOwned >= i[6]
            pbSetAward(j)
          end
        end
      end
    end

    Tutorial for getting the Pokemon Global Awards:

    1. Open pokemon map and look for this:
    tutimage1.png

    add the highlighted line

    2. go here in pokemon map:
    scaled.php

    again add the highlighted at the least add the @Awards=[]

    3. to safely insert new awards use the .push(award array here) way (last highlighted line on image2) this way you can't overwrite another award...

    4. have fun with it IT WAS TESTED!!!
     

    Ho-oh 112

    Advance Scripter
    311
    Posts
    13
    Years
    • Seen Mar 8, 2014
    Wow. Seems like a nice script. You are a very good scripter Ho-oh! Trying this out now!


    Thanks but this is incomplete as of online downloads of awards, I'll get to this a little later because I got to "fix" my trade script
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    So what can this do then?

    if I put:

    @Awards.push...

    These will be the only awards available to the player, until you are able to get awards loaded from a web page thing to work, correct?

    Because I don't mind the "having internet" part, not implemented... I've got my own Awards, within my game, just yet to actually put them in... This could help alot! But If this already works, I would use this... If it's more for downloading the awards, I probably won't use it in that case, but good luck with that. X
     

    SytheXP

    Net Labs/UG Founder
    387
    Posts
    16
    Years
  • I actually like the idea of this script a lot. Is there a way to view awards or add images for the awards? Kind of like Achievements from xbox360 games or trophies for the ps3
     

    Ho-oh 112

    Advance Scripter
    311
    Posts
    13
    Years
    • Seen Mar 8, 2014
    I actually like the idea of this script a lot. Is there a way to view awards or add images for the awards? Kind of like Achievements from xbox360 games or trophies for the ps3

    Yeah this is a demo release of it I'll add picture support Also You can view awards use the Award Startup function it shows a list of commands you can use...
     
    42
    Posts
    13
    Years
  • Isn't it the best to post the Second screenshot's code in the post?
    Like now, it seems incomplete to me... :/
    But this does looks nice, reminds me about Valve Steam's Achievement system :P
     

    Cilerba

    the hearts of lonely people
    1,162
    Posts
    14
    Years
  • This thread's a little over two months old so I'll have to lock this. Please remember to keep the rules in mind when posting in these forums.
     
    247
    Posts
    10
    Years
  • You are great Ho-oh this is my favourite script!!!
    But i have a problem...someone can tell me how can i use it? sorry but i am not good with the script...thank you friends :)
     
    Back
    Top