I am trying to get this script and LevelBalance by Joltik to work together. The game runs fine, however the over-world sprites don't show the evolution, I am not sure which script to be looking at to try and edit. any help would be awesome.
I too have the same problem with Vendily's Rescue Chain script.
Sometimes, instead of having the Pokémon sprite evolved, the script overworlds wild encounter gives me the sprite of the pre-evolved form.
I couldn't change this bug.
For example: I meet an overworlds wild Pidgey and it is a Pidgeotto that appears in battle.
The Event @@OnWildPokemonCreate defined in module Events in script section PField_Field is used to modify a pokemon on creation before the battle starts.
A procedure can subscribe to this event by adding itself to the event. It will then be called whenever the event occurs.
For example to make a pokemon shiny then the shinyPokemonswitch is active uses this event.
In the visible overworld wild encounter script, this Event @@OnWildPokemonCreate is trggered twice.
Once then a pokemon is created for spawning and the other time then going into battle with an already spawned pokemon.
Clearly, in the first case the pokemon needs to be generateed for the alternative form, gender, the shinyness, the level and the species of cource to know the correct sprite.
In the other situation the pokemon needs to be generated again to know its stats and so on for the battle.
Triggering @@OnWildPokemonCreate twice yields to the problem that the sprite and the pokemon in battle can differ from each other. This can occure for example for the battle leveling script by Joltik
https://www.pokecommunity.com/showthread.php?t=409828 , where the species can be changed on creating for spawning and again on creating for the actual battle with a spawned pokemon.
If you want to add a procedure that modifies a pokemon only for spawning but not before battling then you can do it. You need the version 1.11.1 (edit) or higher of the visible overworld wild encounter script and need to use the new Event @@OnWildPokemonCreateForSpawning.
You can use this event the same way as you did with @@OnWildPokemonCreate.
Note that OnPokemonCreate is also triggered when a pokemon is created for spawning,
But OnPokemonCreateForSpawning is not triggered when a pokemon is created in other situations than for spawning.
Here is an easy example. It makes all pokemon spawn as shinies.
Code:
Events.onWildPokemonCreateForSpawning+=proc {|sender,e|
pokemon=e[0]
pokemon.makeShiny
}
Now, I will also give a way to modify already existing scripts such as Level Balancing by Joltik to trigger only on spawning of a pokemon and not on battling again.
Simply search for all code in the script that is added to @@OnWildPokemonCreate by
Code:
Events.onWildPokemonCreate+=proc {|sender,e|
#Here is the code
}
and add it to @@OnWildPokemonCreateForSpawning instead by
Code:
Events.onWildPokemonCreateForSpawning+=proc {|sender,e|
#Here is the code
}
Make sure that the code only affects the species, level gender, alternative form and the shinyness of the pokemon. This should be the case for the script level balancing by Joltik for example.
If it also affects other parameters of the pokemon, such as the stats, then that modifications don't work anymore.
I would be happy if you could test that and let me know if it worked.
For NTests issue with Vendilys Rescue Chain the solution above will not work properly since NTest uses wild overworld encounters and normal encounters at the same time.
So, to make Vendilys Rescue Chain work for both types of encountering, we still need the original script for Vendilies Rescue Chain and that it triggers on creation, to make it work for ordinary encounters.
But we have to change Vendilys Rescue Chain to not trigger then battling a spawned pokemon.
This can be done by changing
Code:
Events.onStartBattle+=proc {|sender,e|
#Here is all the code that modifies the species and level of Vendilys original script
}
to
Code:
Events.onStartBattle+=proc {|sender,e|
if !$PokemonGlobal.battlingSpawnedPokemon
#Here is all the code that modifies the species and level of Vendilys original script
end
}
Make sure to use version 1.11.2 (edit) or higher of the visible wild overworld encounter script.
I would be happy if you could test that and let me know if it worked.
EDIT: corrected the script version 1.11 to 1.11.2, corrected the last code section