Forum rules - please read before posting.

Change Cursor when over 2d Trigger?

(Unity 2018.3.6f1, AC 1.66.8)

In all of my previous 2d games I've made it so that the player changes Scenes by clicking on a Hotspot, which makes him walk to its associated Marker, and when he gets there the Scene changes

That works fine as far as it goes, but it isn't ideal. For example, the player character may only be a couple of pixels away from the "Scene Change" area, but he still walks all the way to the Marker before the Scene changes

Using a Trigger is a far more natural way of controlling this, because he can click on any area within its bounds, he walks towards that point, and the Scene changes as soon as he enters the Trigger. So, that's the mechanism I'd like to use in the project I'm currently working on

Clearly, all quite easy to set up. BUT (and there's always a but), there's no obvious way to unobtrusively let the player know that by entering the Trigger he will be changing Scenes

My preferred method would be to change the Cursor when it's over the Trigger in the same way that it changes when over a Hotspot, but that isn't an option in vanilla AC

Using a Hotspot instead of a Trigger and having the Player walk to the place on the screen where he's clicked rather than to the Hotspot's Marker would work, but... that isn't an option in vanilla AC either

So, I'm guessing a custom script will be necessary, but I can't quite get my head around precisely how to approach the problem, so any suggestions welcome

Comments

  • Interesting... Sorry I cannot help, just replying so I can follow up.

  • edited February 2019

    I think I've experienced this problem.

    You can use a trigger and hotspot in the same place and set the 'single use interaction' option checked on the hotspot, that does change the cursor when you mouse over it. You can then set that one interaction to a new cursor you made to indicate leaving scenes.
    But the problem there is you can't set that cursor to a 'walking' one, so your only other option is to set the hotspot to make the player walk to it. The problem there is the character just walks near to the trigger/hotspot rather than on it.

    I ended up just using the hotspot label as the indicator to the player that the area will change scenes.

  • edited February 2019

    @chaosmonger no problem, I often keep a watch on posts here if they seem to be relevant to stuff I'm doing, or trying to do, at the time

    @ZcheK yeah, combining Triggers and Hotspots was one of the things I've already tried, but as you say it doesn't really work (plus, even if it did work there would be the inconvenience of having to add a corresponding Hotspot to every Trigger)

  • But the problem there is you can't set that cursor to a 'walking' one, so your only other option is to set the hotspot to make the player walk to it. The problem there is the character just walks near to the trigger/hotspot rather than on it.

    Sorry, but I don't follow this. Use of a Hotspot / Trigger combined should be a viable option. You can define which cursor is associated with the "single-use" interaction, and have the Player move to a Marker - which will get interruped by the Trigger so long as it's not a cutscene.

    Bear in mind that you can attach both components to the same object - so that they share the same collider.

    Another option is to do without a Trigger, but set the Hotspot's Player action to Walk To. This lets you set a proximity value, so that the Interaction gets run once the Player is within a set distance from the Hotspot's centre.

  • Thanks Chris

    Neither of those options does quite everything I was hoping to achieve (that the Player walks to where he had actually clicked on the screen, and then the screen changes), but it's close enough, and both options do at least allow me to indicate to the Player which areas of the screen will lead to location changes

    I'll probably go with the first option in practise, combining the Trigger with a Hotspot on a single GameObject (something I never even thought about trying)

  • edited February 2019

    As a small p.s. after playing around with the options for another hour or so, I can't make the Trigger/Hotspot combination work reliably enough for my purposes, so I'm abandoning it, and going back to just using Triggers. I'll figure out some other method to let the player know that walking on some areas will trigger a scene change (or they can just blooming well figure it out for themselves)

    Hard to describe what the problem is, precisely, but it seems to be when the player is standing too close to a Trigger/Hotspot combination, and refuses to walk to it for some reason, so they just stand sullenly around until you move them far enough away, and THEN they'll walk to it

    I'm not too worried. The change of cursor to indicate walkable areas, although it SOUNDED like a good idea, turned out to be just a wee bit confusing during actual gameplay...

  • it seems to be when the player is standing too close to a Trigger/Hotspot combination, and refuses to walk to it for some reason, so they just stand sullenly around until you move them far enough away, and THEN they'll walk to it

    I can only go by hunch, but it may be because your Settings Manager's Destination accuracy slider is too low. This value controls "how close is close enough" when determining if a character need walk somewhere or not.

    You also have the option of enabling "Retro pathfinding" mode in the character's Inspector, for total accuracy.

    that the Player walks to where he had actually clicked on the screen

    Ah, I didn't appreciate this. If the area in question is large enough then yes: I'd imagine it would be noticable if he always walked to the same position.

    One thing you can do is actually change the position of the Marker itself at the moment the player clicks on the Hotspot - through the use of the OnHotspotInteract custom event:

    http://pasteall.org/1518231/csharp

  • edited February 2019

    Of course! Reposition the Marker!

    Now, why didn't I think of that myself? (Well, that's why you're the professional and I'm just the Sunday afternoon nurdler, I guess...)

    If I decide to go back to using Hotspots instead of Triggers for scene changes then I'll definitely try that out... and in fact I think I'll definitely try it in another project I've got on the go, because all the scene changes there are already set up to use Hotspots

    As to the accuracy thingee, I've now set it to 1 (it was 0.8), to see if that cures the problem where the player character just hangs idly around even though the player's clicked on a navigable area of the screen

  • edited February 2019

    Soooo... I went back to that other project, and changed all the Hotspot scene changers to use your Marker Shift doodab, and... it works perfectly

    From a player's perspective it makes for a much more natural feeling transition, tbecause the character walks to the spot that the player has selected, rather than to an arbitrary looking place on the screen

    Thanks, as always, for the assistance

  • sorry to ressurect this old topic. But the pasteall url doesnt work any longer. how would one go about doing this nowadays?

  • This thread covers the same topic of repositioning a Marker when clicking a Hotspot.

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.