|
Re: TelePort Gun (swapping X,Y,Z coords) need help
[Re: immolat3]
#167030
11/12/07 23:46
11/12/07 23:46
|
Joined: Nov 2007
Posts: 73
immolat3
OP
Junior Member
|
OP
Junior Member
Joined: Nov 2007
Posts: 73
|
kind of big breakthrough here
function TeleportGun() { var theTarget; c_trace(my.x, theTarget.x, ignore_me + scan_texture); draw_text(tex_name,200,30,vector(100,100,255)); if(str_cmpi(tex_name, "SQUARE.MDL") == 1) { my.x = 100; my.y = 100; my.z = 100; } }
when i shoot the square model i have it teleports me to 100,100,100
HOWEVER, it only works if i shoot a certain side of object, i have no idea why.
|
|
|
Re: TelePort Gun (swapping X,Y,Z coords) need help
[Re: immolat3]
#167031
11/12/07 23:55
11/12/07 23:55
|
Joined: Nov 2007
Posts: 73
immolat3
OP
Junior Member
|
OP
Junior Member
Joined: Nov 2007
Posts: 73
|
I know this is jsut me talking to myself, but it may end up helping someone later on. I have it now so it teleports me to the object i shoot if its the right model.
function TeleportGun() { var theTarget;
vec_set(theTarget.x, vector(10000, 0, 0)); //shoots 10000 quants vec_rotate(theTarget.x, my.pan); //shoots in the direction of the player c_trace(my.x, theTarget.x, ignore_me + scan_texture); // Does the c_trace to the object
draw_text(tex_name,200,30,vector(100,100,255));
if(str_cmpi(tex_name, "SQUARE.MDL") == 1) { var tempX; var tempY; var tempZ; tempX = your.x; tempY = your.y; tempZ = your.z; my.x = tempX; my.y = tempY; my.z = tempZ; } }
however, theres still some aiming problems. it doesnt always aim right where it should, im not sure the camera pan thing is working like i thought it should.
|
|
|
Re: TelePort Gun (swapping X,Y,Z coords) need help
[Re: immolat3]
#167033
11/13/07 01:28
11/13/07 01:28
|
Joined: Nov 2007
Posts: 73
immolat3
OP
Junior Member
|
OP
Junior Member
Joined: Nov 2007
Posts: 73
|
i finished! woooooooooooooooooooooooooooooo! // Welcome to the most pain in the ass function ever! // woooooooooooooooooooooooooooooooooo // sankey86@gmail.comfunction TeleportGun() { var theTarget; vec_set(theTarget.x, vector(10000, 0, 0)); //shoots 10000 quants vec_rotate(theTarget.x, camera.pan); //shoots in the direction of the player c_trace(my.x, theTarget.x, ignore_me + scan_texture | ignore_passable | use_aabb ); // aabb works great here if(str_cmpi(tex_name, "SQUARE.MDL") == 1) // if the entity hit is square.mdl { var tempX; var tempY; var tempZ; tempX = your.x; tempY = your.y; tempZ = your.z; ent_create("square.mdl", my.x, null); // Create entity at player old position my.x = tempX; // my.y = tempY; // Move player to old entity position my.z = tempZ; // if (your) // if the entity hit still exists...poof { ent_remove(your); } } } anyone can use that if they want, works like a charm!
|
|
|
|