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:
http://res.dead-code.org/doku.php/resource:displaying_hint_icons_over_active_hotspotsAlthough 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 base.inc:
global hotspot;
2- Insert this piece of code inside game.script:
function mostrahotspots()
{
// make sure we're only displaying the icons once
if(!hotspot)
{
hotspot = true;
Sleep(200);
hotspot = false;
}
}
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:
var hotspots=Scene.GetLayer("hotspots");
while(true)
{
if(hotspot==true)
{
hotspots.Active=true;
Sleep(2000);
hotspots.Active=false;
}
else
{
hotspots.Active=false;
}
Sleep(200);
}
7- Open again game.script and add this piece of code inside your "on Keypress":
if(Keyboard.KeyCode==VK_SPACE) mostrahotspots();
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.
ADVANTAGES- 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).
DISADVANTAGES- 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!