Wintermute Engine > Scripts, plugins, utilities, goodies

Custom hotspots system


The Man:
For once I feel like I could contribute somehow to this great community we all belong to.
These past days I tried to implement the hotspot system which is available here as a free resource:

Although this system works very well it wasn't exactly what I was trying to achieve for two reasons:
1- The hint icons are positioned according to the X and Y attributes of the nodes of the scene.
2- The code automatically set an icon for EVERY node of the scene. What if I want the icons to appear only on the most important nodes?

IMPORTANT: probably there are thousand of ways to solve these issues, but I managed to do it my way, which isn't certainly the best one. The following guide is for those who really don't know what to do and can't find anybody who help them. I also have to point out that with this system you will have to program every hint icon individually. Here's the step-by-step guide:

1- Insert this line into

--- Code: ---global hotspot;
--- End code ---

2- Insert this piece of code inside game.script:

--- Code: ---function mostrahotspots()

    // make sure we're only displaying the icons once

hotspot = true;


hotspot = false;
--- End code ---

3- Open up a scene with Scene-editor and create a new layer called "hotspots". DON'T make it a close-up layer, otherwise it will stop the game while it is active;

4- Inside this new layer create every hint icon you want to show in the scene. Give them names you will easily remember. (F.E. if you have a node in your scene that is called "table", just name its corresponding hint icon "tablehotspot";

5- Once you have all the icons you need, disable this layer so that the player will not see it.

6- Open up the Scene-init script and insert this piece of code AFTER the stuff which initializes the scene:

--- Code: ---var hotspots=Scene.GetLayer("hotspots");
--- End code ---

7- Open again game.script and add this piece of code inside your "on Keypress":

--- Code: ---if(Keyboard.KeyCode==VK_SPACE) mostrahotspots();
--- End code ---

8- And the trick is done. Now when you press the spacebar (inside a scene you have set up) the layer "hotspots" will be shown with all the icons it contains.

- You can control the exact position of your hint icons;
- You can decide which node will have a hint icon (avoiding every object on the scene to have one).

- It is not fully automated. You have to set up every scene and every hint icon;
- When you deactivate a node, you will also have to remember to deactivate its corresponding hint icon. Otherwise the icon will be shown even if the node is no more active.

I tested the code on various scenes and it looks like it works as it should! I hope this can be useful for somebody!

tk for this tool! O0

I was looking a way to do this and I was thinking of something just like this! Thanks!!


[0] Message Index

Go to full version