The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.


Advertise here

Reply
 
Thread Tools
  #1    
Old March 18th, 2011, 03:44 AM
Luka S.J.'s Avatar
Luka S.J.
S.J.Ware HD
 
Join Date: Dec 2008
Age: 21
Gender: Male
Nature: Adamant

Advertise here
Are you making your Pokemon game with RMXP and P.Essentials? Do you have loads of rebattles with the same trainer, where the trainer might have the same Pokemon, but they'd just be a different level? Or do you want to be able to rebattle a trainer, and have their Pokemon become stronger or weaker without creating a new PBS entry? There is a very simple solution for you, and it goes like this. Go to PokemonUtilities script and anywhere (outside a def of course) place the following code:
Code:
def pbLevelModifier(type,factor=1)
  @levels=[]
  i=0
  ($Trainer.party.length).times do
    @levels.push($Trainer.party[i].level)
    i+=1
  end
  
  @maxlevel=@levels.max
  @sum=$Trainer.party[0].level
  
  i=1
  ($Trainer.party.length-1).times do
    @sum+=$Trainer.party[i].level
    i+=1
  end
  
  @averagelevel=@sum/($Trainer.party.length)
  
    if type=="max"
      level=@maxlevel*factor
    elsif type=="avg"
      level=@averagelevel*factor
    end
  return level
end
The way you would use this is as follows: When creating a wild Pokemon Battle
Code:
pbWildBattle(species, pbLevelModifier(type,factor))
Where type should either be "max" (to find the highest party level) or "avg" (to find the average party level). Quotation marks around the types are needed! The factor value is optional if wanting to multiply the returned level by the factor percentage (where 0.01 is 1% and 1.00 is 100%)
If you'd like to place it within trainer battles, you'll have to go into PokemonTrainers, and replace
Code:
    level=poke[1]
by
Code:
if $game_switches[X]==true
    level=pbLevelModifier(type,factor)
  else
    level=poke[1]
  end
Where the switch X would be your trigger for level calculations. You can play around with the scripts to adjust it any way you want, but this is just a very basic method to return either the maximum level, or the average level.
__________________
[STOPPED][DEMO] Pokemon Blue Chrome
[DEVELOPING] S.J.Ware
[DEVELOPING] Tykanite
Reply With Quote
  #2    
Old March 18th, 2011, 12:24 PM
IceGod64's Avatar
IceGod64
My imagination.
 
Join Date: Oct 2008
Location: Castelia City
Age: 26
Gender: Male
Nature: Naive
Wow, this will be incredibly handy! I'm going to add it to my game, with well deserved credit of course.
__________________

Reply With Quote
  #3    
Old March 20th, 2011, 07:16 AM
zingzags's Avatar
zingzags
Creator or Pokemon Serenity
 
Join Date: Jan 2009
Location: Boston
Age: 20
Nature: Adamant
Simple easy, and requires less work to do re-battles, good work Luka.
__________________
Pokemon Serenity is my fangame name.
name decided 12/15/09
Currently helping:
Pokemon ebony
and
Xenotime:
Reply With Quote
  #4    
Old March 20th, 2011, 09:25 AM
Luka S.J.'s Avatar
Luka S.J.
S.J.Ware HD
 
Join Date: Dec 2008
Age: 21
Gender: Male
Nature: Adamant
Another thing would be random ranges for NPC wild battles and/or trainers
Code:
def pbLevelRange(min,max)
  difference=max-min
  level=rand(difference+1)
  level+=min
  return level
end
min would be the lowest possible level, and max would be the highest possible level that the Pokemon could reach. Where it falls between that line, is completely random.
__________________
[STOPPED][DEMO] Pokemon Blue Chrome
[DEVELOPING] S.J.Ware
[DEVELOPING] Tykanite
Reply With Quote
Reply
Quick Reply

Sponsored Links


Advertise here
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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 03:33 AM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.