• 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] Help with forced battles

1
Posts
5
Years
    • Seen Feb 5, 2019
    Hello! I honestly wasn't sure if this was going under Scripting or eventing, but nevertheless:

    I'm trying to force the player into a battle during an event/"cutscene", I've gotten around the part of changing the event to another, I think, which is why I'm including that one as well. Like I've said, I don't want to walk next to the npc or the exclamation mark to make the battle happen, I just want to be thrown into the battle after some dialogue.

    Pretty new to essentials, but youtube and thorough google-searching hasn't helped, which is why I'm here.

    Starting the event:
    P1
    Conditions; None
    Trigger: Action Button
    Code:
    >Text:
    >Wait: 30 frame(s)
    >Text:
    >Wait: 20 frame(s)
    >[COLOR="Red"]Control switches: [0061: Battle Rival 1] = ON[/COLOR]

    Battle "Start":
    P1: Empty
    P2:
    Code:
    Conditions: Switch: 0061: Battle Rival 1 > is ON
    Trigger: Parallel Process
    >[COLOR="RoyalBlue"]Conditional Branch: Switch [0061: Battle Rival 1] == ON[/COLOR]
    >[COLOR="YellowGreen"]Comment: Type: RIVAL3[/COLOR]
    >[COLOR="yellowgreen"]Comment: Name: ???[/COLOR]
    >[COLOR="yellowgreen"]Comment: Continue: True[/COLOR]
    >[COLOR="yellowgreen"]Comment: Outcome: 26[/COLOR]
    >[COLOR="Silver"]Script: pbTrainerIntro(:RIVAL3)[/COLOR]
    >
    Else
    >
    Branch End
    >[COLOR="silver"]Script: pbTrainerEnd[/COLOR]

    I have not yet fixed the aftermath of the battle as I don't know if it's necessary, aswell as the last script (pbTrainerEnd) is necessary,
     
    233
    Posts
    5
    Years
    • Seen Oct 9, 2023
    You don't need a separate trainer event for the trainer battle, just use the "pbTrainerBattle" function directly after the event dialogue:

    Spoiler:


    Edit: If you need more information, you can find it on the wiki in the "Trainers" page, under the section "Structure of trainer events." I would link it, but I can't post links yet :(
     
    Last edited:
    Back
    Top