Forum rules - please read before posting.

A question about the hot spot background image

Hello all, I'm new to this forum, I have a quick question, hope someone can help me out.
I have a horizontal black bar graphic that fades out at either end for my characters dialogue background image, and a similar one to go behind scene hotspot titles, for the sake of consistency.
For the exit of a room I change the cursor to a footsteps icon, I inserted a single space in the title text field to keep that blank, only, my empty black bar shows up too as my exit is just a regular hotspot.
Is there any way I could disable the background image for only my exit hotspots? or maybe a way I could create an alternate custom hotspot for this purpose? (exits only) 
Hopefully I explained that ok,  thanks in advance.

Comments

  • Welcome to the community, @Saturnine.

    So this black bar graphic is essentially your restyled Hotspot menu?  This can be done by hooking into the OnHotspotSelect custom event, which is called whenever you select a new Hotspot.  You can use this to check a pre-defined List of Hotspots for which the menu should not show, and lock it / unlock it accordingly.

    Try this script:
    http://pasteall.org/888335/csharp

    More on Custom events can be found in the Manual, as well as this tutorial.
  • edited March 2018
    Thanks for the reply Chris,
    Yes the black bar behind my text is in the hotspot menu's  hotspot label background texture.
    I edited my exit hotspot's action list to include Menu >Change state> Lock Menu (Hotspot) 
    But because it only works on a mouse click, unfortunately my empty black bar still shows on the initial mouse over.
    Other than that this seems like the perfect solution thank you, as I do want to keep the black bar image on all other hotspot labels, I will keep trying :)
    Maybe an invisible menu button in place of the exit hotspot that is set to mouseover that runs an action script? or is there a cleaner way?
    Thanks again, and thanks for AC it's awesome

    Edit, just looked into the invisible menu button thing, and it would need one for every exit in the game! didn't think of that :/
  • Did you try the script I wrote you?  Place it in the scene and configure it by assigning each exit Hotspot in your scene into its Inspector - it works by locking/unlocking the Hotspot menu when mouse-overing, not clicking, a Hotspot.
  • I'm not sure how to place the script in the scene? I tried adding it as a component in the GameEngine Inspector but that didn't work, Sorry for the probably dumb questions, I'm new to AC and don't know any C#
    I'm sure I will look back on this first post in the future and cringe :) 
  • It's fine - though this is more to do with Unity than AC.

    Paste the code into a new C# script file named SelectivelyLockHotspotMenu.cs.  Then add an empty GameObject to your scene, and attach the script to it by dragging it onto its Inspector.

    The script has public variables in it, which means it'll have fields in its Inspector you can set - in this case, the name of the menu to lock (by default, this is "Hotspot"), as well as a list of all the Hotspots in the scene for which the menu should not turn on.

    You'll have to repeat this for all scenes in your game with Hotspots like this, but try it with one first and see how you go.
  • Thanks for the reply Chris,
    That's exactly what I did when I was just guessing, but the empty black bar background still shows up, weird :/
    Maybe my hotspot graphic is set up incorrectly? I don't think so though, I followed both your tutorial and the Callahan Curse one to the letter.
    Here's a screenshot of the image background:
    image
  • The contents of the Menu itself shouldn't matter - since the script ought to be preventing it from showing at all.

    Which versions of AC and Unity are you using?  Let's also see a screenshot of your use of the SelectivelyLockHotspotMenu component, which should be present in your scene.
  • My Unity version is 2017.3.0f3  and my AC is 1.60.4, I know they are out of date a bit but I'm just scared to update in case I can't fix any potential issues.
    Thanks again for the reply,
    Here's my set up:

    image
  • You can always backup your project before testing an upgrade - but it should work in the older release as well.

    The component looks set up fine - try pasting this at the end of the script's SelectHotspot function:

    Debug.Log ("Selected Hotspot " + hotspot.name + ", Lock menu? " + lockMenu);

    Then keep the Console window open during gameplay, as it should tell you if it's locking the menu or not for each Hotspot.  What does it display?

  • Thanks Chris, I added it to the end and this is what the console said, all three popped up when the cursor was still over the hotspot, so it gave a Flase, True, False all at once on one mouseover:


    Selected Hotspot Hotspot2D_MH_Stairs_Exit_Hall, Lock menu? False
    UnityEngine.Debug:Log(Object)
    SelectivelyLockHotspotMenu:SelectHotspot(Hotspot) (at Assets/RC/Scripts/SelectivelyLockHotspotMenu.cs:29)
    AC.EventManager:Call_OnChangeHotspot(Hotspot, Boolean) (at Assets/AdventureCreator/Scripts/Managers/EventManager.cs:222)
    AC.Hotspot:Select() (at Assets/AdventureCreator/Scripts/Logic/Hotspot.cs:660)
    AC.PlayerInteraction:ContextSensitiveClick_Process(Boolean, Hotspot) (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:565)
    AC.PlayerInteraction:ContextSensitiveClick() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:522)
    AC.PlayerInteraction:ChooseHotspotThenInteractionClick_Process(Boolean) (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:378)
    AC.PlayerInteraction:ChooseHotspotThenInteractionClick() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:362)
    AC.PlayerInteraction:HandleInteractionMenu() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:151)
    AC.PlayerInteraction:UpdateInteraction() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:92)
    AC.StateHandler:Update() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:356)


    Selected Hotspot Hotspot2D_MH_Stairs_Exit_Hall, Lock menu? True
    UnityEngine.Debug:Log(Object)
    SelectivelyLockHotspotMenu:SelectHotspot(Hotspot) (at Assets/RC/Scripts/SelectivelyLockHotspotMenu.cs:29)
    AC.EventManager:Call_OnChangeHotspot(Hotspot, Boolean) (at Assets/AdventureCreator/Scripts/Managers/EventManager.cs:222)
    AC.Hotspot:Select() (at Assets/AdventureCreator/Scripts/Logic/Hotspot.cs:660)
    AC.PlayerInteraction:ContextSensitiveClick_Process(Boolean, Hotspot) (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:565)
    AC.PlayerInteraction:ContextSensitiveClick() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:522)
    AC.PlayerInteraction:ChooseHotspotThenInteractionClick_Process(Boolean) (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:378)
    AC.PlayerInteraction:ChooseHotspotThenInteractionClick() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:362)
    AC.PlayerInteraction:HandleInteractionMenu() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:151)
    AC.PlayerInteraction:UpdateInteraction() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:92)
    AC.StateHandler:Update() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:356)


    Selected Hotspot Hotspot2D_MH_Stairs_Exit_Hall, Lock menu? False
    UnityEngine.Debug:Log(Object)
    SelectivelyLockHotspotMenu:SelectHotspot(Hotspot) (at Assets/RC/Scripts/SelectivelyLockHotspotMenu.cs:29)
    AC.EventManager:Call_OnChangeHotspot(Hotspot, Boolean) (at Assets/AdventureCreator/Scripts/Managers/EventManager.cs:222)
    AC.Hotspot:Select() (at Assets/AdventureCreator/Scripts/Logic/Hotspot.cs:660)
    AC.PlayerInteraction:ContextSensitiveClick_Process(Boolean, Hotspot) (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:565)
    AC.PlayerInteraction:ContextSensitiveClick() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:522)
    AC.PlayerInteraction:ChooseHotspotThenInteractionClick_Process(Boolean) (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:378)
    AC.PlayerInteraction:ChooseHotspotThenInteractionClick() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:362)
    AC.PlayerInteraction:HandleInteractionMenu() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:151)
    AC.PlayerInteraction:UpdateInteraction() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:92)
    AC.StateHandler:Update() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:356)

  • Upgrade to the latest in a backup/duplicate project, and if it still doesn't work then PM me the scene file along with your Manager asset files so that I can see it for myself.
  • Hi Chris, sorry for the late reply I have been away for a while, thank you for the responses, I have worked out that the problem was my inventory menu, which i am controlling via an invisible button so I can mouse over that and reveal the inventory but also show the inventory temporarily after picking up an item (the new graphic pulses once then the inventory menu closes)
    But this was breaking your script somehow, it disabled the hotspot menu on mouse over but didn't re-enable it on exit, but anyway I have fixed it by re-enabling hotspot menus as part of the inventory menu closing action list.
    So it's fixed kind of :) 
    Thank you for the script!

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.