Forum rules - please read before posting.

Remove Click Marker when Player reaches Destination

Hello there Chris and all the AC group!
So, I've released ENCODYA not even 2 months ago and I'm up for a new game that relies on Adventure Creator!
Something totally different...
This time I'm using a "Click Marker" and I wonder: is it possible to remove it when the Player reaches the destination?
I've a "looped" prefab as click marker (so I'm not relying on the time since spawn). And what I would like is to remove it from the scene when the player reaches the prefab (therefore the destination).
I'm using point-and-click movement system, so there's a path-finding and basically I'd like to write a script to remove the instantiated prefab (click marker) when the Player reaches the end of that path.
I've tried to read the api, but couldn't find a way... (I guess comparing in update player.transform with destionation.transform is not the best... right? I guess there's an event called?)
Any hint is very welcome!

Comments

  • I guess there's an event called?

    Yes - OnCharacterEndPath is what you want:

    void OnEnable () { EventManager.OnCharacterEndPath += OnCharacterEndPath; }
    void OnDisable () { EventManager.OnCharacterEndPath -= OnCharacterEndPath; }
    
    void OnCharacterEndPath (Char character, Paths path)
    {
        if (character == KickStarter.player)
        {
            // Remove the click marker
        }
    }
    

    For a full list of character-related events, see the Manual's "Character scripting" chapter.

  • Awesome, thanks!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.