Forum rules - please read before posting.

Change custom(non-item) cursor when inventory on hotspot

Hello,

I would like to change the cursor into a different cursor when an inventory item is hold. Instead of using the inventory cursor, a custom one.

I also don't want to use the use on prefix so I set the Invetory Cursor setting to Change cursor when inventory selected

created a new icon on cursor manager

then on script I tried this one:

    private void OnEnable()
    {
        EventManager.OnInventorySelect += OnInventorySelect;
            EventManager.OnHotspotSelect += OnHotspotSelect;
    }

    private void OnInventorySelect(InvItem _int)
    {
        AC.KickStarter.cursorManager.pointerIcon.texture = AC.KickStarter.cursorManager.mouseOverIcon.texture;
    }

    private void OnHotspotSelect(Hotspot hotspot)
    {
        AC.KickStarter.cursorManager.pointerIcon.texture = AC.KickStarter.cursorManager.GetCursorIconFromID(3).texture;;
    }

but it still shows the item icon when I select an item and then hover on the hotspot

am I missing something?

Thanks

Comments

  • edited January 2021

    Depending on your interface settings, OnHotspotSelect is triggered when you hover over a Hotspot. Is this what you're looking to do? You should probably do a check to see if an item is selected at this moment, i.e.:

    private void OnHotspotSelect(Hotspot hotspot)
    {
        if (KickStarter.runtimeInventory.SelectedItem != null)
        {
            // Item is selected, do stuff
        }
    }
    

    If you've set the When inventory selected field to Change Cursor, though, then the above will have no effect - since you're affecting the pointer graphic, not that of the inventory.

    Setting aside the state of the Hotspot label for a moment, try setting this instead to Change Hotspot Label. Does it then work?

  • when I select an inventory item I want to show the regular icon until I hover on an hotspot.

    so basically I want to use the same inventory icon for all items, but also want to show the regular pointer icon when not hover an hotspot

    I tried change hotspot label but the pointer didnt change

    by the way unity version: 2019.4.8f1
    ac version: 1.71.7

  • when I select an inventory item I want to show the regular icon until I hover on an hotspot.

    I understand - but first it's necessary to get the cursor changing in the first place.

    When set to "Change Hotspot Label", what cursor is used normally when over a Hotspot? The "Main Cursor", or "Hotspot Cursor"?

    What cursor rendering are you using? It would be best to see a screenshot of both your Cursor and Settings Managers.

  • Apologies the cursor changed, I updated the size of it so it's clear now

    so what I'm trying to do step by step:
    1) when select an item, show the regular cursor - ok
    2) on hover the hotspot with item selected show new cursor - ok
    3) on hover hotspot don't show Use .. On ... text - not working
    4) on use unmatched item on hotspot show failed cursor -working
    5) on deselect hotspot show original cursor - ok

    so I just need to remove the hotspot text

  • current hardcoding solution is

    Hotspot.cs Line 389, entering the labelprefix empty so it will only show the hotspot name

    is this possible without hardcoding on Hotspot script?

    thanks

            public string GetFullLabel (int languageNumber = 0, int cursorID = -1)
            {
                if (KickStarter.stateHandler.gameState == GameState.DialogOptions && !KickStarter.settingsManager.allowInventoryInteractionsDuringConversations && !KickStarter.settingsManager.allowGameplayDuringConversations)
                {
                    return string.Empty;
                }
                return AdvGame.CombineLanguageString(
                                string.Empty,
                                GetName(languageNumber),
                                languageNumber
                                );
                /*
                return AdvGame.CombineLanguageString (
                                KickStarter.playerInteraction.GetLabelPrefix (this, null, languageNumber, cursorID),
                                GetName (languageNumber),
                                languageNumber
                                );
                */
            }
    
  • As part of the next update, I am looking to add a "Do nothing" option to the Cursor Manager's When Inventory selected option - so that should allow for both the cursor and Hotspot label to remain unchanged, yes.

  • thanks, that sounds as a good solution

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.