Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 568 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
model selected #414309
12/28/12 15:46
12/28/12 15:46
Joined: Oct 2012
Posts: 53
K
kenced Offline OP
Junior Member
kenced  Offline OP
Junior Member
K

Joined: Oct 2012
Posts: 53
Hello!.

I want to highlight or change the color my model when it is selected.Any idea?. Or is there a method that I can use to highlight only the borderlines of my model?. Thanks.

Re: model selected [Re: kenced] #414310
12/28/12 15:57
12/28/12 15:57
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
you could color it with
Code:
..
 set(my,LIGHT);
 my.lightrange = 0;
 my.red = 255;
 my.green = 1;
 my.blue = 1;
 ..



Another way u place a sprite ( a circle fex ) at the entity. fex
Code:
define selected skill100

void selection_sprite(){ // fex a circle sprite
	set(my,PASSABLE|TRANSLUCENT);
	my.tilt += 90;
	while(you){	
                vec_set(my.x, you.x);	
		if (you) if (!you.selected) break;
		wait(1);
	}
	wait(1);
	ptr_remove(me);
}

..
my.selected = 1;
ent_create("circle.tga", vector(my.x, my.y, my.z), selection_sprite);

..
wait(-1);
my.selected = 0;


Last edited by rayp; 12/28/12 16:03.

Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: model selected [Re: kenced] #414330
12/29/12 03:49
12/29/12 03:49
Joined: Oct 2012
Posts: 53
K
kenced Offline OP
Junior Member
kenced  Offline OP
Junior Member
K

Joined: Oct 2012
Posts: 53
thank you so much rayp. Your suggestions are really helpful, but I don't really understand your second suggestion. what is a circle fex?. Sorry for my noob question.

Re: model selected [Re: kenced] #414332
12/29/12 09:31
12/29/12 09:31
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
He meant the circles under the units, like in this screenshot:



Here is a whole article about the topic:

http://gamedev.stackexchange.com/questions/32717/unit-selection-circle


Always learn from history, to be sure you make the same mistakes again...
Re: model selected [Re: Uhrwerk] #414717
01/07/13 05:14
01/07/13 05:14
Joined: Oct 2012
Posts: 53
K
kenced Offline OP
Junior Member
kenced  Offline OP
Junior Member
K

Joined: Oct 2012
Posts: 53
Now, I can highlight my model, but It seems that I can highlight all the models. because I use only one action to them. I want to deselect the model the I selected when I select a new one. How can I do this?. Or should I separate the action of each models?.

Re: model selected [Re: kenced] #414718
01/07/13 05:30
01/07/13 05:30
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Define a var for that purpose. One way could be:
Code:
var selected = 0;

void highlight_me(){
   selected = 0;
   wait(1);
   selected = 1;
   while (selected){
      //highlightstuff
      wait (1);
   }
}



Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: model selected [Re: rayp] #414720
01/07/13 05:59
01/07/13 05:59
Joined: Oct 2012
Posts: 53
K
kenced Offline OP
Junior Member
kenced  Offline OP
Junior Member
K

Joined: Oct 2012
Posts: 53
thanks for response grin. I've already us that method. Use a flag for selected purpose. But the output is just like before. I can select more models. Or is it me?. hmm.

Re: model selected [Re: kenced] #414721
01/07/13 06:02
01/07/13 06:02
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
A flag is local. U need a global skill / var. U only want one selection right ? So u need a global var, like i said above. So not

Code:
set (my, FLAG1);
 or
 my.selected = 1;



do

Code:
var selected = 0;
action blabla...
..



Edit: U can use local flags or skills of course, but then u would need a FOR loop checking all ent's for selections before setting a new selection, possible too of course, but a bit more complicated.
Code:
..
for(you = ent_next(NULL); you; you = ent_next(you)) 
  {
    if(is(you, FLAG1))    
    	reset (you, FLAG1);
  }
..


Edit: While thinking about it, use the FOR-method. Cause its multi-selection-safe ^^

Last edited by rayp; 01/07/13 06:26.

Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: model selected [Re: rayp] #414771
01/07/13 14:45
01/07/13 14:45
Joined: Oct 2012
Posts: 53
K
kenced Offline OP
Junior Member
kenced  Offline OP
Junior Member
K

Joined: Oct 2012
Posts: 53
Thanks rayp. not its working grin


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