If Distance/If Target Script
Moderator: Moderators
If Distance/If Target Script
I'm a very, very bad scripter, so I was wandering if maybe someone could give me the basis of a script like...
I've got some tanks that are on the same team as the player. When they get a certain distance away from the player, I want them to stop (self.driving = 0) so the player can catch up, or so the player can back up so that the friendlies can catch up with him.
I also want them to stop when they have a target (like real tanks had to stop when they wanted to shoot at something), but keep moving when they don't have a target.
Would these conflict with eachother?
Thanks for any help!
I've got some tanks that are on the same team as the player. When they get a certain distance away from the player, I want them to stop (self.driving = 0) so the player can catch up, or so the player can back up so that the friendlies can catch up with him.
I also want them to stop when they have a target (like real tanks had to stop when they wanted to shoot at something), but keep moving when they don't have a target.
Would these conflict with eachother?
Thanks for any help!

-
Green Beret
- Major General
- Posts: 746
- Joined: Mon Apr 19, 2004 12:21 pm
- Contact:
i believe a sighttrace would be the best. basically it's like drawing a straight line from point to point, and it returns false if it's out of range or somehting's in the way.
i dont have the g_dumpallclasses file anymore, but it should be in there.
i dont have the g_dumpallclasses file anymore, but it should be in there.
Moderator
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
۞
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:
-
Green Beret
- Major General
- Posts: 746
- Joined: Mon Apr 19, 2004 12:21 pm
- Contact:
I didnt say make it the same origin, The + adds onto the originBroadus wrote:... Yeah, I have a feeling that making the origin of the tank the same as the origin of something else won't solve much of anything in this case.
+ ( xxx xxx xxx )
But the sighttrace is the way to go, Have fun scripting that
Code: Select all
local.tank.origin = $AI.origin + ( xyz ) i asked about traces before and got a copy/paste code of it from bdb.
Code: Select all
local.player = $player
local.range = 1024
local.fwd_vec = angles_toforward local.player.viewangles
local.start = local.player gettagposition "Bip01 Head"
local.target.origin = trace (local.start + local.fwd_vec * 64) (local.start + local.fwd_vec * local.range ) 0
but the tank would sort of be wallhacking, because it would need to look at the player it's entire existance to know when it can actually see the player.
makes you wish they just made tank AI built-in doesnt it?
Moderator
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
-
Green Beret
- Major General
- Posts: 746
- Joined: Mon Apr 19, 2004 12:21 pm
- Contact:



