• 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] How to make it so game detects if you use a certain move?

10
Posts
2
Years
    • Seen Jun 13, 2022
    I'm a bit new to RPG Maker Xp and Pokemon essentials, but I've been wanting to know if there's a way for the game to detect if you use a certain move to defeat a pokemon in a battle.
    For context, my idea is that I want to make a game that lets you "Kill" pokemon. But I don't just want to make it so when it faints, it 'dies.' I still want the player to be able to choose to either faint the pokemon or kill it. So I thought by making it a specific move, (along with a special type) it'll set a variable that sends the player down a different path. Making it a move seems the easiest way to do it, because I'm going to make it so you can only learn these moves from the evil team.
    Context done, is there anywhere in the script that tracks what killed a pokemon in a specific battle? I know it tracks if it's been caught or fainted (obviously) so is having it 'killed' an option? If there isn't, is there an easy way to make a script to do it? Or maybe a workaround that achieves a similar affect? (With the player being able to choose to go down 'Evil' route during a battle)
     
    95
    Posts
    4
    Years
  • The simple way would be to have a tag (or a counter) activated (or incremented) every time your specific attack hits the goal.
    Use a game variable for a counter and a game switch for a tag.
    You just have to think about putting conditions downstream so that the consequences can be expressed at the right time (loss of "karma", multiplication of experience gains, different reaction of the trainer during or after the fight ...). As an indication, the outcome of the battle is set by default on the variable 1. This is what is used in vanilla scripts to know, for example, if the Pokémon of a fixed encounter has been captured (and disable its event if necessary).

    Finally, do not forget to reset the tag or the variable to its initial value once the consequences have been applied. (To avoid that the game thinks you killed another Pokémon in the next battle).
    A solution to never forget to do this is to place the code that resets this variable at the beginning of each fight.
     
    10
    Posts
    2
    Years
    • Seen Jun 13, 2022
    I should rephrase, my question is WHERE in the script can I make it so when I use a specific attack (And the pokemon faints) it sets up a variable/counter? Like you said I should do that but my confusion is I don't know where/how. Thx for the other advice though!
     
    1,406
    Posts
    10
    Years
    • Seen today
    Honestly, i would implement this in the code for the move effect ITSELF, rather than in the battle code. The move Fell Stinger already tracks if the target was KO'd with the attack to boost the users stats. I would adapt that code and instead of the stat boost, add your counter there.
     
    Back
    Top