a tank shooting in mp level
Moderator: Moderators
- martijn_NL
- Map Reviewer
- Posts: 156
- Joined: Mon Apr 14, 2003 5:33 pm
- Location: The Netherlands
- Contact:
a tank shooting in mp level
I want to make tank in my level that will shoot on the the allied players (if they are visible for the tank)
I made a tank in my map (panzer IV), gived it a targetname.
Then i made this script.
tank:
$panzerIV1.gun = $panzerIV1 QueryTurretSlotEntity 0
while (level.tankbom == 0)
{
level.players = $player.size
local.sucker = (randomint (level.players))
if ($panzerIV1 cansee local.sucker && local.sucker.dmteam == "allies")
{
$panzerIV1.gun setaimtarget local.sucker
$panzerIV1.gun waittill ontarget
$panzerIV1.gun anim fire
}
}
end
can someone help me
I made a tank in my map (panzer IV), gived it a targetname.
Then i made this script.
tank:
$panzerIV1.gun = $panzerIV1 QueryTurretSlotEntity 0
while (level.tankbom == 0)
{
level.players = $player.size
local.sucker = (randomint (level.players))
if ($panzerIV1 cansee local.sucker && local.sucker.dmteam == "allies")
{
$panzerIV1.gun setaimtarget local.sucker
$panzerIV1.gun waittill ontarget
$panzerIV1.gun anim fire
}
}
end
can someone help me
Mapping 4 life
here's one I made earlier
This script takes a sparameter defining which side you want the vehicle to aim at.
so if you were writing a thread that continually looked for allies and shot at them it would look like this:
This script takes a sparameter defining which side you want the vehicle to aim at.
Code: Select all
//**************************************
//*** this will:
//*** find an axis player near by to shoot at!
// if local.team = 1 then shoot at axis
// if local.team = 2 then shoot at allies
ShootAtTeam local.team:
if (local.team == 1)
{
//println ("looking for Axis target")
//look for first player in range and shoot at them!
for (self.i = 1; self.i <= $player.size; self.i++)
{
if ( isalive($player[self.i]) && ($player[self.i].health > 0) )
{
if ($player[self.i].dmteam == axis)
{
if (vector_length (self.origin - $player[self.i].origin) > 200)
{
if (vector_length (self.origin - $player[self.i].origin) < 3000)
{
if (self cansee $player[self.i])
{
//println ("targeting player #" + self.i)
self.gun setAimTarget $player[self.i]
self.gun waittill ontarget
self.gun anim fire
goto breakloop
}
}
}
}
}
}
// println "no target found"
}
else
{
//println ("looking for Allied target")
//look for first player in range and shoot at them!
for (self.i = 1; self.i <= $player.size ; self.i++)
{
if ( isalive($player[self.i]) && ($player[self.i].health > 0) )
{
if ($player[self.i].dmteam == allies)
{
if (vector_length (self.origin - $player[self.i].origin) > 200)
{
if (vector_length (self.origin - $player[self.i].origin) < 3000)
{
if (self cansee $player[self.i])
{
//println ("targeting player #" + self.i)
self.gun setAimTarget $player[self.i]
self.gun waittill ontarget
self.gun anim fire
goto breakloop
}
}
}
}
}
}
//println "no target found"
}
breakloop:
end Code: Select all
LoopingThread:
while (1)
{
$mytanktargetname ShootAtTeam 2
//pause so do don't take up all the processor time
wait 1
}
end[VS-UK]Capt.Parts[BnHQ]
- martijn_NL
- Map Reviewer
- Posts: 156
- Joined: Mon Apr 14, 2003 5:33 pm
- Location: The Netherlands
- Contact:
you may need to define the gun ?
self.gun= self QueryTurretSlotEntity 0
self.gun= self QueryTurretSlotEntity 0
a vector is a line from point a to point b so those lines check the length of the vector from the gun to the player so that they are in the range of more than 200 and less than 3000if (vector_length (self.origin - $player[self.i].origin) > 200)
{
if (vector_length (self.origin - $player[self.i].origin) < 3000)
- martijn_NL
- Map Reviewer
- Posts: 156
- Joined: Mon Apr 14, 2003 5:33 pm
- Location: The Netherlands
- Contact:
- martijn_NL
- Map Reviewer
- Posts: 156
- Joined: Mon Apr 14, 2003 5:33 pm
- Location: The Netherlands
- Contact:
- martijn_NL
- Map Reviewer
- Posts: 156
- Joined: Mon Apr 14, 2003 5:33 pm
- Location: The Netherlands
- Contact:
- martijn_NL
- Map Reviewer
- Posts: 156
- Joined: Mon Apr 14, 2003 5:33 pm
- Location: The Netherlands
- Contact:
- martijn_NL
- Map Reviewer
- Posts: 156
- Joined: Mon Apr 14, 2003 5:33 pm
- Location: The Netherlands
- Contact:
I dicovered i major bug in your script, parts.
When i'm shoot by the tank the guns keeps following me, also when choose another team(It doesn't find another target when it killed someone but it sticks to one target)(only when i'm playing alone). I tried some things bit they don't work out someone know a solution for that? I used the script parts gave to me.
When i'm shoot by the tank the guns keeps following me, also when choose another team(It doesn't find another target when it killed someone but it sticks to one target)(only when i'm playing alone). I tried some things bit they don't work out someone know a solution for that? I used the script parts gave to me.
Mapping 4 life
OK I think the line that is causing the problem is setaimat. Effectivly the tank will continue to aim at that player event though it is not shooting and can't see them!martijn_NL wrote:I dicovered i major bug in your script, parts.
When i'm shoot by the tank the guns keeps following me, also when choose another team(It doesn't find another target when it killed someone but it sticks to one target)(only when i'm playing alone). I tried some things bit they don't work out someone know a solution for that? I used the script parts gave to me.
Try changing it to this:
Code: Select all
if (self cansee $player[self.i])
{
//println ("targeting player #" + self.i)
self.gun setAimTarget $player[self.i]
self.gun waittill ontarget
self.gun anim fire
self.gun setAimTarget NULL
goto breakloop
}[VS-UK]Capt.Parts[BnHQ]
- martijn_NL
- Map Reviewer
- Posts: 156
- Joined: Mon Apr 14, 2003 5:33 pm
- Location: The Netherlands
- Contact:
- martijn_NL
- Map Reviewer
- Posts: 156
- Joined: Mon Apr 14, 2003 5:33 pm
- Location: The Netherlands
- Contact: