Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Pokémon Essentials

Notices
For all updates, view the main page.

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
 
Thread Tools
  #1    
Old March 19th, 2013 (02:14 PM).
Rayd12smitty's Avatar
Rayd12smitty
Shadow Maker
 
Join Date: Dec 2011
Gender: Male
Hey guys. I am extremely new to scripting and am experimenting with different things by making custom scripts. I am working on making a PWT script. So since I am a noob, I am having trouble with a few basic commands. I have figured out a lot with Carmaniac's help and by looking through the existing scripts. There are two things I haven't figured out that I need right now and am hoping someone can tell me how.

1. I want to set a variable to a random number between 1 and 8. I am currently using this but am not sure if it is the right way or if it is working right.

Code:
$game_variables[84]=rand(1-8)
2. I understand how to call a sprite to the screen like this:

Code:
@sprites["Player Box"] = Sprite.new
@sprites["Player Box"].z = 2
@sprites["Player Box"].x = 0
@sprites["Player Box"].y = 0
@sprites["Player Box"].bitmap = RPG::Cache.picture("PWTBox1")
I want to make it so that the number in the filename (1) depends on a variable, the same one from above. I have looked at existing scripts and tried copying them but I keep getting errors.

Can someone show me how to do these 2 things?
__________________
Reply With Quote
  #2    
Old March 19th, 2013 (04:42 PM).
Luka S.J.'s Avatar
Luka S.J.
S.J.Ware HD
 
Join Date: Dec 2008
Age: 21
Gender: Male
Nature: Adamant
1. When using the rand(x) command, the random numbers that will be output, will range from 0 to (x-1). To achieve what you want use
Code:
$game_variables[84]=rand(8)+1
2. To input variables (local or global) use the "#{x}" function, where x is the extra handler. So your bitmap load would look like
Code:
@sprites["Player Box"].bitmap = RPG::Cache.picture("PWTBox#{$game_variables[84]}")
[EDIT] If you're just starting out with coding, I suggest starting out with something smaller and reasonable. I coded 1642 lines of code from scratch for my PWT to function perfectly. That includes the visuals, matching AI, round AI, Trainer modifiers and generators.
__________________
Reply With Quote
  #3    
Old March 19th, 2013 (05:02 PM). Edited March 19th, 2013 by Rayd12smitty.
Rayd12smitty's Avatar
Rayd12smitty
Shadow Maker
 
Join Date: Dec 2011
Gender: Male
Thanks Luka. I was trying to think of something simpler, but this is the only real thing I want to do. I don't plan on coding in any AI. Pretty much everything will just be randomly generated.

Thanks especially for that second code. I've tried about 8 different things and none have worked.

Oh and another quick question.
How do you say "not equal" I believe it has something to do with exclamation points?
__________________
Reply With Quote
  #4    
Old March 19th, 2013 (05:11 PM). Edited March 19th, 2013 by Luka S.J..
Luka S.J.'s Avatar
Luka S.J.
S.J.Ware HD
 
Join Date: Dec 2008
Age: 21
Gender: Male
Nature: Adamant
The PWT is quite a complicated system. Using the default methods for battling will not get you the right result. As I've already mentioned before, you need to consider several things first before attempting it. Even if you just plan to have the battles randomly set, you'll still need to find a way, to create rounds which generate the different trainers, and pair up opponents. Then random opponents get sent through the next round, but those would depend on the previous pairs that were fighting...and so on...

Quote originally posted by Rayd12smitty:
Oh and another quick question.
How do you say "not equal" I believe it has something to do with exclamation points?
There are several ways to do this. The easiest/safest would be using !(x) where x is the function and the !() 'round it inverts it. So you could have something like !(variable.nil?) to check if the variable is not nil, or !(variable==string) to check if the variable does not equal the string, or !(array.include?(integer)) to check if the array does not include the integer. Whatever you use, putting it in !() will invert that check.
__________________
Reply With Quote
  #5    
Old March 19th, 2013 (05:40 PM).
Rayd12smitty's Avatar
Rayd12smitty
Shadow Maker
 
Join Date: Dec 2011
Gender: Male
Quote originally posted by Luka S.J.:
The PWT is quite a complicated system. Using the default methods for battling will not get you the right result. As I've already mentioned before, you need to consider several things first before attempting it. Even if you just plan to have the battles randomly set, you'll still need to find a way, to create rounds which generate the different trainers, and pair up opponents. Then random opponents get sent through the next round, but those would depend on the previous pairs that were fighting...and so on...



There are several ways to do this. The easiest/safest would be using !(x) where x is the function and the !() 'round it inverts it. So you could have something like !(variable.nil?) to check if the variable is not nil, or !(variable==string) to check if the variable does not equal the string, or !(array.include?(integer)) to check if the array does not include the integer. Whatever you use, putting it in !() will invert that check.
You are most likely right. I want to try and see how far I can get though. Thanks for the help. I have figured out how to get all the starting contestants set up, and make it so that the player is put randomly into the tournament bracket. I am just working on putting sprites together right now before I move onto the first battle.
__________________
Reply With Quote
  #6    
Old March 19th, 2013 (05:48 PM).
Luka S.J.'s Avatar
Luka S.J.
S.J.Ware HD
 
Join Date: Dec 2008
Age: 21
Gender: Male
Nature: Adamant
Quote originally posted by Rayd12smitty:
You are most likely right. I want to try and see how far I can get though. Thanks for the help. I have figured out how to get all the starting contestants set up, and make it so that the player is put randomly into the tournament bracket. I am just working on putting sprites together right now before I move onto the first battle.
Regarding the battles themselves:
- You'll need to have a party cap (official game has 3 for single, 4 for double, 6 for tripple) which brings me to my next point, in the Trainers PBS file you'd need your opponents defined with all 6 Pokemon, and then your PWT system should choose the appropriate number of Pokemon from there. The official PWT makes it so that the Pokemon are randomly selected, so the same trainer could have a different party each time. Same goes for the player. You'd need to be able to choose which Pokemon to take into the tournament, but I think FL already made a script for that.
- You'll need a level cap (official game has it at 50 for the global tournaments), which goes together with the disabling of exp and money gain.
- Also like I said before, the games have the opponent say different things depending on the battle outcome. The default battle loading only supports one end-of-battle speech.

Don't mean to intimidate you by all this, but to pull of the PWT, you'll need to make edits to PokeBattle_Battle class and defs such as pbLoadTrainer and pbTrainerBattle.
__________________
Reply With Quote
  #7    
Old March 19th, 2013 (05:55 PM).
Rayd12smitty's Avatar
Rayd12smitty
Shadow Maker
 
Join Date: Dec 2011
Gender: Male
This is seeming harder...

Haha thanks again. I'll see what I can do
__________________
Reply With Quote
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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 04:45 AM.