Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 2
red highlight over selected entities :) #238426
11/27/08 08:15
11/27/08 08:15
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
Ever play a game and when you mouse over an entity the entity has like a little red thingy around it? Well I've wanted this in my game for ever and tonight I had the time to code it. It's small but I never seen this on 3dgamestudio before. So here it is! Check it out it's stand alone! Just copy everything below into your game anywhere above the main function. Then in your main while loop include this line:
mouseOver();

That's pretty much it people! Let me know what you think.

P.S. Here is a short film on how it works in my test level for my multiplayer game smile

http://www.filesend.net/download.php?f=20f7722eb647b47e07ce9bf0c908bbe5

Code:
////////////////////mouse over
ENTITY* mouse_old;
ENTITY* mouse_old_clone;
STRING* mouseEntStr = "#50";
ENTITY* tempEnt;

#define id skill1
#define owner skill99

MATERIAL* redHighlight=
{
	ambient_red = 255;
	ambient_green = 0;
	ambient_blue = 0;
	
	diffuse_red = 255;
	diffuse_blue = 0;
	diffuse_green = 0;
	
	specular_red = 255;
	specular_green = 0;
	specular_blue = 0;
} 

function mouseOver()
{
	if(mouse_old_clone == NULL)
	{
		mouse_old_clone = ent_create(NULL ,0,NULL);
		mouse_old_clone.material = redHighlight;
		set(mouse_old_clone,UNTOUCHABLE|TRANSLUCENT|PASSABLE);
		mouse_old_clone.id = 123456;
	}
	
	if(mouse_ent)
	{
		mouse_old = mouse_ent;
		if(mouse_old != NULL && mouse_old.id != 123456)
		{
			str_for_entfile(mouseEntStr,mouse_old);
			ent_morph (mouse_old_clone, mouseEntStr);
			reset(mouse_old_clone,INVISIBLE);
			vec_set(mouse_old_clone.x,mouse_old.x);
			vec_set(mouse_old_clone.pan,mouse_old.pan);
			if(mouse_old.id != 123456)
			{
				mouse_old_clone.owner = handle(mouse_old);
			}
			
			if(mouse_old_clone != NULL)
			{
				mouse_old_clone.scale_x = 1.1;
				mouse_old_clone.scale_y = 1.1;
				mouse_old_clone.scale_z = 1.1;
			}
		}
		if(mouse_old.id == 123456)
		{
			tempEnt = ptr_for_handle(mouse_old.owner);
			if(tempEnt == NULL)
			{
				set(mouse_old_clone,INVISIBLE);
			}
		}
	}
	else
	{
		set(mouse_old_clone,INVISIBLE);
	}
}



"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: red highlight over selected entities :) [Re: PrenceOfDarkness] #238477
11/27/08 16:50
11/27/08 16:50
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
Hey the video seems to be corrupted... frown

Re: red highlight over selected entities :) [Re: PadMalcom] #238495
11/27/08 19:50
11/27/08 19:50
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
Ya for some reason half my friends can see it and the other half can't! I dont know why... it was made with fraps... hmmm. Check the code out... just copy and paste it and add that 1 line and that's it. NO THINKING INVOLVED (just the way I like it ;))


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: red highlight over selected entities :) [Re: PrenceOfDarkness] #259017
04/03/09 13:51
04/03/09 13:51
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline
Serious User
VeT  Offline
Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
btw, very nice sloution smile


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: red highlight over selected entities :) [Re: VeT] #259030
04/03/09 14:30
04/03/09 14:30
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
here is a little edited version.

you know, you may not want to highlight all entities but some certain ones.(like buildings only in a rts)


with the version below, if you want your entity to be highlightable you need set skill98 "highlight" to 1.

like

my_ent.highlight = 1;

Code:
////////////////////mouse over
ENTITY* mouse_old;
ENTITY* mouse_old_clone;
STRING* mouseEntStr = "#50";
ENTITY* tempEnt;

#define id skill1
#define highlight skill98
#define owner skill99

MATERIAL* redHighlight=
{
	ambient_red = 255;
	ambient_green = 0;
	ambient_blue = 0;
	
	diffuse_red = 255;
	diffuse_blue = 0;
	diffuse_green = 0;
	
	specular_red = 255;
	specular_green = 0;
	specular_blue = 0;
} 

function mouseOver()
{
	if(mouse_old_clone == NULL)
	{
		mouse_old_clone = ent_create(NULL ,0,NULL);
		mouse_old_clone.material = redHighlight;
		set(mouse_old_clone,UNTOUCHABLE|TRANSLUCENT|PASSABLE);
		mouse_old_clone.id = 123456;
	}
	
	if(mouse_ent)
	{
		mouse_old = mouse_ent;
		if(mouse_old != NULL && mouse_old.id != 123456 && mouse_old.highlight==1)
		{
			str_for_entfile(mouseEntStr,mouse_old);
			ent_morph (mouse_old_clone, mouseEntStr);
			reset(mouse_old_clone,INVISIBLE);
			vec_set(mouse_old_clone.x,mouse_old.x);
			vec_set(mouse_old_clone.pan,mouse_old.pan);
			if(mouse_old.id != 123456)
			{
				mouse_old_clone.owner = handle(mouse_old);
			}
			
			if(mouse_old_clone != NULL)
			{
				mouse_old_clone.scale_x = 1.1;
				mouse_old_clone.scale_y = 1.1;
				mouse_old_clone.scale_z = 1.1;
			}
		}
		if(mouse_old.id == 123456)
		{
			tempEnt = ptr_for_handle(mouse_old.owner);
			if(tempEnt == NULL)
			{
				set(mouse_old_clone,INVISIBLE);
			}
		}
	}
	else
	{
		set(mouse_old_clone,INVISIBLE);
	}
}


tanks for the cont Darkness.

Last edited by Quadraxas; 04/03/09 14:30.

3333333333

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1