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.
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.
Yes, it is controlled by flags. When you get the Eon Ticket, Aurora Ticket, Mystic Ticket, and Old Sea Map legitimately, a flag is checked, allowing the person on the boat to recognise that you have the item in your bag. In order to make this work in your game, just use a script similar to this:
Spoiler:
'---------------
#org 0xXXXXXX
lock
faceplayer
checkflag 0x1201
if 0x1 goto 0x8E3C889
msgbox 0x8E3C894 MSG_KEEPOPEN '"I travel a lot around the area.\nI..."
giveitem 0xYYY 0x1 MSG_OBTAIN
setflag 0xZZZ
setflag 0x1201
lock
faceplayer
msgbox 0x8E3C8F1 MSG_NORMAL '"Sorry, I don't have any gifts for\..."
release
cmdc3 0x0
'---------------
#org 0xE3C889
lock
faceplayer
msgbox 0x8E3C8F1 MSG_NORMAL '"Sorry, I don't have any gifts for\..."
release
cmdc3 0x0
'---------
' Strings
'---------
#org 0xE3C894
= I travel a lot around the area.\nI actually have another item if you\lwant one.\pHere take it!
#org 0xE3C8F1
= Sorry, I don't have any gifts for\nyou right now. Come back later.
In this case, replace the XXXXXX with the offset of your script (make sure there's enough free space)