• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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.

[Script] HELP in NPC movement

MM980

"You said you have a dream...That dream...Make it
  • 118
    Posts
    4
    Years
    HI,
    First of all, thank you very much for helping...
    I want an NPC to the block the way, if the player has a pokemon, the NPC will walk away, anyone have an idea in this topic?
     
    There are 2 approaches you can have to this:
    - Make the NPC move out of your way but still stay in that town/area
    - Make the NPC walk away and not return

    For the first way:

    #dynamic 0x800000
    #org @start

    lock
    faceplayer

    checkflag 0x211
    if 0x1 goto @AlreadyTalked

    countpokemon
    compare 0x800d 0x1
    if 0x1 goto @GotAPokemon

    msgbox @t1 0x6

    applymovement 0xff @mplayer
    waitmovement 0x0

    release
    end

    #org @GotAPokemon

    msgbox @t2 0x6
    applymovement 0x11 @m1
    waitmovement 0x0
    setflag 0x211

    release
    end

    '------------
    #org @t1
    = Come back when you obtain\na Pokemon!

    #org @t2
    = Oh you have a Pokemon?\pProceed ahead.

    #org @t3
    = How's your Pokemon doing?

    #org @m1
    #raw 0x12
    #raw 0x11
    #raw 0x0
    #raw 0xfe

    #org @mplayer
    #raw 0x13
    #raw 0x2
    #raw 0xfe

    #org @AlreadyTalked
    msgbox @t3 0x6
    release
    end

    '---------------------
    and you can use a "movesprite2" command in a type 03 level script (after movesprite2 goes X position then Y position) so that the NPC stays in that position always after returning to that map.
    '--------------------

    Second method where the NPC walks away and doesn't return (in my opinion easier method as it doesn't require a level script to keep the NPC in position):

    #dynamic 0x800000
    #org @start

    lock
    faceplayer

    countpokemon
    compare 0x800d 0x1
    if 0x1 goto @GotAPokemon

    msgbox @t1 0x6

    applymovement 0xff @mplayer
    waitmovement 0x0

    release
    end

    #org @GotAPokemon

    msgbox @t2 0x6
    applymovement 0x11 @m1
    waitmovement 0x0
    hidesprite 0x11
    setflag 0x211

    release
    end

    '------------
    #org @t1
    = Come back when you obtain\na Pokemon!

    #org @t2
    = Oh you have a Pokemon?\pProceed ahead.

    #org @t3
    = How's your Pokemon doing?

    #org @m1
    #raw 0x12
    #raw 0x12
    #raw 0x12
    #raw 0x12
    #raw 0x12
    #raw 0x12
    #raw 0x12
    #raw 0xfe

    #org @mplayer
    #raw 0x13
    #raw 0x2
    #raw 0xfe


    '------------------

    So, essentially, the NPC will check if you have at least one pokemon, and if you do , the NPC walks away and enables the player to progress further.
    In my case I placed the npc on the left of my map and it walks away to the left if I have a Pokemon. I used (applymovement 0x11 @m1) where 0x11 is the person event number in hex (it was 17 in advance map so it is 11 in XSE).

    I also used (setflag 0x211) where 211 is the person ID number in advance map. Your NPC needs to have this so it can permanently be hidden.
     
    Thank you, It would be really awesome if you had a YouTube channel ☺
     
    Back
    Top