< >
Hello, guest! Please log in or register.

The PokéCommunity

Go Back     The PokéCommunity Forums > Create & Discover > Game Development > Pokémon Essentials Question Returning the base stats of a mon?

Notices

Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.

Reply Post Reply
 
Thread Tools
  #1    
Old August 8th, 2015 (12:29 PM).
Krigeris Krigeris is offline
 
Join Date: Aug 2015
Posts: 6
Hi, I'm using someone elses script which randomly generates pokemon in each instance you are going to battle one. I'm attempting to set it up in a way where the pokemon are in separate tiers based on base stats.

species = rand(PBSpecies.maxValue - 1) + 1
bs = PBSpecies::species.baseStats <-- this line is incorrect, but I have no idea what syntax or methods I should use
for i in 0..5
baseStatTotal += bs[i]
end

I'm attempting to store the base stats of the randomly generated "species" into "bs" and then add them up in the loop but I'm crashing on use. What exactly should I write in for " bs = PBSpecies::species.baseStats" to get the base stats into "bs"
Reply With Quote

Relevant Advertising!

  #2    
Old August 8th, 2015 (6:22 PM).
Rot8er_ConeX's Avatar
Rot8er_ConeX Rot8er_ConeX is offline
 
Join Date: May 2015
Location: The Dissa Region
Gender: Male
Posts: 596
Code:
  def getBaseStatTotal(species)
    dexdata=pbOpenDexData
    pbDexDataOffset(dexdata,species,10)
    bs=[
       dexdata.fgetb, # HP
       dexdata.fgetb, # Attack
       dexdata.fgetb, # Defense
       dexdata.fgetb, # Speed
       dexdata.fgetb, # Special Attack
       dexdata.fgetb  # Special Defense
    ]
    dexdata.close
    bst=0
    for i in bs
      bst+=i
    end
    return bst
  end
Features of Pokemon Entropy

The black circular "doodles" in my avatar are actually my username written in Gallifreyan. Yes I'm a Whovian.
Reply With Quote
  #3    
Old August 9th, 2015 (12:18 PM).
Krigeris Krigeris is offline
 
Join Date: Aug 2015
Posts: 6
Thank you very much, works like a charm

Though I am confused as to why the "i" in the chunk of code below automatically knows to give you bs[i]

for i in bs
bst+=i
end
Reply With Quote
  #4    
Old August 9th, 2015 (12:41 PM).
Rot8er_ConeX's Avatar
Rot8er_ConeX Rot8er_ConeX is offline
 
Join Date: May 2015
Location: The Dissa Region
Gender: Male
Posts: 596
Quote:
Originally Posted by Krigeris View Post
Thank you very much, works like a charm

Though I am confused as to why the "i" in the chunk of code below automatically knows to give you bs[i]

for i in bs
bst+=i
end
Because the variable i isn't actually the index of the entry in the table, but the actual entry. If you want i to be the index, you'd have to use something like

for i in 0...bs.length
Reply With Quote
  #5    
Old August 9th, 2015 (12:48 PM).
Krigeris Krigeris is offline
 
Join Date: Aug 2015
Posts: 6
awesome thanks again
Reply With Quote
Reply Post Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


  All times are GMT -8. The time now is 4:09 AM.


Contact Us Archive Privacy Statement Terms of Service Top