Help!
by VoroneTZ. 10/14/25 05:04
|
|
|
|
|
|
|
|
|
|
Re: 'you' and c_scan
[Re: 3run]
#474398
10/11/18 20:24
10/11/18 20:24
|
Joined: Nov 2005
Posts: 204 Bavaria
HellThunder
Member
|
Member
Joined: Nov 2005
Posts: 204
Bavaria
|
Hi 3run, I think there are two possible ways, in dependence of the needed result. If you want this one entity (ent2) to hide after scaning it, you need to take the my pointer instead of the you pointer for its event. This would be the first solution.
////////////////////////////////////////////////////////////////////////
// Template main script:
// Created by WED.
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// entry: Start Level
// entry_help: Name of the level loaded at start
char* t_levelname = "%NAME%.wmb";
////////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
#define PRAGMA_POINTER
void ph_object_event(){
if(event_type == EVENT_SCAN){
//if(my)
set(my, INVISIBLE);
}
}
void main(){
warn_level = 6;
level_load("");
vec_set(&camera->x, vector(-250, 0, 100));
vec_set(&camera->pan, vector(0, -10, 0));
ENTITY *ent1 = ent_create(CUBE_MDL, nullvector, NULL);
set(ent1, PASSABLE | TRANSLUCENT);
ENTITY *ent2 = ent_create(CUBE_MDL, vector(0, 32, 32), NULL);
ent2->emask |= (ENABLE_SCAN);
ent2->event = ph_object_event;
while(!key_esc){
if(key_space){
if(ent1->skill1 == 0){
c_scan(&ent1->x, &ent1->pan, vector(360, 0, 200), SCAN_ENTS | SCAN_LIMIT );
}
}
else{
ent1->skill1 = 0;
}
wait(1);
}
}
If ent1 should be able to hide all entities which will be, you have to assign the event to ent1 and enable scan for it too. Then the you pointer would work too.
void ph_object_event(){
if(event_type == EVENT_SCAN){
if(you)
set(you, INVISIBLE);
}
}
void main(){
warn_level = 6;
level_load("");
vec_set(&camera->x, vector(-250, 0, 100));
vec_set(&camera->pan, vector(0, -10, 0));
ENTITY *ent1 = ent_create(CUBE_MDL, nullvector, NULL);
ent1->emask |= (ENABLE_SCAN);
set(ent1, PASSABLE | TRANSLUCENT);
ENTITY *ent2 = ent_create(CUBE_MDL, vector(0, 32, 32), NULL);
ent2->emask |= (ENABLE_SCAN);
ent1->event = ph_object_event;
while(!key_esc){
if(key_space){
if(ent1->skill1 == 0){
c_scan(&ent1->x, &ent1->pan, vector(360, 0, 200), SCAN_ENTS | SCAN_LIMIT );
}
}
else{
ent1->skill1 = 0;
}
wait(1);
}
}
Cheers!
Last edited by HellThunder; 10/11/18 20:27. Reason: my condition wasn't needed
|
|
|
|