Page 1 of 1

Icons for actions etc

Posted: Wed May 13, 2009 4:44 am
by blutwurstchen
Does anyone know if its possible to make icons appear, when a player character approaches a door, or an NPC prior to initiating a conversation?

I had this idea to have multiple icons appear, so that a player can decide what they want to do - open a door, or lock it. Or speak to somebody or kidnap them.

Maybe this goes beyond the capabilities of RF.

Re: Icons for actions etc

Posted: Wed May 13, 2009 12:16 pm
by Juutis
Yes, it is possible with scripting. There's a command called DrawFlipBookImage() which draws an image on the screen. The tough part is figuring out the conditions for it. Like how you are going to check if the player is near a door or a NPC. :idea:

Re: Icons for actions etc

Posted: Wed May 13, 2009 3:33 pm
by blutwurstchen
Can it be done, by checking if the player is within a certain texel range, or if the crosshairs are on the NPC or object?

I'm not sure what this would look like in a script. It would be nice to see how this works in an RF demo. Does anyone have this working?

Re: Icons for actions etc

Posted: Tue Jun 23, 2009 10:14 pm
by Exploration
I was wondering the same thing. How would you be able to do it?

Re: Icons for actions etc

Posted: Wed Jun 24, 2009 1:58 pm
by Jay
Use the command MouseSelect(false) to get the EntityName of the thing that is selected with the mouse cursor. If you don't see a mouse cursor, that's no problem, it is hidden and is automaticly where the crosshair is. Now you must give your Pawns and StaticEntityProxys EntityNames each a prefix which contains what the object is. (e.g. "ENEMY_" for enemies, "PAWN_" for talk-to-pawns, "CHEST_" for treasure chests) This way you can recognize in a script what was selected.

Like this:

SELECT=MouseSelect(false);

if(LeftCopy(SELECT,6)="ENEMY_")
{
//It is an enemy, draw attack icon
DrawFlipBookImage(...);
}
if(LeftCopy(SELECT,5)="PAWN_")
{
//It is a talk-to-pawn, draw speak icon
DrawFlipBookImage(...);
}
if(LeftCopy(SELECT,6)="CHEST_")
{
//It is a treasure ches, draw chest icon
DrawFlipBookImage(...);
}
More info on the used script commands is in the docs. For this to work, the script must be in LowLevel. If you use a scripted player, you should add it into

Sadly this doesn't work for world models (Doors, MovingPlatforms etc). I used a workaround by making my doors StaticEntityProxys and then teleporting the player inside and outside of houses.

Moved to Scripting, this seems to be more of a scripting problem than a level design problem.