Hey HellThunder! Thank you for a quick help!

About MY instead of YOU pointer, in the event in order to make scanned entity invisible grin No, that wasn't a point of my question (you probably mistaken with what I wrote about ENABLE_DETECT). I just couldn't get pointer to the scanning entity, which should be in this case YOU pointer. I was expecting (almost all events work this way) ENABLE_SCAN event to set YOU pointer automatically to the scanning entity, but in my example it didn't work and resulted in E1513. Yes, I could add if(you) check in order to avoid poping up error message grin But my case was - 'why doesn't ENABLE_SCAN set YOU pointer to the scanning entity?'.

Your second solution is what I tried to do with ENABLE_SCAN, but why didn't it work in my example? Isn't setting ENABLE_SCAN for entity which should be scanned enough to set you pointer? I used c_scan with SCAN_LIMIT but without setting SCAN_ENTS, could that cause the problem?

Edit: just noticed that you set ENABLE_SCAN for ent2 and event function for ent1.. Why? Usually when you use events, you set event and the event function which should be triggered for the same entity, right? (as for ENABLE_BLOCK, IMPACT, ENTITY, SHOOT etc).

Edit2: added a picture, to make it more clear grin



Edit3: now this is weird... maybe tomorrow with a fresh head I'll find out the difference, but I got it working (as it should work!) here:
Code:
#define PRAGMA_POINTER

void obj_event(){
	
	if(event_type == EVENT_SCAN){
		
		set(you, INVISIBLE);
		
	}
	
}

void obj(){
	
	c_setminmax(my);
	set(my, POLYGON);
	
	my->emask |= (ENABLE_SCAN | ENABLE_FRAME);
	my->event = obj_event;
	
}

void hero(){
	
	while(my){
		
		if(key_space == 1){
			
			if(my->skill1 == 0){
				
				c_scan(&my->x, &my->pan, vector(360, 0, 200), SCAN_LIMIT);
				my->skill1 = 1;
				
			}
		}
		else{
			
			my->skill1 = 0;
			
		}
		
		wait(1);
		
	}
	
}

void main(){
	
	warn_level = 6;
	level_load("");
	
	vec_set(&camera->x, vector(-250, 0, 100));
	vec_set(&camera->pan, vector(0, -10, 0));
	
	ent_create(CUBE_MDL, nullvector, hero);
	ent_create(CUBE_MDL, vector(0, 32, 32), obj);
	
}

But anyway, I can't understand, why my first example doesn't work??

Edit4: seems that I got it working only cause I've put 'c_scan' into the 'hero' function.. If I assign to that entity a pointer and try to c_scan from main function, it gives E1513.. And I can't understand why.

My best regards! Thank you for your time and help!

Last edited by 3run; 10/11/18 21:30.

Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung