Gamestudio Links
Zorro Links
Newest Posts
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
ZorroGPT
by TipmyPip. 04/08/26 17:08
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (Grant, 1 invisible), 3,542 guests, and 19 spiders.
Key: Admin, Global Mod, Mod
Newest Members
juergenwue, VladMak, Geir, ondrej, mredit
19208 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 4 of 4 1 2 3 4
Re: TelePort Gun (swapping X,Y,Z coords) need help [Re: Nems] #167029
11/12/07 23:03
11/12/07 23:03
Joined: Nov 2007
Posts: 73
I
immolat3 Offline OP
Junior Member
immolat3  Offline OP
Junior Member
I

Joined: Nov 2007
Posts: 73
Im pretty stuck, how hard would it be to trace for the ent_name? Like, could you show me code for say, just tracing to the model and then if it hits the model just using draw_text to say "worked" or something. my biggest issue is getting the trace to work correctly i think, if i can just get it to actually trace to the objects i need to be able to teleport with, im sure i can figure out the teleport part myself.

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
I
immolat3 Offline OP
Junior Member
immolat3  Offline OP
Junior Member
I

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
I
immolat3 Offline OP
Junior Member
immolat3  Offline OP
Junior Member
I

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] #167032
11/13/07 00:23
11/13/07 00:23
Joined: Nov 2007
Posts: 73
I
immolat3 Offline OP
Junior Member
immolat3  Offline OP
Junior Member
I

Joined: Nov 2007
Posts: 73
works slightly better when i use the "use_box" method.

still not getting it all the time. any ideas anyone?

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
I
immolat3 Offline OP
Junior Member
immolat3  Offline OP
Junior Member
I

Joined: Nov 2007
Posts: 73
i finished! woooooooooooooooooooooooooooooo!

// Welcome to the most pain in the ass function ever!
// woooooooooooooooooooooooooooooooooo
// sankey86@gmail.com
function 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!

Page 4 of 4 1 2 3 4

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1