Ho-oh 112
Advance Scripter
- 311
- Posts
- 14
- 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...
Tutorial for getting the Pokemon Global Awards:
1. Open pokemon map and look for this:
add the highlighted line
2. go here in pokemon map:
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!!!
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="https://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:
![[PokeCommunity.com] Ho-oh's Award System [PokeCommunity.com] Ho-oh's Award System](https://img69.imageshack.us/img69/9510/tutimage1.png)
add the highlighted line
2. go here in pokemon map:
![[PokeCommunity.com] Ho-oh's Award System [PokeCommunity.com] Ho-oh's Award System](https://desmond.imageshack.us/Himg849/scaled.php?server=849&filename=tutimage2.png&res=medium)
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!!!