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

[Eventing Question] How to make an npc disappear when walking offscreen

56
Posts
5
Years
  • I've had this problem for months and i really don't know what to do about it. Here is exactly the things I'm doing.
    Player steps out of his house and onto a tile which plays the script of his rival walking up, introducing himself, and then walking away to his house. The issue is i want him to disappear ofscreen so it can be like he does go into his house. But that's my problem. I can't figure out how to make him disappear. I have-
    On the sprite thats being moved with the set move route command, created a new page with nothing on it, with the condition to switch to the page with nothing being the global switch Walked Away, which activates once the move route offscreen is done via the tile outside the player's house. However, all the npc does once offscreen is stand there, unable to be interacted with and certainly not disappeared. How do i make him disappear after walking offscreen??
     
    178
    Posts
    10
    Years
  • Player steps out of his house and onto a tile which plays the script of his rival walking up,
    introducing himself,
    and then walking away to his house.

    The issue is i want him to disappear ofscreen so it can be like he does go into his house. But that's my problem. I can't figure out how to make him disappear.

    I have-
    On the sprite thats being moved with the set move route command,
    created a new page with nothing on it, with the condition to switch to the page with nothing being the global switch Walked Away,
    which activates once the move route offscreen is done via the tile outside the player's house.
    However, all the npc does once offscreen is stand there,
    unable to be interacted with and certainly not disappeared.
    How do i make him disappear after walking offscreen??
    Look at how the rival event on a clean essentials was made. He does exactly what you want. Walk towards the player, talk and walk away. It needs very little modification, only needing to get rid of the battle part and modify the parts specific of the event.


    global switch Walked Away
    If the switch is not used anywhere else (another map), I suggest that you use the Self-Switch instead of a global one. Self-Switches are used only by the event that triggered it, that's why they are called Self Switches.
     
    56
    Posts
    5
    Years
  • So, Rival walks offscreen. When the move's completes, the self switch A is set to ON. The rival's second page has Self Switch A is ON checked under Conditions, and the graphic is set to blank to make him disappear. But...that doesn't happen. If it helps, the trigger is set to autorun?
     
    87
    Posts
    7
    Years
    • Seen Nov 22, 2023
    Edit: I fixed up my response according to Emell's corrections/suggestions:
    Another edit to fix a mistake.


    Event ID 005 (page 1) should be set to "Action Button" as your other event already serves as a controller.

    Afterwards, the second pages of both events also need to be set to "Action."

    Please see Emell's recommendation on using a variable to track storyline progression as it is a more efficient solution in your case.
    Use the script below if your event is not related to your storyline - or, use it if you please.

    In Event ID 009, use this script to set the self-switch "A" of your rival to on - insert this right after you set the Control Self Switch "A" for event 009.
    pbSetSelfSwitch(EVENT ID,SWITCH,TRUE/FALSE)
    Event ID = When editing event you will also see "ID:###"
    Switch = "A,B,C,D"
    True/False = .............
     
    Last edited:
    44
    Posts
    8
    Years
    • Seen Apr 14, 2019
    https://ibb.co/mTBhpkc Rival sprite page 1
    https://ibb.co/WyHWrhb Rival sprite page 2
    https://ibb.co/0jY3s9J Trigger page 1
    https://ibb.co/Vjv6srx Trigger page 2

    These are it

    You know you're not switching the "Self switch" for the Rival sprite's event, yeah? You're just setting it for the event with all the actions happening. A Self-Switch is an internal switch that ONLY impacts the event the Self-Switch is activated in.

    Also, try not to set anything except what is necessary to Autorun. If there's small mistakes, it can freeze up the game or mess things up.

    For situations like this, I highly recommend using a variable that tracks story progress. Then set your Rival's event to switch to the blank one with that story variable being at a certain value or higher.

    For example... Variable ### is set to 56 from stuff before event. At the end, it gets set to 57. Second page of rival event is set to be active if the variable is 57 or later.

    If you do it this way, you can track story progress and have a ton of different events based on a single variable that increases as you go. Helps save space and organize events, while making minimal extra work for stuff like a scripted solution

    Platty's solution is basically just using a script to have the Self Switch change for the other event (you can't "self" switch another event, hence why you need to use a script to use that method)

    Also, don't switch Event 009 to autorun. No idea why Platty thinks that's a good idea.

    Additionally, you don't need to set 005 to anything specifically. Just avoid autorun.
     
    87
    Posts
    7
    Years
    • Seen Nov 22, 2023
    Also, try not to set anything except what is necessary to Autorun. If there's small mistakes, it can freeze up the game or mess things up.

    I'm learning new things every day, I'll fix up my response just in case he doesn't see your response in time.

    For situations like this, I highly recommend using a variable that tracks story progress. Then set your Rival's event to switch to the blank one with that story variable being at a certain value or higher.

    For example... Variable ### is set to 56 from stuff before event. At the end, it gets set to 57. Second page of rival event is set to be active if the variable is 57 or later.
    This is very true, but again, should mostly only be done with story progression.

    Additionally, you don't need to set 005 to anything specifically. Just avoid autorun.
    I disagree on this. Setting it to Parallel Process or Autorun may cause unexpected results, as it pertains to priority issues.
    I also mentioned "Action," as it is the default trigger of an event.
     
    44
    Posts
    8
    Years
    • Seen Apr 14, 2019
    I'm learning new things every day, I'll fix up my response just in case he doesn't see your response in time.


    This is very true, but again, should mostly only be done with story progression.


    I disagree on this. Setting it to Parallel Process or Autorun may cause unexpected results, as it pertains to priority issues.
    I also mentioned "Action," as it is the default trigger of an event.

    Well, the problem with autorun is that it overrides everything else to make itself happen. Which means if there's an autorun on the map of any kind that doesn't clear itself as part of its process, it will just run indefinitely. This can look like freezes or other stuff if its something that's done in the background. Like even just a "wait 1 frame" event would freeze up the game entirely.

    Same reason why parallel processing is okay for the other event. Because it doesn't force itself to takeover, and the risk is minimized a ton.

    As for the story progression... It is story progression. The scene happened, and the story progressed. That's sort of the point. Things happen sequentially, so you can just push the story forward as needed.
     
    56
    Posts
    5
    Years
  • Thank yall for all the replies. From what I understand it,

    Emell, I should make a variable that the game increases by 1 every time a story event happens, and then have the game events happen according to that?

    Platty, I put that script into the controllers code, and it gave me a crash report. https://ibb.co/v4sCHYD
     
    87
    Posts
    7
    Years
    • Seen Nov 22, 2023
    Remove the ID: part from your script and add quotes to the switch. So it should look like this:
    pbSetSelfSwitch(2,5,"A",TRUE)


    Also, as Emell mentioned, you'd be better off using a variable instead of the script that I provided as it is more efficient in terms of story progression.
    And, you are correct - increase the variable by 1 each time you need to trigger a switch in terms of the storyline.
     
    Last edited:
    56
    Posts
    5
    Years
  • I did so and it gave me this.

    [Pokémon Essentials version 17]

    Exception: RuntimeError

    Message: Script error within event 9 (coords 8,8), map 2 (Amber Town):

    Exception: SyntaxError

    Message: (eval):2:in `pbExecuteScript'compile error
    (eval):2: syntax error
    (2,5,"A",TRUE)
    ^
    (eval):2: syntax error
    (2,5,"A",TRUE)
    ^

    ***Line '(2,5,"A",TRUE)' shouldn't begin with '('. Try

    putting the '(' at the end of the previous line instead,

    or using 'extendtext.exe'.

    ***Full script:

    pbSetSelfSwitch
    (2,5,"A",TRUE)




    Interpreter:276:in `pbExecuteScript'

    Interpreter:1606:in `command_355'

    Interpreter:494:in `execute_command'

    Interpreter:193:in `update'

    Interpreter:106:in `loop'

    Interpreter:198:in `update'

    Scene_Map:161:in `update'

    Scene_Map:159:in `loop'

    Scene_Map:168:in `update'

    Scene_Map:232:in `main'
     
    87
    Posts
    7
    Years
    • Seen Nov 22, 2023
    My apologies

    Try this:
    pbSetSelfSwitch(EVENT ID,SWITCH,TRUE/FALSE)
    Event ID = When editing event you will also see "ID:###"
    Switch = "A,B,C,D"
    True/False = .............

    So,
    pbSetSelfSwitch(5,"A",TRUE)
     
    56
    Posts
    5
    Years
  • No luck

    ---------------------------
    Pokemon Essentials
    ---------------------------
    [Pokémon Essentials version 17]

    Exception: RuntimeError

    Message: Script error within event 9 (coords 8,8), map 2 (Amber Town):

    Exception: SyntaxError

    Message: (eval):2:in `pbExecuteScript'compile error
    (eval):2: syntax error
    (5,"A",TRUE)
    ^
    (eval):2: syntax error
    (5,"A",TRUE)
    ^

    ***Line '(5,"A",TRUE)' shouldn't begin with '('. Try

    putting the '(' at the end of the previous line instead,

    or using 'extendtext.exe'.

    ***Full script:

    pbSetSelfSwitch
    (5,"A",TRUE)




    Interpreter:276:in `pbExecuteScript'

    Interpreter:1606:in `command_355'

    Interpreter:494:in `execute_command'

    Interpreter:193:in `update'

    Interpreter:106:in `loop'

    Interpreter:198:in `update'

    Scene_Map:161:in `update'

    Scene_Map:159:in `loop'

    Scene_Map:168:in `update'

    Scene_Map:232:in `main'
     
    Last edited:
    1,682
    Posts
    8
    Years
    • Seen today
    Your error is due to the fact that you have a bracket on it's own line, and even suggests rearranging or using the extendtext.exe program.
    Code:
    ***Line '(5,"A",TRUE)' shouldn't begin with '('. Try
    
    putting the '(' at the end of the previous line instead,
    
    or using 'extendtext.exe'.
    
    ***Full script:
    
    pbSetSelfSwitch
    (5,"A",TRUE)
     
    56
    Posts
    5
    Years
  • Sorry, i was copying exactly what i saw in the reply. I removed the first bracket from (5,"A",TRUE), so that it was 5,"A",TRUE), and it gave me yet another error message. =.=




    Pokémon Essentials version 17

    Exception: RuntimeError

    Message: Script error within event 9 (coords 8,8), map 2 (Amber Town):

    Exception: SyntaxError

    Message: (eval):2:in `pbExecuteScript'compile error
    (eval):2: syntax error
    5,"A",TRUE)
    ^

    ***Full script:

    pbSetSelfSwitch
    5,"A",TRUE)




    Interpreter:276:in `pbExecuteScript'

    Interpreter:1606:in `command_355'

    Interpreter:494:in `execute_command'

    Interpreter:193:in `update'

    Interpreter:106:in `loop'

    Interpreter:198:in `update'

    Scene_Map:161:in `update'

    Scene_Map:159:in `loop'

    Scene_Map:168:in `update'

    Scene_Map:232:in `main'
     
    Last edited:

    Diverscope

    Pardon me
    152
    Posts
    11
    Years
  • Read the error message... You're supposed to put the bracket at the end of the line, not at the beginning.

    Code:
    pbSetSelfSwitch(
    5,"A",TRUE)

    Or you use the extendtext.exe, so it will all fit in one line.
     
    Last edited:
    Back
    Top