you

Posted By: Alberto

you - 10/07/06 21:01

Hello

What is the use of the "You" pointer ?
Can you provide me with some examples ?
Thanks in advance
Posted By: Xarthor

Re: you - 10/07/06 21:48

YOU is modified by various commands such as:
c_scan, c_trace and so on.

If we take c_trace for example you points towards the entity hit by the trace-beam.

You can also use the YOU pointer to ignore certain entities.
Lets say you have a non-passable gun as level entity and are always reseting it to the players position.
It would certainly block the player when he performs any _move instruction (c_move, or ent_move)
So if you have a pointer to the gun "activ_gun" e.g. you
can store it into YOU and ignore it:
you = activ_gun;
c_move(my,move_dist,nullvector,ignore_you);

There are lots of possibilies for the use of YOU.
Posted By: Alberto

Re: you - 10/08/06 10:28

Thanks
About c_trace
Do you mean that :
If the beam hit the entity than "you " switch from 0 to the entity pointer ?
I tried but "you" alwayes returns "0"
If so I am doing something wrong
I will try harder
Posted By: Xarthor

Re: you - 10/08/06 10:52

yes, lets say you want to trace from the player to a position at a certain distance infront of him to find out if there is an entity in the way:
Code:

function check_direction()
{
vec_set(temp,vector(1000,0,0));
vec_rotate(temp,player.pan);
vec_add(temp,player.x);

my = player; //set the my pointer to ignore the player
c_trace(player.x,temp.x,ignore_me);
if(you) { beep; } //an entity was hit, beep once
}

on_x = check_direction;


I have tested the code and it beeps, so it does work
© 2024 lite-C Forums