Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Ruby code for generating rmxp monsters

If this is the wrong section please move it I wouldnt know where else to put it. For this you will need either sciTE or know how to run a command prompt and of course run this as
whateveryousaveitas.rb>whateveryouname.txt
This script generators any number of monsters you want to use and you can just edit some of the code for different stats and such. the _.times do is how many you will generate, set the id to whatever id you want to start at but one less (since it runs in a sort of loop it needs to know to add 1 to the id each time) It automatically will add a lvl to each new monster so to fix that remove the +1 after lvl. Also I put in a addition for making enemies into characters, this is for my game that uses something like that so if you find no use remove it. Just paste the finished output into scene_title after the data things I put mine at line 25.
Code:
id=0
#_.times do is how many monsters I want to generate
4.times do
id=id+1
lvl=id+1
biglvlmod=lvl*100
smalllvlmod=lvl*5
medlvlmod=lvl*10
maxhp=rand(300)+200+biglvlmod 
maxsp=rand(300)+200+biglvlmod 
str=rand(10)+35+smalllvlmod 
dex=rand(10)+35+smalllvlmod 
agi=rand(10)+35 +smalllvlmod 
int=rand(10)+35 +smalllvlmod 
atk=rand(20)+70+medlvlmod 
pdef=rand(20)+70 +medlvlmod  
mdef=rand(20)+70+medlvlmod 
exp=rand(4)+lvl 
gold=rand(20)+smalllvlmod 
data2=['maxhp='+maxhp.to_s, 
'maxsp='+maxsp.to_s, 
'str='+str.to_s, 
'dex='+dex.to_s, 
'agi='+agi.to_s, 
'int='+int.to_s, 
'atk='+atk.to_s, 
'pdef='+pdef.to_s, 
'mdef='+mdef.to_s, 
'exp='+exp.to_s, 
'gold='+gold.to_s]
data_enemies='$data_enemies['+id.to_s+'].'
puts '#enemy'+id.to_s
data2.each do |dat| 
puts data_enemies+dat.to_s
end
id2=id-1
puts '#actor'+id.to_s
dataa=['maxhp='+maxhp.to_s, 
'maxsp='+maxsp.to_s, 
'str='+str.to_s, 
'dex='+dex.to_s, 
'agi='+agi.to_s, 
'int='+int.to_s, 
'atk='+atk.to_s, 
'pdef='+pdef.to_s, 
'mdef='+mdef.to_s] 
game_actors='$game_actors['+id2.to_s+'].'
dataa.each do |datac|
  puts game_actors+datac.to_s
end
puts '#'
end
If you want better instructions ask me I guess
 
here is one I did playing with tk, which I am teaching myself today. the only thing wrong is I'd like to make the output appear in a text box in the window, if anyone could help me with that I'd appreciate it ^^;;
http://www.megaupload.com/?d=I38KOQAH
this time I uploaded it into a file so you can just dl it and click it and it should run. Edit it and run it in sciTE in order to be able to copy output.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top