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

The PokéCommunity

Go Back     The PokéCommunity Forums > Create & Discover > Game Development > Scripts & Tutorials Essentials script Simple Pokémon World Tournament system

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.

Reply Post Reply
 
Thread Tools
  #1    
Old February 16th, 2014 (1:03 PM). Edited September 22nd, 2015 by Luka S.J..
Luka S.J.'s Avatar
Luka S.J. Luka S.J. is offline
Jealous Croatian
 
Join Date: Dec 2008
Location: Croatia
Age: 22
Gender: Male
Nature: Adamant
Posts: 1,002
Ok, it actually is not that simple, but neither is it as complex as the original one in BW2. I know a lot of people wanted this feature, so I've written a 100% stock-Essentials-compatible PWT system (just for you guys...from scratch...) I suggest studying the code a bit, in case you want to do any adjustments. I've tried to make the code as n00b friendly as possible, but there is always the possibility of that not being the case.

DOWNLOAD SCRIPT FROM HERE

The basic things you need to know is how to call the system. You call it with PokemonWorldTournament.new. A lot of what you need to know is written in the comments so please look at them. The main part is defining/declaring trainers. Trainers are created as usual through the Editor or PBS files, and then you have to link it in the TRAINER_LIST array. The exact format of it is written in the comments. I've actually done all the trainers for gen 1 up to gen 5 inclusive. So you have all the leaders and champions done. What you need now are the resources. I've actually also compiled a Resource Pack for you guys (includes some graphics, one required, audio files and the trainer PBS). Please put that into your games. One note though, do not simply replace your PBS files, but rather add the stuff from my PBS files to yours, and adjust the index of the trainertypes if necessary.

The system is not 100% complete. I really couldn't keep on going anymore after all those hours I put in it today. The Rental Masters and Mix Master modes are missing, which I'll try to get done tomorrow. The visual aspects of this PWT are kinda meh, so if anyone tweaks the code, makes it better, and wants to share it - please do. Copy the script above Main and you're good to go. It should work, without any problems (unless it's interfering with custom scripts - then I can't do anything about that). I've added some things not present in the official PWT, to compensate for the lack of Rotation and Triple battles (nothing I can do there).


Final note, resources that you need, and that will break the system if not present:
"Graphics/Pictures/scoreboard"
"Graphics/Characters/name_of_leader_sprites" <= by default these are "Leader_nameofleader", so "Leader_Brock" for example, but you can specify your own sprite names in the trainer arrays
Reply With Quote

Relevant Advertising!

  #2    
Old February 16th, 2014 (2:54 PM).
Luka S.J.'s Avatar
Luka S.J. Luka S.J. is offline
Jealous Croatian
 
Join Date: Dec 2008
Location: Croatia
Age: 22
Gender: Male
Nature: Adamant
Posts: 1,002
Guys, whoever got the script several hours ago, replace it with the amended version. I forgot to add some stuff which would make your PWT experience terrible
Reply With Quote
  #3    
Old February 16th, 2014 (6:36 PM).
Worldslayer608's Avatar
Worldslayer608 Worldslayer608 is offline
ಥдಥ
Silver Tier
 
Join Date: Mar 2008
Location: San Diego
Age: 26
Gender: Male
Nature: Calm
Posts: 885
Really excited to check this out Luka! Unfortunately it is going to have to hold off a couple days

REALLY appreciate you sharing this though, whether I use it or not I think it is a great add-on for Essentials users. Probably the best in my opinion.



SMEARGLE SOLO CHALLENGE
HARDCORE EDITION
To vanquish without peril is to triumph without glory...
Voted Best Game Designer 2011 on PC
Reply With Quote
  #4    
Old February 17th, 2014 (1:04 PM).
RPD490's Avatar
RPD490 RPD490 is offline
 
Join Date: Jan 2009
Location: Blackthorn City, Johto
Gender: Male
Nature: Relaxed
Posts: 163
I been waiting for something like this to pop up, great job!
This signature has been disabled.
Signature is over 600px wide :(
Please review and fix the issues by reading the signature rules.

You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
Reply With Quote
  #5    
Old February 21st, 2014 (10:17 AM). Edited February 21st, 2014 by Luka S.J..
Luka S.J.'s Avatar
Luka S.J. Luka S.J. is offline
Jealous Croatian
 
Join Date: Dec 2008
Location: Croatia
Age: 22
Gender: Male
Nature: Adamant
Posts: 1,002
Minor Update:

I've upgraded the Resource Pack to include all the Trainer sprites for all the trainertypes defined in the PBS. I've also added the win and lose speeches for the Hoenn Leaders, that were not there before. Also, I've adjusted the code so that there is no limit on how many trainer entries you can put for the tournament branch in the array TRAINER_LIST (used to be 8 before). The Resource Pack is still missing OW sprites of the Leaders and Champions from Hoenn and Unova, as they do not officially exist in Gen IV format. You will not be able to play those Tournament branches, unless you add the missing OW sprites to your game.

Rental and Mix Master modes are still not available. I will add that soon.

Sidenote:

Keep in mind that to unlock "World Leaders" you need to beat all the other Gym Leader type Tournaments at least once. And to unlock "World Champions" you need to beat "World Leaders" at least once.
Reply With Quote
  #6    
Old March 30th, 2014 (12:24 PM).
Joltik's Avatar
Joltik Joltik is offline
 
Join Date: Jan 2010
Gender: Male
Nature: Modest
Posts: 113
Hi,

This seems to be really great, but I am not being able to test it.

Whenever I try to participate in any tournament with any team, it always displays the following message:
"We're terribly sorry, but your Pokemon are not eligible for the Tournament."
Then a list of the banned pokémon follows (none of which is in my party, nor do I have any eggs).
"Please come back once your Pokemon Party has been adjusted."

I believe it may be due to some little mistake in the script. Can anyone else confirm this?

Thank you!

Check out my DeviantArt account! My game project is called Pokemon Subrosia.
My DeviantArt | Old DeviantArt
Reply With Quote
  #7    
Old March 30th, 2014 (12:52 PM). Edited March 30th, 2014 by Luka S.J..
Luka S.J.'s Avatar
Luka S.J. Luka S.J. is offline
Jealous Croatian
 
Join Date: Dec 2008
Location: Croatia
Age: 22
Gender: Male
Nature: Adamant
Posts: 1,002
Quote:
Originally Posted by Giu View Post
Hi,

This seems to be really great, but I am not being able to test it.

Whenever I try to participate in any tournament with any team, it always displays the following message:
"We're terribly sorry, but your Pokemon are not eligible for the Tournament."
Then a list of the banned pokémon follows (none of which is in my party, nor do I have any eggs).
"Please come back once your Pokemon Party has been adjusted."

I believe it may be due to some little mistake in the script. Can anyone else confirm this?

Thank you!
What type of tournament are you trying to participate in, and how many Pokemon do you have in your team? Your party may not be eligible if you do not have enough Pokemon in your team to participate in the tournament.

Single Battle requires at least 3 in your party. Double requires 4. Full Battle needs a full party of 6. And Sudden Death only needs 1.
Reply With Quote
  #8    
Old March 30th, 2014 (7:10 PM). Edited March 30th, 2014 by Joltik.
Joltik's Avatar
Joltik Joltik is offline
 
Join Date: Jan 2010
Gender: Male
Nature: Modest
Posts: 113
Quote:
Originally Posted by Luka S.J. View Post
What type of tournament are you trying to participate in, and how many Pokemon do you have in your team? Your party may not be eligible if you do not have enough Pokemon in your team to participate in the tournament.

Single Battle requires at least 3 in your party. Double requires 4. Full Battle needs a full party of 6. And Sudden Death only needs 1.
I had a party of six pokémon, and I tryed to participate in each regional tournament both in single and double battles. Just tryed it again using Essentials demo-party, in a new game, still got the error.
Are you using the same script that is on the page? Maybe yours is a little bit different.

Check out my DeviantArt account! My game project is called Pokemon Subrosia.
My DeviantArt | Old DeviantArt
Reply With Quote
  #9    
Old March 31st, 2014 (12:49 PM).
Luka S.J.'s Avatar
Luka S.J. Luka S.J. is offline
Jealous Croatian
 
Join Date: Dec 2008
Location: Croatia
Age: 22
Gender: Male
Nature: Adamant
Posts: 1,002
Quote:
Originally Posted by Giu View Post
I had a party of six pokémon, and I tryed to participate in each regional tournament both in single and double battles. Just tryed it again using Essentials demo-party, in a new game, still got the error.
Are you using the same script that is on the page? Maybe yours is a little bit different.
If your def partyEligible? looks like this
Code:
  def partyEligible?
    case @battle_type
    when 0
      length = 3
    when 1
      length = 4
    when 2 
      length = 6
    when 3
      length = 1
    end
    count=0
    return false if $Trainer.party.length<length
    for i in 0...$Trainer.party.length
      count+=1 if !(BAN_LIST.include?($Trainer.party[i].species)) && !($Trainer.party[i].egg?)
    end
    
    return true if count>=length
    return false
  end
Then you should be getting the same results as me; which is a playable PWT. The code in this thread, is the code I'm running in my game, and everything works just fine.
Reply With Quote
  #10    
Old March 31st, 2014 (5:41 PM). Edited March 31st, 2014 by Joltik.
Joltik's Avatar
Joltik Joltik is offline
 
Join Date: Jan 2010
Gender: Male
Nature: Modest
Posts: 113
Thank you for the quick repply.

If you look at the original code carefully, there is a little mistake, which is not in this new one you just showed me. Take a look:

Original Code:
Code:
    return false if $Trainer.party.length<length
    for i in 0...$Trainer.party.length
      count+=1 if !(BAN_LIST.include?($Trainer.party[i].species)) && !($Trainer.party[i].egg?)
    end
    
    return true if count>=length
    return false
  end
Correct Code:
Code:
    return false if $Trainer.party.length
    for i in 0...$Trainer.party.length
      count+=1 if !(BAN_LIST.include?($Trainer.party[i].species)) && !($Trainer.party[i].egg?)
    end
    
    return true if count>=length
    return false
  end
Now that I changed it, the Tournament is working fine.
Thank you for sharing the code. It's really cool.
I'll work on it a little bit. I want to tweak it, so that it will be more viasually appealing. I'll show you in case I get anything nice.
Cheers!

Check out my DeviantArt account! My game project is called Pokemon Subrosia.
My DeviantArt | Old DeviantArt
Reply With Quote
  #11    
Old March 31st, 2014 (6:58 PM). Edited April 3rd, 2014 by Luka S.J..
Luka S.J.'s Avatar
Luka S.J. Luka S.J. is offline
Jealous Croatian
 
Join Date: Dec 2008
Location: Croatia
Age: 22
Gender: Male
Nature: Adamant
Posts: 1,002
Quote:
Originally Posted by Giu View Post
Thank you for the quick repply.

If you look at the original code carefully, there is a little mistake, which is not in this new one you just showed me. Take a look:

Original Code:
Code:
    return false if $Trainer.party.length<length
    for i in 0...$Trainer.party.length
      count+=1 if !(BAN_LIST.include?($Trainer.party[i].species)) && !($Trainer.party[i].egg?)
    end
    
    return true if count>=length
    return false
  end
Correct Code:
Code:
    return false if $Trainer.party.length
    for i in 0...$Trainer.party.length
      count+=1 if !(BAN_LIST.include?($Trainer.party[i].species)) && !($Trainer.party[i].egg?)
    end
    
    return true if count>=length
    return false
  end
Now that I changed it, the Tournament is working fine.
Thank you for sharing the code. It's really cool.
I'll work on it a little bit. I want to tweak it, so that it will be more viasually appealing. I'll show you in case I get anything nice.
Cheers!
That's not a mistake, it's intentional. The original code is the correct one (what do you mean new code anyway? I just copied and pasted the same thing from the OP). Your team cannot be eligible if you do not have enough Pokemon in your party to participate. The line is supposed to be return false if $Trainer.party.length < length. What you just did with your "correct code" is remove that functionality, and goofed it up. I just tested all the branches and all the types of tournaments with the "original" code, and everything works just as it should.

Long story short: your "correct code" is not correct. Go through the logic there. What you've done now, is make partyEligible? return a false value (meaning party is not eligible) whenever $Trainer.party.length (that statement will always be true if it isn't 0). That means, that whenever your party is larger than 0, your team will not be eligible. At this stage, I have no idea what you're doing anymore.
Reply With Quote
  #12    
Old April 1st, 2014 (5:35 PM). Edited April 1st, 2014 by Joltik.
Joltik's Avatar
Joltik Joltik is offline
 
Join Date: Jan 2010
Gender: Male
Nature: Modest
Posts: 113
Quote:
Originally Posted by Luka S.J. View Post
That's not a mistake, it's intentional. The original code is the correct one (what do you mean new code anyway? I just copied and pasted the same thing from the OP). Your team cannot be eligible if you do not have enough Pokemon in your party to participate. The line is supposed to be return false if $Trainer.party.length<length. What you just did with your "correct code" is remove that functionality, and goofed it up. I just tested all the branches and all the types of tournaments with the "original" code, and everything works just as it should.

Long story short: your "correct code" is not correct. Go through the logic there. What you've done now, is make partyEligible? return a false value (meaning party is not eligible) whenever $Trainer.party.length (that statement will always be true if it isn't 0). That means, that whenever your party is larger than 0, your team will not be eligible. At this stage, I have no idea what you're doing anymore.
Sorry, maybe I was a little bit confusiong in my last post.
I didn't write or modify any of those codes. I did not write the "correct code".

By original code I mean the code I just copy & pasted from your first post in this thread (the complete script). It contained: (and was not working properly)
Code:
return false if $Trainer.party.length<length
By correct code, I mean the code I just copy & pasted from your previous post, which contained: (and is working fine)
Code:
return false if $Trainer.party.length
Sorry for the confusion regarding this. I believe that part of the code from you last post (which I called the "correct code") is indeed correct (and I confirm, the PWT is working fine now that I'm using it). On the other hand, the main code of this thread was not working becuase it is different from your last code. There should'nt be a <lenght there I guess.

Check out my DeviantArt account! My game project is called Pokemon Subrosia.
My DeviantArt | Old DeviantArt
Reply With Quote
  #13    
Old April 3rd, 2014 (12:44 AM).
Luka S.J.'s Avatar
Luka S.J. Luka S.J. is offline
Jealous Croatian
 
Join Date: Dec 2008
Location: Croatia
Age: 22
Gender: Male
Nature: Adamant
Posts: 1,002
WTF? When looking at this thread through Chrome the <length part appears, when looking at it through Safari it does not. I don't know what's going on there but there should be a < length for the eligibility check. That I'm sure of.
Reply With Quote
  #14    
Old April 3rd, 2014 (1:04 PM).
Rayd12smitty's Avatar
Rayd12smitty Rayd12smitty is offline
Shadow Maker
 
Join Date: Dec 2011
Gender: Male
Posts: 647
This is so weird... I'm on safari and both quotes are identical, on chrome the one is fixed and the other isn't. This is kinda cool, but really annoying
Reply With Quote
  #15    
Old August 4th, 2014 (6:16 AM).
Richard PT's Avatar
Richard PT Richard PT is offline
 
Join Date: Aug 2014
Gender: Male
Posts: 82
Hi! I add your Pokemon world tournament script and the rest of the files resources, but when i tried to enter my game to test it, i got this error below:

Script 'PokemonWorldTournament' line 353: SyntaxError occurred.

What kind of error is this and how to fix this?

If someone wants to help me to speed up my project, so we can fully complete it as soon as possible, i'll be apreciate it.
To speed up this project i need:
Good Graphics designers (Recruits: RPD490),
Good Programers (Recruits: none),
And Good Graphics Animator (only for atack animations) (Recruits: none).
For those that don't know, I'm the creator and the project leader of Pokémon Chronicles.
Reply With Quote
  #16    
Old August 22nd, 2014 (5:52 AM).
mustafa505's Avatar
mustafa505 mustafa505 is offline
Developer
 
Join Date: Apr 2010
Location: Hoenn Region 4ver
Gender: Male
Nature: Lonely
Posts: 295
Maybe attaching a text file should fix the "browser eating code" glitch :D
Reply With Quote
  #17    
Old August 23rd, 2014 (4:03 PM). Edited August 23rd, 2014 by Florio.
Florio's Avatar
Florio Florio is offline
Pokemon Crimson Skies Owner
 
Join Date: Nov 2008
Location: Canada
Gender: Male
Nature: Lax
Posts: 362
Quote:
Originally Posted by Richard PT View Post
Hi! I add your Pokemon world tournament script and the rest of the files resources, but when i tried to enter my game to test it, i got this error below:

Script 'PokemonWorldTournament' line 353: SyntaxError occurred.

What kind of error is this and how to fix this?
I am also getting this same error. I can't see anything wrong with it. Can I please get help?
Quote:
choices.push("Cancel cmd=Kernel.pbMessage(_INTL("Which Tournament would you like to participate in?"),choices,choices.index("Cancel return false if choices[cmd]=="Cancel"
That is the line I get the error on.
Reply With Quote
  #18    
Old August 25th, 2014 (10:42 AM).
Luka S.J.'s Avatar
Luka S.J. Luka S.J. is offline
Jealous Croatian
 
Join Date: Dec 2008
Location: Croatia
Age: 22
Gender: Male
Nature: Adamant
Posts: 1,002
The syntax error looks like it's because of missing brackets. Anyway, I don't have any errors at all, and it might just be me messing up something in this BBCode here, but just in case I pasted the current script I have to pastebin.

Soo...get it here.
Reply With Quote
  #19    
Old August 25th, 2014 (1:50 PM).
mej71's Avatar
mej71 mej71 is offline
 
Join Date: Mar 2014
Location: Omnipresence
Gender: Male
Posts: 911
As someone on another thread has pointed out, you can get the correct script by using the "Show Printable Version" in Thread Tools
Reply With Quote
  #20    
Old September 2nd, 2014 (11:02 AM). Edited September 2nd, 2014 by Richard PT.
Richard PT's Avatar
Richard PT Richard PT is offline
 
Join Date: Aug 2014
Gender: Male
Posts: 82
Thanks a lot for your help guys, now it works just fine. Good script, thanks.

How can i do to enable exp gain and money gain?

If someone wants to help me to speed up my project, so we can fully complete it as soon as possible, i'll be apreciate it.
To speed up this project i need:
Good Graphics designers (Recruits: RPD490),
Good Programers (Recruits: none),
And Good Graphics Animator (only for atack animations) (Recruits: none).
For those that don't know, I'm the creator and the project leader of Pokémon Chronicles.
Reply With Quote
  #21    
Old February 11th, 2015 (2:59 AM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,551
How to make overworlds appears at the stadiums between rounds

Spoiler:
PokéCommunity is breaking codes. For copying scripts at PokéCommunity: Click Thread Tools, and then Show Printable Version, and copy that instead.

At the script, change

Code:
  def initialize(announce=false)
    @sprites={}
    @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
    @viewport.z=9999
    @sprites["scoreboard"]=Sprite.new(@viewport)
    @sprites["scoreboard"].bitmap=Bitmap.new(Graphics.width,Graphics.height)
    @sprites["scoreboard"].bitmap.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(0,0,0))
    @sprites["scoreboard"].opacity=0
   
    $Trainer.battle_points=0 if !$Trainer.battle_points
    if !$Trainer.pwt_wins or $Trainer.pwt_wins.length<BATTLE_LIST.length
      $Trainer.pwt_wins=[]
      for i in 0...BATTLE_LIST.length
        $Trainer.pwt_wins.push(0)
      end
    end
       
    @current_party = $Trainer.party
   
    self.generateWorldLeaders if BATTLE_LIST.include?("World Leaders")
    self.generateRentalMasters if BATTLE_LIST.include?("Rental Masters")
    self.generateMixMasters if BATTLE_LIST.include?("Mix Masters")
   
    self.introduction
    @tournament_type = chooseTournament
    return cancelEntry if !@tournament_type
    @battle_type = chooseBattle
    return cancelEntry if !@battle_type
    @modified_party = choosePokemon
    if @modified_party=="notEligible"
      Kernel.pbMessage(_INTL("We're terribly sorry, but your Pokemon are not eligible for the Tournament."))
      Kernel.pbMessage(_INTL(showBanList))
      Kernel.pbMessage(_INTL("Please come back once your Pokemon Party has been adjusted."))
    elsif !@modified_party
      cancelEntry
    else
      self.generateRounds
      ret=self.startTournament(announce)
    end
   
    @sprites["scoreboard"].bitmap.clear
    @sprites["scoreboard"].bitmap.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(0,0,0))
    15.times do
      @sprites["scoreboard"].opacity-=17
      pbWait(1)
    end
    case ret
    when "win"
      Kernel.pbMessage(_INTL("Congratulations on today's win."))
      Kernel.pbMessage(_INTL("For your victory you have earned 3 BP."))
      Kernel.pbMessage(_INTL("We hope to see you again."))
      $Trainer.pwt_wins[@tournament_type]+=1
      $Trainer.battle_points+=3
    when "loss"
      Kernel.pbMessage(_INTL("I'm sorry that you lost this tournament."))
      Kernel.pbMessage(_INTL("Maybe you'll have better luck next time."))
      cancelEntry
    end
    $Trainer.party = @current_party
  end
to

Code:
  attr_accessor :round
  attr_accessor :won
  attr_accessor :finished
  def initialize(announce=false)
    @announce=announce
    @finished=false
    @won=false
  end
  
  def start
    @sprites={}
    @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
    @viewport.z=9999
    @sprites["scoreboard"]=Sprite.new(@viewport)
    @sprites["scoreboard"].bitmap=Bitmap.new(Graphics.width,Graphics.height)
    @sprites["scoreboard"].bitmap.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(0,0,0))
    @sprites["scoreboard"].opacity=0
   
    $Trainer.battle_points=0 if !$Trainer.battle_points
    if !$Trainer.pwt_wins or $Trainer.pwt_wins.length<BATTLE_LIST.length
      $Trainer.pwt_wins=[]
      for i in 0...BATTLE_LIST.length
        $Trainer.pwt_wins.push(0)
      end
    end
       
    @current_party = $Trainer.party
   
    self.generateWorldLeaders if BATTLE_LIST.include?("World Leaders")
    self.generateRentalMasters if BATTLE_LIST.include?("Rental Masters")
    self.generateMixMasters if BATTLE_LIST.include?("Mix Masters")
   
    self.introduction
    @tournament_type = chooseTournament
    return cancelEntry if !@tournament_type
    @battle_type = chooseBattle
    return cancelEntry if !@battle_type
    @modified_party = choosePokemon
    if @modified_party=="notEligible"
      Kernel.pbMessage(_INTL("We're terribly sorry, but your Pokemon are not eligible for the Tournament."))
      Kernel.pbMessage(_INTL(showBanList))
      Kernel.pbMessage(_INTL("Please come back once your Pokemon Party has been adjusted."))
    elsif !@modified_party
      cancelEntry
    else
      self.generateRounds
      return true
    end
    return false 
  end
  
  def endTournament(win)
    @sprites["scoreboard"].bitmap.clear
    @sprites["scoreboard"].bitmap.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(0,0,0))
    if win
      Kernel.pbMessage(_INTL("Congratulations on today's win."))
      Kernel.pbMessage(_INTL("For your victory you have earned 3 BP."))
      Kernel.pbMessage(_INTL("We hope to see you again."))
      $Trainer.pwt_wins[@tournament_type]+=1
      $Trainer.battle_points+=3
    else # loss
      Kernel.pbMessage(_INTL("I'm sorry that you lost this tournament."))
      Kernel.pbMessage(_INTL("Maybe you'll have better luck next time."))
      cancelEntry
    end
    $Trainer.party = @current_party
  end
Change

Code:
  def startTournament(announce)
    @round=0
    doublebattle=false
    doublebattle=true if @battle_type==1
    15.times do
      @sprites["scoreboard"].opacity+=17
      pbWait(1)
    end
    Kernel.pbMessage(_INTL("Announcer: Welcome to the #{BATTLE_LIST[@tournament_type]} Tournament!"))
    Kernel.pbMessage(_INTL("Announcer: Today we have 8 very eager contestants, waiting to compete for the title of \"Champion\"."))
    Kernel.pbMessage(_INTL("Announcer: Let us turn our attention to the scoreboard, to see who will be competing today."))
    self.createScoreBoard(@trainer_list)
    for i in 0...8
      announceContest(@trainer_list[i],i) if announce
    end
    Kernel.pbMessage(_INTL("Announcer: Without further ado, let the first match begin."))
    trainer=self.generateRound1
    Kernel.pbMessage(_INTL("Announcer: This will be a battle between #{$Trainer.name} and #{trainer[1]}."))
    outcome=pbPWTTrainerBattle(trainer[0],trainer[1],trainer[2],trainer[3],doublebattle)
    if outcome==1
      @round=1
      Kernel.pbMessage(_INTL("Announcer: Wow! What an exciting first round!"))
      Kernel.pbMessage(_INTL("Announcer: The stadium is getting heated up, and the contestants are on fire!"))
      Kernel.pbMessage(_INTL("Announcer: Let us turn our attention back to the scoreboard for the results."))
      trainer=self.generateRound2
      self.createScoreBoard(@trainer_list)
      Kernel.pbMessage(_INTL("Announcer: It looks like the next match will be between #{$Trainer.name} and #{trainer[1]}."))
      Kernel.pbMessage(_INTL("Announcer: Let the battle begin!"))
      outcome=pbPWTTrainerBattle(trainer[0],trainer[1],trainer[2],trainer[3],doublebattle)
      if outcome==1
        @round=2
        Kernel.pbMessage(_INTL("Announcer: What spectacular matches!"))
        Kernel.pbMessage(_INTL("Announcer: These trainers are really giving it all."))
        Kernel.pbMessage(_INTL("Announcer: Let's direct our attention at the scoreboard one final time."))
        trainer=self.generateRound3
        self.createScoreBoard(@trainer_list)
        Kernel.pbMessage(_INTL("Announcer: Alright! It's all set!"))
        Kernel.pbMessage(_INTL("Announcer: The final match of this tournament will be between #{$Trainer.name} and #{trainer[1]}!"))
        Kernel.pbMessage(_INTL("Announcer: May the best trainer win!"))
        outcome=pbPWTTrainerBattle(trainer[0],trainer[1],trainer[2],trainer[3],doublebattle)
        if outcome==1
          Kernel.pbMessage(_INTL("Announcer: What an amazing battle!"))
          Kernel.pbMessage(_INTL("Announcer: Both the trainers put up a great fight, but our very own #{$Trainer.name} was the one to come out on top!"))
          Kernel.pbMessage(_INTL("Announcer: Congratulations #{$Trainer.name}! You have certainly earned today's title of \"Champion\"!"))
 
          Kernel.pbMessage(_INTL("Announcer: That's all we have time for. I hope you enjoyed todays contest. And we hope to see you again soon."))
          return "win"
        end
      end
    end
    return "loss"
  end
to

Code:
  def announcerRound1
    Kernel.pbMessage(_INTL("Announcer: Welcome to the #{BATTLE_LIST[@tournament_type]} Tournament!"))
    Kernel.pbMessage(_INTL("Announcer: Today we have 8 very eager contestants, waiting to compete for the title of \"Champion\"."))
    Kernel.pbMessage(_INTL("Announcer: Let us turn our attention to the scoreboard, to see who will be competing today."))
    self.createScoreBoard(@trainer_list)
    @sprites["scoreboard"].opacity=255
    for i in 0...8
      announceContest(@trainer_list[i],i) if @announce
    end
    Kernel.pbMessage(_INTL("Announcer: Without further ado, let the first match begin."))
    @nextTrainer=self.generateRound1
    Kernel.pbMessage(_INTL("Announcer: This will be a battle between #{$Trainer.name} and #{@nextTrainer[1]}."))
    @sprites["scoreboard"].opacity=0
  end
    
  def announcerRound2
    Kernel.pbMessage(_INTL("Announcer: Wow! What an exciting first round!"))
    Kernel.pbMessage(_INTL("Announcer: The stadium is getting heated up, and the contestants are on fire!"))
    Kernel.pbMessage(_INTL("Announcer: Let us turn our attention back to the scoreboard for the results."))
    @nextTrainer=self.generateRound2
    self.createScoreBoard(@trainer_list)
    @sprites["scoreboard"].opacity=255
    Kernel.pbMessage(_INTL("Announcer: It looks like the next match will be between #{$Trainer.name} and #{@nextTrainer[1]}."))
    Kernel.pbMessage(_INTL("Announcer: Let the battle begin!"))
    @sprites["scoreboard"].opacity=0
  end
  
  def announcerRound3
    Kernel.pbMessage(_INTL("Announcer: What spectacular matches!"))
    Kernel.pbMessage(_INTL("Announcer: These trainers are really giving it all."))
    Kernel.pbMessage(_INTL("Announcer: Let's direct our attention at the scoreboard one final time."))
    @nextTrainer=self.generateRound3
    self.createScoreBoard(@trainer_list)
    @sprites["scoreboard"].opacity=255
    Kernel.pbMessage(_INTL("Announcer: Alright! It's all set!"))
    Kernel.pbMessage(_INTL("Announcer: The final match of this tournament will be between #{$Trainer.name} and #{@nextTrainer[1]}!"))
    Kernel.pbMessage(_INTL("Announcer: May the best trainer win!"))
    @sprites["scoreboard"].opacity=0
  end
  
  def winTournament
    Kernel.pbMessage(_INTL("Announcer: What an amazing battle!"))
    Kernel.pbMessage(_INTL("Announcer: Both the trainers put up a great fight, but our very own #{$Trainer.name} was the one to come out on top!"))
    Kernel.pbMessage(_INTL("Announcer: Congratulations #{$Trainer.name}! You have certainly earned today's title of \"Champion\"!"))
    Kernel.pbMessage(_INTL("Announcer: That's all we have time for. I hope you enjoyed todays contest. And we hope to see you again soon."))
  end
  
  def beforeBattleMessage
    outbattleMessage(7) 
  end  
  
  def afterBattleWinMessage
    outbattleMessage(8) 
  end 
  
  def afterBattleLoseMessage
    outbattleMessage(9) 
  end 
  
  def outbattleMessage(listIndex)
    if @nextTrainer[listIndex]
      dialogueLines=@nextTrainer[listIndex].is_a?(Array) ? @nextTrainer[listIndex] : [@nextTrainer[listIndex]]
      for line in dialogueLines
        Kernel.pbMessage(line)
      end  
    end  
  end  
  
  def battle
    trainerid=@nextTrainer[0]
    trainername=@nextTrainer[1]
    endspeech=@nextTrainer[2]
    endspeechwin=@nextTrainer[3]
    doublebattle=@battle_type==1
    return pbPWTTrainerBattle(trainerid,trainername,endspeech,endspeechwin, doublebattle)
  end  
  
  def setEventGraphic(event)
    filename = @nextTrainer[6]
    begin
      bitmap=BitmapCache.load_bitmap("Graphics/Characters/#{filename}")
      bitmap.dispose
      event.character_name=filename
    rescue
      event.character_name="trchar000"
    end
  end
Change line 'full_list = TRAINER_LIST[@tournament_type]' into 'full_list = TRAINER_LIST[@tournament_type].clone'. Change line '@trainer_list[i].push("Leader_#{@trainer_list[i][1]}") if @trainer_list[i][6].nil?' into '@trainer_list[i][6]="Leader_#{@trainer_list[i][1]}" if @trainer_list[i][6].nil?'.

So we need to create three events with one page each. One is the guide at the counter. The other two are in another map, the stadium. One is an empty invisible event called "Opponent", and the second is an invisible autostart event called "Controller". Look at the attachment about the "Guide" and "Controller" commands.

You can set three more parameters for each trainer array: The speech before battle, speech after you win and the speech after you lose. Each one can be a single string or an array with strings, an example:

Code:
[PBTrainers::LEADER_0,"Brock","Looks like you were the sturdier of us.","My barrier was tough to break. Maybe next time.","Kanto","Pewter City",nil,["I'm Brock, the Pewter Gym Leader.", "I'm an expert on Rock-type Pokémon.","My Pokémon are impervious to most physical attacks.","You'll have a hard time inflicting any damage."," Come on!"],"Your Pokémon's powerful attacks overcame my rock-hard resistance..."],
Attached Thumbnails
PWT Guide Event.png‎   PWT Controller Event.png‎  
Reply With Quote
  #22    
Old May 1st, 2015 (7:17 AM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,551
Removing some tournament from list results in bugs. I made a fix:

Spoiler:
PokéCommunity is breaking codes. For copying scripts at PokéCommunity: Click Thread Tools, and then Show Printable Version, and copy that instead.

Change the entire def chooseTournament into:

Code:
  def chooseTournament
    choices = []
    # Picks the lastest index for tournaments that are available by start.
    availableOnStartIndex = nil
    for tournament in ["World Leaders","World Champions","Rental Masters","Mix Master"]
      availableOnStartIndex = BATTLE_LIST.index(tournament)
      break if availableOnStartIndex
    end
    availableOnStartIndex = BATTLE_LIST.size if !availableOnStartIndex
    for i in 0...availableOnStartIndex
      choices.push(BATTLE_LIST[i])
    end
    allBasicTournametBeated = true
    for tournament in ["Kanto Leaders","Johto Leaders","Hoenn Leaders","Sinnoh Leaders","Unova Leaders"]
      if BATTLE_LIST.include?(tournament) && $Trainer.pwt_wins[BATTLE_LIST.index(tournament)]==0
        allBasicTournametBeated = false
        break
      end  
    end
    if BATTLE_LIST.include?("World Leaders") && allBasicTournametBeated
      choices.push("World Leaders")
    end
    if BATTLE_LIST.include?("World Champions") && BATTLE_LIST.include?("Rental Masters") && $Trainer.pwt_wins[BATTLE_LIST.index("World Champions")]>0
      choices.push("Rental Masters")
    end
    if BATTLE_LIST.include?("World Champions") && BATTLE_LIST.include?("Mix Master") && $Trainer.pwt_wins[BATTLE_LIST.index("World Champions")]>0
      choices.push("Mix Master")
    end
    if BATTLE_LIST.include?("World Leaders") && BATTLE_LIST.include?("World Champions") && $Trainer.pwt_wins[BATTLE_LIST.index("World Leaders")]>0
      choices.push("World Champions")
    end
    choices.push("Cancel")
    cmd=Kernel.pbMessage(_INTL("Which Tournament would you like to participate in?"),choices,choices.index("Cancel"))
    return false if choices[cmd]=="Cancel"
    return cmd
  end
Reply With Quote
  #23    
Old May 1st, 2015 (12:09 PM).
akane159 akane159 is offline
 
Join Date: Oct 2012
Gender: Female
Posts: 44
hi, i have this error, if i change the entire "def chooseTournament" for the new one, i have this error
Spoiler:


but if i dont change the the entire def chooseTournament, the script work but wiht a error,
if I go into the tournament , when it ends ( win or lose ), my pokemon are on another level,
if was a tournament single , and i choose my pokemon they change his lvl to 50, but when it ends ,
they do not return to their previous level :s
Reply With Quote
  #24    
Old May 8th, 2015 (2:06 PM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,551
Quote:
Originally Posted by akane159 View Post
hi, i have this error, if i change the entire "def chooseTournament" for the new one, i have this error
Spoiler:


but if i dont change the the entire def chooseTournament, the script work but wiht a error,
if I go into the tournament , when it ends ( win or lose ), my pokemon are on another level,
if was a tournament single , and i choose my pokemon they change his lvl to 50, but when it ends ,
they do not return to their previous level :s
Quote:
Originally Posted by FL View Post
PokéCommunity is breaking codes. For copying scripts at PokéCommunity: Click Thread Tools, and then Show Printable Version, and copy that instead.
Reply With Quote
  #25    
Old June 3rd, 2015 (5:59 AM).
Starlight Minun's Avatar
Starlight Minun Starlight Minun is offline
LoveEletric
 
Join Date: Nov 2014
Posts: 20
well that suck :/
about the level cant back to normal
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 1:56 AM.


Contact Us Archive Privacy Statement Terms of Service Top