• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Simple Pokémon World Tournament system

Luka S.J.

Jealous Croatian
1,270
Posts
15
Years
Hidden Text


battle_logo.png

Hidden Text



DISCLAIMER


Compatible with Essentials v17.x.

The following plug-in adds PWT functionality akin to Gen 5's Black2/White2. The plug-in comes with created example maps and events, but is highly customizable, as it does not rely too heavily on script modification to create the visual scene.

Carefully read all the instructions. Please give credits when using the plug-in.


USING THE SCRIPT



Getting the new system to work can be a little tricky, but follow these instructions and you will have no issues. The script has been written with only one goal in mind: to be completely plug and play.
Either use the EPI to automatically download and install the plug-in, or manually install the linked Utilities Script and then the PWT plug-in.

Before we go any further, it is really important that you import the provided PWT Lobby and Stadium maps into your Essentials project. To do so, please follow this tutorial that guides you through the process of doing so. These example maps contain all the necessary events to run the PWT, and each important event has been properly labeled and commented (from within the Event Editor).

How to configure your PWT system

The
tournament_list
variable is an array (found inside the
def fetchTournamentList
) which contains all your possible Tournament branches, and trainer entries. The formatting is as following:


  • The first two entries in the array are of type 'String': first one specifying the Tournament branch name, the second specifying a script condition that unlocks the Tournament when true (the condition value can be left as an empty String, meaning that the Tournament will be unlocked from the start).
  • The next entries in the list of type 'Array', which contain bracket information. Each array can be split into: [ trainer_type, trainer_name, end_speech_loose, end_speech_win, trainer_id (variant), lobby_text (optional), text_before_battle (optional), text_after_battle (optional) ]
  • You need to have at least 8 Trainer (Array) entries in order for your Tournament branch to be valid.
  • After you've finished defining the trainers for your current Tournament branch, you can start the next one by again defining two String entries, one for the branch name, and one for its unlocking condition.
  • For the individual trainers, to have them appear on the map, you need to have the
    trcharXXX
    image in your
    'Graphics/Characters/'
    folder (where XXX denotes the 3 digit ID of the trainer type).

The Lobby sample map has a simple counter event which starts the PWT system using the
startPWT
command. The Lobby map also contains a sample event which is reserved to be the event for potential PWT trainers that show up in the lobby. The constant
PWT_LOBBY_EVENT
needs to correspond to the event ID of the event you're reserving for the Lobby trainers (in the sample map this event has an ID of 6). There are no manual transfers to the PWT stadium map through events. Instead, this is handled through the
PWT_MAP_DATA
constant. This constant is an array which contains the following information:
[pwt_stadium_map_id, transfer_x_position, transfer_y_position]
. This constant will define where the player gets transferred after they've successfully registered for a Tournament.

The Stadium sample map has 5 key sample events. The first is an event reserved for the opposing trainer. This event gets referenced using the
PWT_OPP_EVENT
constant, so make sure the event ID number corresponds to the value in the constant.

The next event is a reserved Auto-run event that initializes the continuation of the PWT system after the map transfer. The PWT resumes using a simple $PWT.continue script command. This event doesn't have to have a specific ID number, as long as its trigger is set to Auto-run.

The third event is reserved for the mini-scoreboard, and is referenced with the
PWT_SCORE_BOARD_EVENT
constant. This constant must contain the appropriate ID number of the scoreboard event. This event is only used as a means of positioning the mini-scoreboard on the map. The mini-scoreboard is of 6 x 3 (map units) dimensions, and its event has to be placed in the top left corner of where you'd like your mini-scoreboard to be rendered.

The next event handles the movement of all the entities on the PWT stadium. This event is referenced using the
PWT_MOVE_EVENT
constant, so its ID has to match this value. The event itself is comprised of 5 different event pages, which dictate which segment of movement to apply. Its trigger has to be set to 'Parallel Process' otherwise it won't work. The different event pages are triggered using self switches, and have been appropriately commented for you to build your trainer movement control. Please make sure to go through the individual pages to learn more.

The final event gets referenced through the
PWT_FANFARE_EVENT
constant and its contents handle any kind of special cutscene you would like to build for when the player wins the PWT. This event's contents are optional (apart from the command that turns its Self Switch off), and will not influence the system if they're not present.


Successfully beating a Tournament branch will yield 3 battle points which can then be fetched using
$Trainer.battle_points
should you wish to add any extra functionality for those. Additionally, each win gets recorded. These wins get stored in a hash which can be accessed through
$Trainer.pwt_wins["Tour Tournament branch name"]
, and can likewise be used for any extra functionality later on (such as unlocking new Tournaments based on the number of wins of a previous one).

 
Last edited:

Luka S.J.

Jealous Croatian
1,270
Posts
15
Years
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 ;)
 

Worldslayer608

ಥдಥ
894
Posts
16
Years
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.
 

Luka S.J.

Jealous Croatian
1,270
Posts
15
Years
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.
 
Last edited:
129
Posts
14
Years
  • Age 24
  • Seen Sep 4, 2023
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!
 

Luka S.J.

Jealous Croatian
1,270
Posts
15
Years
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.
 
Last edited:
129
Posts
14
Years
  • Age 24
  • Seen Sep 4, 2023
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.
 
Last edited:

Luka S.J.

Jealous Croatian
1,270
Posts
15
Years
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.
 
129
Posts
14
Years
  • Age 24
  • Seen Sep 4, 2023
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.[S-HIGHLIGHT]length<length[/S-HIGHLIGHT]
    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.[S-HIGHLIGHT]length[/S-HIGHLIGHT]
    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!
 
Last edited:

Luka S.J.

Jealous Croatian
1,270
Posts
15
Years
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.[S-HIGHLIGHT]length<length[/S-HIGHLIGHT]
    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.[S-HIGHLIGHT]length[/S-HIGHLIGHT]
    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.
 
Last edited:
129
Posts
14
Years
  • Age 24
  • Seen Sep 4, 2023
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.
 
Last edited:

Luka S.J.

Jealous Croatian
1,270
Posts
15
Years
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.
 

Rayd12smitty

Shadow Maker
645
Posts
12
Years
  • Seen Feb 21, 2016
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
 
220
Posts
9
Years
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?
 

Florio

Pokemon Crimson Skies Owner
391
Posts
15
Years
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?
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.
 
Last edited:

Luka S.J.

Jealous Croatian
1,270
Posts
15
Years
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.
 
1,224
Posts
10
Years
As someone on another thread has pointed out, you can get the correct script by using the "Show Printable Version" in Thread Tools
 
220
Posts
9
Years
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?
 
Last edited:
Back
Top