Icons for actions etc

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
blutwurstchen
Posts: 57
Joined: Wed Mar 19, 2008 8:51 pm

Icons for actions etc

Post 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.
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: Icons for actions etc

Post 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:
Pain is only psychological.
User avatar
blutwurstchen
Posts: 57
Joined: Wed Mar 19, 2008 8:51 pm

Re: Icons for actions etc

Post 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?
Exploration
Posts: 3
Joined: Tue Jun 23, 2009 1:08 am

Re: Icons for actions etc

Post by Exploration »

I was wondering the same thing. How would you be able to do it?
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Icons for actions etc

Post 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.
Everyone can see the difficult, but only the wise can see the simple.
-----
Post Reply