Page 1 of 2

tank in mp that move around *not controled by player*

Posted: Wed Jul 30, 2003 11:51 pm
by LT.BARNES
Hay Everyone...

ok what i want to know is...

How do i make a tank for multiplayer, which will move around the level and stop then shoot somwhere, move on to another area, then stop and shoot somwhere, then move on again and SO ON.

i have seen it been done on some official levels. and i was wondering how i can do this??

thanks

Posted: Thu Jul 31, 2003 12:26 am
by nuggets
have you tried the search? there's at least 2 possible ways people have posted

Posted: Thu Jul 31, 2003 12:46 pm
by LT.BARNES
didn't find anything.

i want a tank to go around my mp level and jus shoot at places

Posted: Thu Jul 31, 2003 3:57 pm
by LT.BARNES
anyone??

plz...

i have seen this being done on official levels.

i want a tank ((not controlable.)) to go around my level, and stop shoot somewhere, move on, stop shoot, move on.

plz??

Posted: Thu Jul 31, 2003 4:10 pm
by Parts
look at BattleServer available via the downloads in MOHFiles.com. Excellent example of having a tank driving round a map shooting at predefined places. Also has bombing planes and some other nice features

Posted: Thu Jul 31, 2003 4:17 pm
by LT.BARNES
where abouts is it in mohfiles??

Posted: Thu Jul 31, 2003 4:58 pm
by LT.BARNES
dude i found it but that is NOT wat i wanted man..

i want to know how i can make a tank move, stop fire at a place, then move, then stop and fire again somewhere, and then move and SO ON.


but i want it on My level.

how can i do this plz

Posted: Thu Jul 31, 2003 9:34 pm
by Alcoholic
ok barney.. just rip the code for tanks that you used in your sp levels, but for targeting you have to do it different. just add these lines:

Code: Select all

for (local.i = 1; local.i <= $player.size; local.i++)
{
    local.player = $player[local.i]
    local.los = sighttrace (whatever values you want yata yata)
    if (local.los)
    {
        $tank setaimtarget local.player
        $tank waittill ontarget
        $tank startfiring
        wait 1
        $tank stopfiring
        wait 4
    }
}
and put a while statement around it.. thats just a simple way... the driving thing your own your own, it should be simple enough.. and dont just copy my code like you do with everything else! :evil: you gotta do thinking this time!
:twisted:

Posted: Thu Jul 31, 2003 10:15 pm
by LT.BARNES
easy man.

i did do my own. i jus used alot of tuts, cause when it comes to scripting i aint good.

no i don't want the tank to aim and shoot at the player.

i want the tank to move to the first node, then stop aim and fire at like a random area, then move to the next node, stop and fire at some random area, then move to the next area...and so on

Posted: Thu Jul 31, 2003 11:30 pm
by LT.BARNES
ok my tank will now move :)

it will now stop and fire at a script_origin i have set, then move on to the next path.....and so on..

BUT...

1) u can't hear the tank at all!!?? not the moving sound, or stoping sound or firing.( u get it he he)

2) u see the anim of the tank fire, but the explosion is not there??

here is my script and HELP...

here is JUS ONE of the WAYPOINTS

tiger:

$tiger1 setcollisionentity self.target // Set the tank collision mask
$tiger1.angle = 360
$tiger1.gun = $tiger1 QueryTurretSlotEntity 0
$tiger1 nodamage

tankagain:

// start at tank. head towards garden, then church

$node1.target = NULL
$tiger1 drive $node1
$tiger1 waittill drive
$tiger1 stop
$tiger1.gun setAimTarget $aim1
$tiger1.gun waittill ontarget
$tiger1.gun anim fire
$tiger1.gun startfiring
wait(1)
$tiger1.gun stopFiring
$tiger1 exec scripts/randomshoot.scr
wait 5

I COPYED THE RANDOMSHOOT.SCR completely for this tiger to work...do i need the randomshoot script?????

i jus got it from the server with the tank in.

here is the randomshoot.scr if u need to read it.


//**************************************
//*** this will:
//*** check to see if it should shoot
//*** if so, count players
//*** random pick whoever is in range and shoot at them

start:

self.randomshoot = randomint(6)
if (self.randomshoot == 1)
{
println ("looking for target")
self.count = 1
if ($player[2])
{
self.count = 2
if ($player[3])
{
self.count = 3
if ($player[4])
{
self.count = 4
if ($player[5])
{
self.count = 5
if ($player[6])
{
self.count = 6
if ($player[7])
{
self.count = 7
if ($player[8])
{
self.count = 8
if ($player[9])
{
self.count = 9
if ($player[10])
{
self.count = 10
}
}
}
}
}
}
}
}
}
self.selectshoot = 1 + randomint(self.count)
println ("targeting player #" + self.selectshoot)
if (vector_length (self.origin - $player[self.selectshoot].origin) > 200)
{
if (vector_length (self.origin - $player[self.selectshoot].origin) < 3000)
{
wait 2
self.gun setAimTarget $player[self.selectshoot]
self.gun waittill ontarget
self.gun anim fire
}
}
}
else
{
println ("not looking for target")
}

end



OK i want the sound on tank.

and the explosion when the tank fires. all i see is the animation of it firing then it moves on ???

HEEEEEeeeeeeeeeeeeeeeeeellllllpppppPPPPPPPP plz

Posted: Thu Jul 31, 2003 11:36 pm
by Alcoholic
you dont use anim fire and startfiring. either use anim fire or stop/start firing

Posted: Thu Jul 31, 2003 11:49 pm
by LT.BARNES
it now looks like this...

and still no sound on tank and now explosion!!?? yes u see the anim but not the explosion??? help. this is wat it looks like now.


$node1.target = NULL
$tiger1 drive $node1
$tiger1 waittill drive
$tiger1 stop
$tiger1.gun setAimTarget $aim1
$tiger1.gun waittill ontarget
$tiger1.gun startfiring
wait(1)
$tiger1.gun stopFiring
wait 5

Posted: Thu Jul 31, 2003 11:51 pm
by LT.BARNES
i got rid of the randomshoot.scr and the anim fire like u said alcoh..

it does exact same!?

i mean it moves and u see the tank fire.

but u don't hear it move or fire or nothin.

this is what it looks like now (showing u one of the paths)

tiger:

$tiger1 setcollisionentity self.target // Set the tank collision mask
$tiger1.angle = 360
$tiger1.gun = $tiger1 QueryTurretSlotEntity 0
$tiger1 nodamage

tankagain:

// start at tank. head towards garden, then church

$node1.target = NULL
$tiger1 drive $node1
$tiger1 waittill drive
$tiger1 stop
$tiger1.gun setAimTarget $aim1
$tiger1.gun waittill ontarget
$tiger1.gun startfiring
wait(1)
$tiger1.gun stopFiring
wait 5

Posted: Fri Aug 01, 2003 2:01 pm
by LT.BARNES
can anyone help with this plz???


why is there no sound with the tank?
why can i only see the animation of the tank fire, and not the explosion?


tiger:

$tiger1 setcollisionentity self.target // Set the tank collision mask
$tiger1.angle = 360
local.gun = $tiger1 QueryTurretSlotEntity 0

// Set the tank's immunities.
self immune bullet
self immune fast_bullet
self immune grenade
self immune bash
$tiger1 nodamage

tankagain:

$node1.target = NULL
$tiger1 drive $node1
$tiger1 waittill drive
$tiger1 stop
local.gun setAimTarget $aim1
local.gun waittill ontarget
local.gun startfiring
wait 1
local.gun stopFiring
wait 5

Posted: Fri Aug 01, 2003 8:49 pm
by Alcoholic
you tell the tank to drive to $node1. have you tried giving it some speed/acceleration/lookahead/reachdistance values?