Forum rules - please read before posting.

How to interact with the Main Cursor

Hi again!
Sorry if I bother you, this is the second discussion I open today, but I need your help again.
I've chosen the "Choose interaction then hotspot" option.
Now, I'm the main menu of the game, which is a scene. I'm trying to do the following, but I'm currently lost:

1) I'm trying to make the "Main Cursor" the only accessible cursor in this specific scene;
2) I'm trying to make an interaction between the Main Cursor and a Hotspot.

Can someone give me a clue about these?
Thank you!

Comments

  • 1) I'm presuming that the other cursors you're referring to are the interaction cursors you get by the (optional) right-click mode to cycle through them. This is achieved via the Cursor Manager's Cycle Interactions with right-click? option.

    To disable this option, you can dynamically change its value through script at runtime. To get an API reference to any Manager field, right-click on that field's label. This particular field can be accessed with:

    AC.KickStarter.cursorManager.cycleCursors
    

    The following script can be attached to a GameObject in your scene, and will toggle the option when the scene opens/closes:

    http://pasteall.org/1399551/csharp

    2) To have a single-left-click trigger a Hotspot interaction when using Choose Interction Then Hotspot mode, go to the Hotspot's Inspector and check Single 'Use' interaction?.

  • Thank you very much!
    There's another thing I wanted to ask, but forgot: is there a way to select the interactions with keyboard shortcuts? For example, clicking "Z" selects "Look at", clicking "X" selects "Talk", etc.
    I'm asking this also because I'd like to make the Main Cursor not accessible with the right-click-cycle mode, and disabling this mode and going for keyboard shortcuts might do the trick (also because I wanted to add keyboard shortcuts in the first place).

  • Regarding point 2), I've checked the "Single Use Interaction", but when I hover with the cursor over the hotspot, the cursor changes to the "Use" one. To prevent this, I should apply the number 1) method, right?

  • Also, strangely when I right-click on the "Cycle interactions with right-click?" option, the "AC.Kickstarter-cursorManager.cycleCursors" is grey and I can't select it. Is there something I forgot to activate?

  • edited December 2018

    is there a way to select the interactions with keyboard shortcuts? For example, clicking "Z" selects "Look at", clicking "X" selects "Talk", etc.

    Yes - see the Input button field beneath each icon in the Cursor Manager, as well as the Available inputs box in the Cursor Manager.

    I've checked the "Single Use Interaction", but when I hover with the cursor over the hotspot, the cursor changes to the "Use" one.

    Create a new interaction icon that matches the main cursor, and then map that icon to the Hotspot's Interation. You can uncheck Leave out of cursor cycle? beneath the icon's properties to avoid seeing it at any other time.

    the "AC.Kickstarter-cursorManager.cycleCursors" is grey and I can't select it.

    Click Copy script variable beneath it to get to copy the API reference.

  • Thank you Chris, you're really saving me!
    I've got one last question, if you don't mind:

    I've applied keyboard shortcuts for every interaction, but I don't want players to access them in some scenes (for example, in the menu). Is there a script I should run to make this happen?

  • This input will be detected whenever in gameplay. If the menu pauses the game, they'll have no effect.

    I shall consider making this input system optional, however, so that it can be controlled similarly through script.

  • edited December 2018

    Thank you very much!! You're very kind and patient!

  • Sorry, last thing: is there a script to keep the Main Cursor out of the cursor cycle? When I cycle through cursors in-game, the Main cursor gets in the cycle too.

  • If you check Provide walk cursor?, it'll replace the main cursor - otherwise no.

    Having this be optional causes problems, since having a main cursor will likely be inevitable at some point - while accessing menus, for example. I shall, however, consider creating a custom event hook that allows you to override the active cursor at runtime.

  • Thank you very much!

  • I guess that with a custom event it would be possible to choose which cursor is selected when a scene starts? That's because every time I change scene, the new scene starts with the Main Cursor selected, and I'd like to make otherwise.

  • The cursor itself can be changed with the SetCursorFromID method:

    AC.KickStarter.playerCursor.SetCursorFromID (id);
    

    Where "id" is the ID value of the new cursor, as listed in the Cursor Manager.

  • Thank you very much! But I don't know how to apply this method... can you please explain more in detail how can I do this? I'm not very familiar with scripting.
    I've looked into the GameEngine Inspector, and I've seen the "PlayerCursor" section, but when I click "Edit script" it opens a notepad with scripts all messed up, and I don't know where to place this script.

  • The front page of the scripting guide gives a bit of a primer on scripting with AC - but a knowledge of C# is needed beforehand.

    The line of code above can be called from your own script - there's no need to open up the PlayerCursor script itself. Your own C# script can be made by right-clicking in your Project window - see Unity's own documentation for more on this.

    The cursor resets on a scene-change because the PlayerCursor component (which handles the cursor) is part of the scene. To have the active cursor mode "transfer" upon changing scene, you'll need to hook into the OnBeforeChangeScene and OnAfterChangeScene events to backup/restore the cursor's ID.

    Create a new C# script named RetainCursor, and replace it's code with this:
    http://pasteall.org/1404563/csharp

    Add it to a new GameObject in your opening scene, and it should place itself automatically in new scenes as you play, transferring the icon as you go. You can also set the initial icon ID.

  • It worked perfectly, thank you very much!
    Again, you're very kind and patient!!

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.