sighttrace command and other

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Tropheus
Corporal
Posts: 49
Joined: Sun Sep 14, 2003 11:19 pm
Location: france
Contact:

sighttrace command and other

Post by Tropheus »

Hello everybody !
Sorry for this stupid questions. but i have seen on bjarne tutorial this sighttrace command. But i don't anderstand what it means. I have looked at your others topics, but i didn't anderstand anymore.

If somebody could explain me how can i use it. what are its effects on game.

Secondly
when bjarne speak about self object in his tutorial.
Automatically started scripts
self is NULL for level scripts. Self is the character for animation scripts.
How do you think i can translate "character" in french ?

Thanks for your answers.

Tropheus
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

Hmm, don't know french, but character is like the guy we are talking about, for example, if I made a story, and I was the leader of a group of men in the book, I could be the 'main' character.
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

sighttrace follows a players position

when using self it talks about the entity using the thread

so if

$player thread test

test:
self action //not a real command

the $player (who is self) would perform the action
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
The Jackal
Sergeant Major
Posts: 101
Joined: Wed May 07, 2003 10:09 am
Contact:

Post by The Jackal »

So what would be the difference, if I were to do it like this:

Code: Select all

$player thread test

test:

$player action
Wouldn't it be the same? Why would SELF be needed?

PLease expand upon this somemore.
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

self

Post by tltrude »

"self" is used as a common name for multiple entities. You would only need to make one thread/script instead of many. It is used a lot in the global scripts.

In your little example, you can leave the first "$player" out and it would still work. But, what if you wanted more than one targetnamed entity (character) to do that same action?
Tom Trude,

Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

The sighttrace command is used to check visibility between two given positions, and will return 1 when the first position can be seen from the second (or vice versa ;)) and will return 0 otherwise. The final parameter sets the number of entities ignored in the sighttrace (awkward :?).

Anyway, here is a usage example:

Code: Select all

local.cansee = sighttrace (0 0 0) $player.origin 128
if(local.cansee == 1)
  iprintln "Player cansee (0 0 0) !"
Or:

Code: Select all

if(sighttrace (0 0 0) $player.origin 128)
  iprintln "Player cansee (0 0 0) !"
Image
Tropheus
Corporal
Posts: 49
Joined: Sun Sep 14, 2003 11:19 pm
Location: france
Contact:

Post by Tropheus »

Hi everybody !

Thanks a lot for your answers.

For the "self" expression i understand.
it looks like a variable wich can works for several entity as differents elevators working with the same thread.

For "character" is the "AI german soldier for example" because in french, you can translate it by "alphanumeric signe" as "a" "b" "1" and so on.

But for the sighttrace commande it looks like very difficult to use.
In fact i think to understand that is the way between 2 positions. the first entity can seing another one!
Is it the command used in normandy map to order the plane to bomb the flak when you get the binoculars?
But what is the real interest to use this command ?
Do you use it in multiplayer or solo maps ?
How do you define the number of entities ignored ???

Is it really an important command ???

Sorry for these stupid questions ?

Tropheus

Tropheus
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Binoculars work a little different but internally use the same concept basically.

You can for example use sighttrace when you're scripting a tank and want to know whether the tank can hit you or not.

Anyway it's generally better to decide what you want to script first and then find a suitable command, rather than the other way around :wink:
Image
Post Reply