c_trace and events or not..

Posted By: flutschi

c_trace and events or not.. - 12/02/08 06:11

HiHo,


I'm now on learning about c_trace, and i found something im wondering..

I can trace something and work with events, or i can work like this:

Quote:

result=c_trace(blabla)
if (result == 1)
{
bla
}


so whats better? whats faster? does it make a difference?

and while we are on trace.. i need a little help with my code
Quote:

function tuer()
{
var trace_target[3];

vec_set(trace_target,player.x);
vec_rotate(trace_target, player.pan);
vec_add(trace_target, vector(100,0,0));

c_trace(my.x,trace_target,IGNORE_ME|IGNORE_PASSABLE|IGNORE_MODELS);
}

void main()
{
level_load("sgcenter.wmb");
on_t = tuer;
}


I just want to find a door, a door i made as an entity and yeah.. its always gettin the error: "Crash in Tuer, Error 1513"
Posted By: Widi

Re: c_trace and events or not.. - 12/02/08 15:36

Error 1513 means you have a empty pointer in your code.
Is the player-pointer and the my-pointer not empty?

You can set at the beginning of your function tuer() following:
while(!my) wait(1);
while(!player) wait(1);
Posted By: heinekenbottle

Re: c_trace and events or not.. - 12/02/08 16:03

I'm not sure it knows who "my" is in the c_trace command.

Maybe you want the player pointer?
Posted By: flutschi

Re: c_trace and events or not.. - 12/03/08 02:04

empty pointer was right..
thx a lot!
Posted By: flutschi

Re: c_trace and events or not.. - 12/03/08 05:59

now i did it this way:


Quote:
var trace_target[3];

vec_set(trace_target,player.x);
vec_rotate(trace_target, player.pan);
vec_add(trace_target, vector(1000,0,0));

c_trace(player.x,trace_target,IGNORE_ME|IGNORE_PASSABLE|USE_BOX);


shouldn't that trace all the things 1000 pixels (or what it is?) in front of the player?
and then in combinations with...

Quote:
action door_schalter()
{
my.emask |= (ENABLE_SCAN);
my.event = scan_event;
}


.. this on the door it should get ..
Quote:
function scan_event()
{
}


.. here?

it doesnt smirk
Posted By: flutschi

Re: c_trace and events or not.. - 12/04/08 07:04

can somebody help me with this?

would be great!
© 2024 lite-C Forums