Question about Megaevos in random-teams.js (development)

#1
Hello guys I'm hosting a server and everything works as intended, I just have a little problem with random-teams, i wish to not have any mega stones or z-items on my random teams. I read alll the code and coudn't find where they assign those items to the set, but i manage to cheat it, If I add these lines before the set validation (for the function randomBSSFactoryTeam) all pokemon will be holding leftovers.

set.item = 'Leftovers';
// Okay, the set passes, add it to our team
pokemon.push(set);


What I am trying here and failing hard is the check syntax, I tried this one and many others like this:

if (set.item.megaStone || set.item.zMove) {
set.item = 'Leftovers';
}


I really think I manage to do it before but I lost the code, and I know its possible because it works without the check, i just need to get it right.

My code for randomBSSFactoryTeam is this just like the one in the source plus a few edits, I'm trying this for hours with no succes, I hope some of the developers or someone who owns a server could answer me, sorry if this is not the right area, I don't have permission to post on development. I'm really sorry I'm posting here because I dont have anyone that could help me, I know this is really simple for the developers, but I've been trying for DAYS now.
 
Last edited:

HoeenHero

The Misspelled Hero!
is a Battle Server Administratoris a Community Leaderis a Programmer
Community Leader
#2
Your issue is set.item is a string, and wont have a .megaStone or .zMove property.

What you want is
JavaScript:
let iTemplate = this.getItem(set.item);
if (iTemplate.megaStone || iTemplate.zMove) {
    set.item = 'Leftovers';
}
something like this. You could also (for more optimal items) work in the item selection code and remove the code that gives megastones/z crystals.
 
#3
I dont know why, but your solution still didn't work, I've tried that before and again now. Still getting mega stones on my pokemon. Like you said I'm going to have to remove the tags from items.js, crazy right? Still looking for a better solution tough.
 
Last edited:

HoeenHero

The Misspelled Hero!
is a Battle Server Administratoris a Community Leaderis a Programmer
Community Leader
#4
#5
I didn't say that, I said remove the items from the item selection code for the random team generator. https://github.com/Zarel/Pokemon-Showdown/blob/master/data/random-teams.js#L1359-L1555 Also where you place that block of code I gave you matters, it would be better to place it after the item selection code I linked above (will need to be tweaked since its item not set.item there.)
It works now like you said i just had to do this at the right place
JavaScript:
            let iTemplate = this.getItem(item);
            if (iTemplate.megaStone || iTemplate.zMove) {
                item = 'Leftovers';
            }
Thank you bro, you can close this now. :mad:
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top