• 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] Setbatlerule won't work

  • 26
    Posts
    1
    Years
    • Seen Dec 15, 2023
    I feel like I'm very dumb I've recently been trying to make a battle where your character doesn't return to Nurs Joy
    After losing but for some reason it keeps saying setbatlerule undefined I've looked around on the internet and I know for a fact that this is what you're supposed to do so I don't know what I'm doing wrong someone please help me
     
  • 26
    Posts
    1
    Years
    • Seen Dec 15, 2023
    Here are the images
     

    Attachments

    • Setbatlerule won't work
      16619952939795696496838622773371.jpg
      1.2 MB · Views: 20
    • Setbatlerule won't work
      20220831_200842.jpg
      1,012.1 KB · Views: 9
  • 23,702
    Posts
    11
    Years
    • She/Her, It/Its
    • Seen today
    Well, it says that it can't find the method. Have you made sure that it exists and that it is known within the context of your event? Maybe there's some spelling error or something?
     

    StCooler

    Mayst thou thy peace discover.
  • 9,304
    Posts
    4
    Years
    • Seen yesterday
    Thespelling is wrong. You wrote:
    Code:
    setBatleRule("double")
    (mind the single "t") instead of:
    Code:
    setBattleRule("double")
     
  • 26
    Posts
    1
    Years
    • Seen Dec 15, 2023
    Okay well it works now first off I want to say thank you secondly God I feel like such a dumbass how do I miss that either way it's all good now
     
  • 26
    Posts
    1
    Years
    • Seen Dec 15, 2023
    Okay now I have another question how do you make it to were even if you lose the battle you can no longer fight that opponent and one more question after that how do you make it to where your trainer has to choose to get rid of a Pokemon I'm pretty sure these methods do exist in the game I just don't know how to do them
     
    Last edited:
  • 104
    Posts
    2
    Years
    • Seen Mar 12, 2024
    Battles are a conditional branch. If you are just copying the examples from base essentials, you have to turn on "set handle for when conditions do not apply check box." It will add an "else" in between the original script and "branch end". Add "Control Self Switch = A" underneath the else (or whatever switch you are using to determine the battle has been beaten) and that should make the battle unbattlable even on a lose.

    Note, anything you add between "else" and "branch end" will happen on a lose, and anything you put before it will happen on a win. This is also how you do different dialogue after winning or losing a battle.
     
  • 26
    Posts
    1
    Years
    • Seen Dec 15, 2023
    Thank you very much I am now one step closer to completing this event now I just need to figure out how make the player delete a Pokemon from their team
     
  • 26
    Posts
    1
    Years
    • Seen Dec 15, 2023
    Okay so the last thing I'm trying to figure out is how to make it to were when you end up losing the batter you must give the trainer one of your Pokemon if anyone knows the answer please tell me I'm so close to ending this thing
     

    Attachments

    • Setbatlerule won't work
      20220905_180847.jpg
      917.9 KB · Views: 3
    • Setbatlerule won't work
      20220905_180636.jpg
      590.2 KB · Views: 4
    Last edited:
  • 104
    Posts
    2
    Years
    • Seen Mar 12, 2024
    You used the wrong script (looks like an old one). The script to remove Pokemon is:
    Code:
    $player.remove_pokemon_at_index(
     pbGet(1))
     
  • 26
    Posts
    1
    Years
    • Seen Dec 15, 2023
    Okay so the thing is I have used that one before but when I used it it didn't work I tried using it again since you recommended it but it still doesn't work I've tried putting it in many different ways but it still doesn't work it either says expecting end of input or just unidentified method is there any way to fix this
     
    Last edited:
  • 104
    Posts
    2
    Years
    • Seen Mar 12, 2024
    The script " (pbGet(1)) " doesn't work by itself. You have to have the choose script before it, specifically putting a Pokemon into Variable 1. Your original script had it, so I didn't mention it.
    You also didn't copy the code right. You need to put " (pbGet(1)) " in the parentheses where you have the "0", exactly like my previous code was. Those parentheses is what is being removed. A full example script for choosing a Pokemon and deleting it looks like this.

    Code:
    pbChoosePokemon(1,2)
    $player.remove_pokemon_at_index(
     pbGet(1))
     
  • 26
    Posts
    1
    Years
    • Seen Dec 15, 2023
    Okay I did it exactly like in the picture but it still didn't work I'm probably being dumb and missing something could you please tell me what it is this is probably annoying you I'm sorry
     

    Attachments

    • Setbatlerule won't work
      16625926321182777093155324519780.jpg
      81 KB · Views: 4
  • 1,409
    Posts
    10
    Years
    • Seen today
    Okay I did it exactly like in the picture but it still didn't work I'm probably being dumb and missing something could you please tell me what it is this is probably annoying you I'm sorry

    Take a close look at your error, it's plain as day what the issue is. It's simply another typo issue, you need to be more careful with what you're typing.

    More specifically, $pLayer is obviously wrong, it should be $player.
     
  • 26
    Posts
    1
    Years
    • Seen Dec 15, 2023
    Take a close look at your error, it's plain as day what the issue is. It's simply another typo issue, you need to be more careful with what you're typing.

    More specifically, $pLayer is obviously wrong, it should be $player.
    Okay that's very weird for some strange reason every time I looked at the code I registered it as supposed to be a capital L for some reason I have no explanation for that that's just weird it seems I still have one problem though after doing all this correctly it gave me this message so what am I still missing?
     

    Attachments

    • Setbatlerule won't work
      16626541367233799589999137889619.jpg
      1.6 MB · Views: 5
  • 1,409
    Posts
    10
    Years
    • Seen today
    Okay that's very weird for some strange reason every time I looked at the code I registered it as supposed to be a capital L for some reason I have no explanation for that that's just weird it seems I still have one problem though after doing all this correctly it gave me this message so what am I still missing?

    $player.party
     
  • 104
    Posts
    2
    Years
    • Seen Mar 12, 2024
    This is the script:
    Code:
    pbChoosePokemon(1,2)
    $player.remove_pokemon_at_index(
     pbGet(1))


    Copy that script EXACTLY. The best thing to do is to just copy and paste it. If you get another "undefined method" error, that means you typed it wrong. So just retype it again.

    The script works, I've tested it multiple times now. Typing out EXACTLY what scripts say is very important, so don't take shortcuts, try to fix previously written scripts, or assume spelling on words.
     
  • 26
    Posts
    1
    Years
    • Seen Dec 15, 2023
    It works thank you so much for all your help I feel pretty stupid seeing how easy it was to fix and it took me this long to figure it out but whatever thank you very much for your help I finally put this behind me and continue on other stuff
     
    Back
    Top