sighttrace

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

sighttrace

Post by lizardkid »

I've searched teh forums but all i can find are old topics discussing SELF keyword and such.

My question:

in g_allclasses it gives the sighttrace argument list like:

Code: Select all

sighttrace( Vector start, Vector end, [ Integer pass_entities ], [ Vector mins ], [ Vector maxs ] )
ok, it seems simple enough. now what's with this Vector mins and Vector maxs stuff? i thought it meant minimum distance from the start and the maximum distance. No, it wants a vector.

here's my current line:

Code: Select all

if(sighttrace( local.CO local.intendedDest 0 1 1024 ) == 1)
local.CO is an Actor, local.intendedDest is a position fairly close to him. i want to check if it's not behind him in a wall or something, just a free space near him. MOH gives me an error about the mins and maxs. well it fails the script at the mins but i assume it'd do the same thing about maxs.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Admin .MAP Forums
Image
Head above heels.
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

no, not really. that example doesnt fit the arguments :S
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

All I ever seen them do is like this

if !(sighttrace ($player.origin + (0 0 50)) (local.sniper[local.i].origin + (0 0 50)) 1)

but looking at Bjarne BZR's site it says it is a bounding box that the sighttrace is done within I guess like when you make triggers etc . So I assume that something like this ( -500 -500 0)( 500 500 1000) will give you a 1000x1000x1000 box I don't know if that is from the start position or not but it maybe .
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

it looks for a bounding box? is there no way to just trace between point A and point B and check for collision? trace just returns a position, i was hoping for a collision check :(
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Yeah, mins and maxs are almost always related to bounding boxes. There's quite a lot of this stuff in ET's source. But hence these mins and maxs are just optional parameters I think you can just skip them.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Use min and max if you want to check if an object with bounding box size defined by min and max could reach the destination. So, if you don't specify min and max you're doing a line trace, if you do specify them you're doing a box trace.

Lizard your code doesn't work because in mohaa scripting arguments aren't placed within parens () but directly after the command.

if(sighttrace( local.CO local.intendedDest 0 1 1024 ) == 1)

should be

if(sighttrace local.CO.origin local.intendedDest 1 ( -16 -16 0) (16 16 92))

or, taking into account some stepsize

if(sighttrace (local.CO.origin + (0 0 16)) (local.intendedDest + (0 0 16)) 1 ( -16 -16 0) (16 16 76))

Where pass_ents is 1 so the trace won't hit local.CO. A better way to make sure the trace won't hit your bot is:

if(local.CO sighttrace (local.CO.origin + (0 0 16)) (local.intendedDest + (0 0 16)) 0 ( -16 -16 0) (16 16 76))

If this doesn't help then I don't know what will :P

P.S. that means the info @ rjukan isn't correct :oops:
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

jv_map wrote:P.S. that means the info @ rjukan isn't correct :oops:
Hmm... cant remember where I got the current info from, its not in g_allcalsses.html...

But if you say that is how it works, then that is how it works :) Can you make an ubdate to the example and add a correcter descrition on the wiki?
Admin .MAP Forums
Image
Head above heels.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Bjarne BZR wrote:Hmm... cant remember where I got the current info from, its not in g_allcalsses.html...
I suffixed the :oops: for a reason ;)
But if you say that is how it works, then that is how it works :) Can you make an ubdate to the example and add a correcter descrition on the wiki?
Uhhm sure :)
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

jv_map wrote: I suffixed the :oops: for a reason ;)
Poking one self... one of my favourite forms of humor :)
Admin .MAP Forums
Image
Head above heels.
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

Code: Select all

if(local.CO sighttrace (local.CO.origin + (0 0 16)) (local.intendedDest + (0 0 16)) 0 ( -16 -16 0) (16 16 76)) 
Works like a charm, they run their little wandering patrols and return right back to the CO, thanks jv!
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Post Reply