• 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.

[Eventing Question] How to reduce the numbers of event commands in this situation.

2
Posts
3
Years
  • Age 26
  • Seen Jan 9, 2021
Hi everybody!

I'm fairly new to pokemon essential, so I don't know if my question will look stupid, but I can't find an answer myself.

I'll give you a context so you can understand what i'm going for:

Imagine a NPC that can give you any pokemon, in exchange of an item that represents the pokemon itself ( for exemple, a statut of bulbasaur = the NPC gives you a bulbasaur)

On the project i'm working on, there's 649 pokemon (gen 5), so my first idea was to do something like that:

@>Conditional Branch: Script: Kernel.pbChooseItem(1 for bulbasaur)
@> Text: whatever
@> pbAddPokemon(:BULBASAUR,5)
: Else
@>
: Branch End

And do another one for every single Pokemon, but I quickly realize that first, it's gonna take an eternity and second, it'll probably make the game lag.

Now i'm looking for a way to make this work without putting 5 years of my life on this Event alone. x)

Ty in advance! :)
 
658
Posts
7
Years
Hi everybody!

I'm fairly new to pokemon essential, so I don't know if my question will look stupid, but I can't find an answer myself.

I'll give you a context so you can understand what i'm going for:

Imagine a NPC that can give you any pokemon, in exchange of an item that represents the pokemon itself ( for exemple, a statut of bulbasaur = the NPC gives you a bulbasaur)

On the project i'm working on, there's 649 pokemon (gen 5), so my first idea was to do something like that:

@>Conditional Branch: Script: Kernel.pbChooseItem(1 for bulbasaur)
@> Text: whatever
@> pbAddPokemon(:BULBASAUR,5)
: Else
@>
: Branch End

And do another one for every single Pokemon, but I quickly realize that first, it's gonna take an eternity and second, it'll probably make the game lag.

Now i'm looking for a way to make this work without putting 5 years of my life on this Event alone. x)

Ty in advance! :)

Since every item is unique in this case, you're gonna need unique conditional branches for each case. However, if you do this through scripting then it will be much easier.

So what you need to do is make an array of the items, make sure that the items are in correct pokedex order Eg.[:BULBASAURITEM,:IVYSAURITEM,:VENUSAURITEM......:KELDEOITEM,:MELOETTAITEM:GENESECTITEM]. Then using a method, you check whether the item selected by the player in included in the array. If yes then save find the index of the item in the array use pbAddPokemon (index of item).

I'll try to think of a more efficient way but this is what I can come up with off the top of my head.
 
2
Posts
3
Years
  • Age 26
  • Seen Jan 9, 2021
Since every item is unique in this case, you're gonna need unique conditional branches for each case. However, if you do this through scripting then it will be much easier.

So what you need to do is make an array of the items, make sure that the items are in correct pokedex order Eg.[:BULBASAURITEM,:IVYSAURITEM,:VENUSAURITEM......:KELDEOITEM,:MELOETTAITEM:GENESECTITEM]. Then using a method, you check whether the item selected by the player in included in the array. If yes then save find the index of the item in the array use pbAddPokemon (index of item).

I'll try to think of a more efficient way but this is what I can come up with off the top of my head.

That's a good idea, thank you! I've never tried scripting something myself before, but I understand the logic behind it, so i'll give it a try! Maybe i'll just try to find a script that does something similar too.

if you find something else, I'll be happy to know it :)

Just one thing, where should I add the script? is there a specific place for it or I can basically put it where I want?
 
Last edited:
Back
Top