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

[Scripting Question] Indirect Level Up through Experience

  • 53
    Posts
    8
    Years
    Ok, so I'm sorry if this was already hidden somewhere, however I couldn't quite find what I'm looking for, so I hope someone can help me out :)

    Now, as the title implies, I want to have Pokémon gain Experience through other means than fighting. The main goal, of course, is to increase their level, however I don't want to use the same mechanic as the Rarecandy does, because I want it to be more individual (1 level is always 1 level, but for instance 1.000 XP can be enough to gain 1 level or not or even several levels at once, depending on the Pokémon itself and it's current level).

    I do know how to increase XP of Pokémon in general. What I do not know however is, how do I do it in such a way, that you actually see the experience increase and may act accordingly in case the Pokémon would (try to) learn a new move?

    This question may be a little confusing, so let me break it down a little.

    Let's assume a scenario where your Pokémon gets 1.000 XP. You gain those not through fighting, but in some other way.
    Now, let's assume that your Pokémon is a Lv. 6 Clefairy which already knows 4 moves.
    A Lv. 6 Clefairy gaining 1.000 XP would gain several levels, not just 1. So you will most likely end up above Lv. 10. Hence you could learn one or more new moves.

    However, if I would simply give your Clefairy 1.000 XP by something like "p1.exp+=1000", you would just end up at the highest possible level and that's it. So this would work similar to the Pokémon Pension with no possibility to change the moveset to your liking.

    How do I give out said XP, but have the game stop at every single Level Up and re-evaluate the moveset, so that you may let your Clefairy learn a new move? Can someone please enlighten me on that matter?

    I did have look at "Gaining Experience" in the battle part of the script (as that is essentially what I'm looking for, but outside of the battle). However, I am not very proficient with scripting and it is quite a lot of text there, so it did not really help me that much :(

    Thank you so much for your assistance!
     
  • 220
    Posts
    14
    Years
    • Seen Nov 29, 2021
    However, if I would simply give your Clefairy 1.000 XP by something like "p1.exp+=1000", you would just end up at the highest possible level and that's it.

    Simply copying/adapting the battle script should do it: pbGainExpOne is the code you should probably start with.
    I recommend that you start at the line " # Gain experience"
     
  • 53
    Posts
    8
    Years
    Simply copying/adapting the battle script should do it: pbGainExpOne is the code you should probably start with.
    I recommend that you start at the line " # Gain experience"

    Well, thank you for your assistance. I figured that script would be a good basis. However, if I'd known how to adjust the script, I wouldn't have asked for help in the first place =/

    Simply copying doesn't do anything and as I see it, the script for XP Gain from battles would need quite a serious revamp to do as I would want it to.
    For instance, there are not "battlers" outside a battle. Also, the whole XP Formula part is obsolete (or not helpful as is anyways), since the XP would vary greatly and not be calculated within the script (I wouldn't know how that should work). The same goes for the EV thing, as there won't be any EV to gain.

    What I'm looking for is, essentially, the Rarecandy effect but rather than from an item from various individuals and rather than gaining a level, gaining a variable amount of XP. However, the XP gain should happen level by level (as it does in a battle), in case your Pokémon gets so much XP that it would gain 1 or more levels and also it would have to check if the Pokémon would learn a new move on every level in between.

    For example:
    Alfred commends your efforts in fighting the crime in a city and presents you with the chance to increase the XP of one (or even several) of your Pokémon.
    You choose your Lv. 7 Zubat for the reward and it gains 5.000 XP.
    However, due to my limited knowledge about scripting, your Zubat just ends up at Lv. 17 or something and does not learn a single new move, which it should have.

    On another occasion you might get, for example, n XP for defeating a certain amount of trainers or perhaps for completing a mission within a set amount of time (and maybe even more if you finished it much quicker than expected) and so on.

    So the XP is not set and you should be able to decide whether your Pokémon gets to learn a new move or not, if applicable.

    I still have not the slightest idea as to how to do that.
    I can think of a work-around solution without the need to adapt any scripts, though it is rather ugly and takes up a lot of space, so I was hoping for help of someone who actually knows how that could be done with scripting.
     
    Last edited:
    Back
    Top