Click Through an entity

Posted By: msmith2468

Click Through an entity - 01/11/12 22:19

I have an entity on top of another entity. I wanted to click the entity behind the first. because the first is for visual effects.

So i searched the manual and came across (UNTOUCHABLE) which seems to be exactly what i need. I can not seem to get it to work though.

The way i have it set up the entity on top is for effect, to do this i have its parent entity create it every frame and its own function sets it parameters and removes it after one frame. In guessing that my problem is caused perhaps because it dose not exist long enough.

I set it up this way because when the parent entity is changed the child entity must disappear and without referencing the child to the parent this seemed like the best way to achieve the effect and it worked well.

here is the code

Code:
action Show_crack()
{
	set (my, LIGHT | TRANSLUCENT | UNTOUCHABLE);
	my.scale_z = .55;
	my.z = -(2.5 / 2);
	my.skin = 13;
	wait(1);
	ent_remove(me);
}

action Create_Identity()
{
	set (my, LIGHT | POLYGON);
	my.emask |= ( ENABLE_CLICK);
	my.skin = 7;
	my.my_id = 213;
	my.event = click_event;
        while(1)
        {
               if (my.my_id == 213)
	       {
		       my.scale_z = .5;
		       my.z = -(2.5 / 2);
		       my.skin = 8;
		       ent_create("cube1.mdl", my.x, Show_crack);
	        }
        wait(1);
        }
}


Posted By: Superku

Re: Click Through an entity - 01/11/12 22:32

Set is a macro for eflags, UNTOUCHABLE is eflag2, so you have to set it manually without macro or define a set2 macro for eflags2:

my.flags2 |= UNTOUCHABLE;
Posted By: msmith2468

Re: Click Through an entity - 01/11/12 22:52

Thanks a lot works great!
© 2024 lite-C Forums