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

Some questions about Wild battle

32
Posts
11
Years
    • Seen Jul 26, 2015
    Hey, in RSE versions, when you're battling a zigzagoon, you can't flee, but the text is not "Can't escape", like in the essentials, there is another way to edit the text than editing the script? (i dont want this text permanent, just for this battle), and when the player's lifebar is in red color the wild pokemon flees.

    how can i do it? (that the wild pokemon flees and to change the text when can't escape).

    Thanks!
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    You could always do the old favourite of using a Global Switch to decide whether this is your special battle, and display a different message if so. It's simple enough to set up. It'll be the first "Can't escape!" message in def pbRun.

    You can set up a wild battle as one which the player can't ever escape from. Check the wiki.

    The wild Pokémon fleeing is slightly more involved, but it works on the same principle. Check the def pbProcessTurn and copy-paste the "alwaysrun" bit (which is used for roaming Pokémon) and make it apply only while the Switch is ON and the player's Pokémon is weak.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    I didn't tell you to put anything in pbBeginTurn.

    Try using pbOpposing1.hp (I assume it'll be a single battle). Also, you've done the "if" statement wrong (you've deleted the hp check and some &&).
     
    32
    Posts
    11
    Years
    • Seen Jul 26, 2015
    i made it like that, below the original one, because i wanted to change the text (if i used "Or" statement it showed me only "fled" in the battle.

    if [email protected] && @battle.rules["alwaysflee"] && self.hp>0 &&
    @battle.pbIsOpposing?(self.index) && @battle.pbCanRun?(self.index)
    pbBeginTurn(choice)
    @battle.pbDisplay(_INTL("{1} fled!",self.pbThis))
    @battle.decision=3
    pbEndTurn(choice)
    return
    end
    if $game_switches[55] && pbOpposing1.hp<4
    pbBeginTurn(choice)
    @battle.pbDisplay(_INTL("Wild Zigzagoon fled!"))
    @battle.decision=3
    pbEndTurn(choice)
    return
    end

    It works, almost, the wild zigzagoon flees when his hp is low than 4, not when the player's hp is low than 4, i tried to change the pbOpposing1 to pbOppsing2 and then again to pbOppsing0, and it didnt work.
    (sry about my english, this is my second language)
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Oh, so you did put it in the right place.
    Code:
        if [email protected] &&
           $game_switches[55] && self.hp>0 && self.pbOpposing1.hp<=(self.pbOpposing1.totalhp/4) &&
           @battle.pbIsOpposing?(self.index) && @battle.pbCanRun?(self.index)
          pbBeginTurn(choice)
          @battle.pbDisplay(_INTL("{1} fled!",self.pbThis))
          @battle.decision=3
          pbEndTurn(choice)
          return
        end
    Use that. Your problem was that you'd deleted the @battle.pbIsOpposing?(self.index) bit, which meant that, in your game, the fleeing happened when either Pokémon reached a low HP, not just the wild Pokémon.

    The displayed message in my code will be "The wild Zigzagoon fled!", so you don't need to change it.
     
    32
    Posts
    11
    Years
    • Seen Jul 26, 2015
    i didnt knew how to do this only for the opponent, i'm not new in ruby, but i am new in essentials, Thannk you :)
    Edit: Works perfect :)
     
    Back
    Top