• 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 on scripts

199
Posts
14
Years
    • Seen Jul 6, 2022
    1- In my game there is a Pokemon Gym based in Pokemon uses only with the attack Metronome, but ... the trainer changes Pokemon every 2 turns if it takes only this attack.
    There is some form of which it does not do it? The same thing I want to know for a trainer that it has 6 Magikarps that only use Splash.



    2- In another topic of this forum I saw a script to do that the Pokemon of the team lose HP.
    for i in $Trainer.pokemonParty
    i.hp-=42
    end
    I have a zone in my game in which I want to put damned cartels that hurt the team, but the Pokemon remain with 0 HP on having read the third cartel, and the protagonist is not sent to the Center Pokemon, and when it does a battle this error goes out:

    ---------------------------
    Pokemon Essentials
    ---------------------------
    Exception: RuntimeError
    Message: Script error within event 8, map 73 (Faraday Island):
    Exception: RuntimeError
    Message: Section069:711:in `pbStartBattleCore'Player has no unfainted Pokémon
    ***Full script:
    pbWildBattle(PBSpecies::MEW,30,1)
    Interpreter:243:in `pbExecuteScript'
    PokeBattle_Battle:512:in `pbStartBattle'
    PokemonField:990:in `pbWildBattle'
    PokemonField:989:in `pbSceneStandby'
    PokemonField:991:in `pbWildBattle'
    PokemonField:988:in `pbBattleAnimation'
    PokemonField:988:in `pbWildBattle'
    (eval):1:in `pbExecuteScript'
    Interpreter:1600:in `eval'
    Interpreter:243:in `pbExecuteScript'
    Interpreter:276:in `pbExecuteScript'
    Interpreter:1600:in `command_355'
    Interpreter:494:in `execute_command'
    Interpreter:193:in `update'
    Interpreter:106:in `loop'
    Interpreter:198:in `update'
    Scene_Map:103:in `update'
    Scene_Map:101:in `loop'
    Scene_Map:114:in `update'
    Scene_Map:68:in `main'
    Is it possible to do that they receive less hurt to reading the damned cartels and that if the HP of the Pokemon come to 0, the protagonist appears in the pokemon center?

    EDIT: Already I know do like that receive less hurt (changing the number 42 to 10 for example, it goes for HP), so only need to do that the protagonist goes to the center pokemon.


    3- There is some way of using a Switch to do that a wild pokemon is not registered in the Pokedex?


    Thank you in advance! :D
     
    Last edited:
    12
    Posts
    13
    Years
    • Seen Feb 17, 2017
    1- You could do something in the AI, aI don't know what
    2- try:
    Spoiler:

    but I'm not sure.
     
    Last edited:
    199
    Posts
    14
    Years
    • Seen Jul 6, 2022
    1- You could do something in the AI, aI don't know what
    2- try:
    Spoiler:

    but I'm not sure.

    1- In the wiki I do not find any guide of since it modifies it.
    I remember that in old versions of the essential, the trainer was not doing it if only it was taking Metronome or Splash.


    2- Thanks you, but I already did it of another form, put a condition and effect of PbAllfainted (It detects if all your Pokemon are fainted), then teleport to a Pokemon Center, and to activate Common Event: Pokemon Center Heal.
     
    1,405
    Posts
    11
    Years
  • for the first one you could change how much money the trainer gives since money for some reason determines how smart the enemy is
     

    FL

    Pokémon Island Creator
    2,454
    Posts
    13
    Years
    • Seen yesterday
    1-Increase the score of the function code in PokeBattle_AI (search in scripts for 'when 0xB6', 0B6 is the Metronome function code).

    3-Use '$Trainer.seen[species]' and/or '$Trainer.owned[species]'. The line '$game_switches[105] = $Trainer.seen[PBSpecies::MEW]' put in switch 105 if you has Mew as seen in pokédex ("on" if you did seen, "off" if you didn't).
     
    Last edited:
    199
    Posts
    14
    Years
    • Seen Jul 6, 2022
    1-Increase the score of the function code in PokeBattle_AI (search in scripts for 'when 0xB6', 0B6 is the Metronome function code).

    3-Use '$Trainer.seen[species]' and/or '$Trainer.owned[species]'. The line '$game_switches[105] = $Trainer.seen[PBSpecies::MEW]' put in switch 105 if you has Mew as seen in pokédex ("on" if you did seen, "off" if you didn't).

    1- I don't understand this:

    when 0xB4
    score-=140 if attacker.status!=PBStatuses::SLEEP
    score+=70 if attacker.status==PBStatuses::SLEEP
    when 0xB5
    when 0xB6
    when 0xB7
    score-=80 if opponent.effects[PBEffects::Torment]
    What have I to do in this line? It has things about sleep

    I found this in AI:
    # special case: attacker has no damaging moves
    hasDamagingMove=false
    for m in attacker.moves
    if move.id!=0 && move.basedamage>0
    hasDamagingMove=true
    end
    end
    if !hasDamagingMove
    score+=75
    end
    end
    I do not know how to put Metronome and Splash as an exception.
     
    Last edited:

    FL

    Pokémon Island Creator
    2,454
    Posts
    13
    Years
    • Seen yesterday
    1- I don't understand this:

    What have I to do in this line? It has things about sleep

    I found this in AI:

    I do not know how to put Metronome and Splash as an exception.
    Sorry, I missed this part. To put both as exception, change 'if move.id!=0 && move.basedamage>0' to 'if move.id!=0 && (move.basedamage>0 || move.function==0x01 || move.function==0xB6)'. The 0x01 function code is splash.
     
    Last edited:
    199
    Posts
    14
    Years
    • Seen Jul 6, 2022
    Oooh! Thank you very much, FL!! :D

    for the first one you could change how much money the trainer gives since money for some reason determines how smart the enemy is
    Is maximum 100?

    EDIT: FL, I have done what you said but it does not seem that it has changed anything. The trainer rival continues changing Pokemon every 2 turns if only it has Metronome or Splash.
     
    Last edited:

    FL

    Pokémon Island Creator
    2,454
    Posts
    13
    Years
    • Seen yesterday
    My bad. I didn't read the code properly, so I made a big mistake. The code that you change is in the Baton pass effect (0xED).

    I belive that you need to change line 'if scores>0 && attacker.moves.basedamage>0' to 'if attacker.moves.function==0x01 || attacker.moves.function==0xB6 || (scores>0 && attacker.moves.basedamage>0)'

    If this doesn't works, try to change the function code directly, like:

    Code:
    when 0x01
      score-=100

    This code change the Splash function code (0x01) score reducing it to to 0 (100-100=0). Change this last line to something like 'score=110' or a big number, do the same for Metronome function code.

    If both methods don't work, try to combine them.
     
    199
    Posts
    14
    Years
    • Seen Jul 6, 2022
    My bad. I didn't read the code properly, so I made a big mistake. The code that you change is in the Baton pass effect (0xED).

    I belive that you need to change line 'if scores>0 && attacker.moves.basedamage>0' to 'if attacker.moves.function==0x01 || attacker.moves.function==0xB6 || (scores>0 && attacker.moves.basedamage>0)'

    If this doesn't works, try to change the function code directly, like:

    I've done that and it worked. Thank you very much. :classic:
     
    Back
    Top