Forum rules - please read before posting.

Most efficient way to activate/deactivate a bunch of hotspots

Good day.
I have a couple of rooms where I want to activate / deactivate varoius hotspots depending upon which door I am entering the room from. Generally these rooms also involve multiple nav meshes, which is why I want to have some hotspots on and others off. There is often also a way to navigate between the two NavMeshes at that location, which also requires that the hotspots be switched.

I'm trying to find the most efficient way of doing this. I thought I had, but it didn't seem to work...

Here's what I did:
I created a boolean variable called e.g. EnteredLocationXByTopDoor.
Then I created an Action Script Assett File called LocationX_SwitchHotspots which I set to 'run in background'

Inside this Assett File I created a Check Variable action
connected via 'if condition is met' (or not) to two identical lists of 'Hotspot: Enable or disable' actions for each hotspot to be activated /deactivated. I switched the enable / disable from each list depending upon what I wanted from Top Door and BottomDoor.

Then on the TopDoor hotspot I set the EnteredLocationXByTopDoor to 'true' and created an action to 'run' the LocationX_SwitchHotspots action script before teleportng the player into LocationX and changing all the scene settings etc.
On the BottomDoor I did the same with EnteredLocationXByTopDoor set to 'false'.

Each hotspot that I am wanting to switch has the Remember Hotspot script attached.

I thought this was the perfect method for keeping my lists of hotspots to be enabled/disabled in one neat file, but so far it isn't working. Have I done something incorrectly? Perhaps related to using an Action Script Assett file? Or...?

Any thoughts appreciated -
I really don't want to keep listing all of the enables/disables at each point of entry / change if I can help it, it's driving me nuts!
Thanks.

Comments

  • You shouldn't have to rely on any variable - you can use the Scene: Check Action to check which scene you just came from by setting the Check type to Previous.

    If you use this in your scene's OnStart cutscene, you can then use a series of Hotspot: Enable or disable Actions to configure your Hotspots accordingly.

  • Mm, yeah, I can do that. But this means I have to copy paste the list of enable /disables to 4 different action scripts and it's just a bit of pain to keep track of.

    I thought my approach would make it more efficient for me to keep it all in just one action file. Is there some reason why telling an Action Script Assett file to run from another action script wouldn't work?

  • edited May 2020

    Why 4? You only mentioned 2 entrances.

    You can always do the same thing through script, if you want. You could define what Hotspots to turn on in an Inspector, or with a custom tag.

    Is there some reason why telling an Action Script Assett file to run from another action script wouldn't work?

    None that I can think - what steps must be taken to recreate such an issue?

  • I have three entrances to the room, which has two levels, and I am also using the stairs between levels to turn on and off a whole list of hotspots - so that when you are in the top part of the room you can't access all of the hotspots at the bottom, and vice versa.

    So in total there are 5 moments when the list has to be switched, 3 entries to the room from other places and 2 changes from floor to floor - 1 going up, 1 going down.

    what steps must be taken to recreate such an issue?

    I guess the ones I described above

  • But following them reveals no issue. The logic sounds fine. Please bear in mind that sharing screenshots is the best way to describe ActionLists - given the number of fields involved.

    If this is all occuring in one scene, you can PM it to me along with your Managers and steps on how to experience the issue.

  • A belated addition to this post, in case others are trying to do the same thing...

    I believe the reason my goal wasn't being reached here is because I used an Action Script Asset File that I created in a strange way (by duplicating an Action Script in the Actions folder of my project).

    If I had used a Cutscene Action Script to perform this event it would have worked, because Cutscene Action Scripts work within the scene when called by other Action Scripts - i.e. on Interactions.

    At the time I hadn't understood that Cutscenes have a much wider function than just being Action Scripts to make narrative cutscenes happen in between gameplay. You can use them to do all sorts!

    Hope that is of help to someone.

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.