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

Post your scripting questions / solutions here

Moderator: Moderators

LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

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

Post 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
...prepare for your finest hour...
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 »

have you tried the search? there's at least 2 possible ways people have posted
hope this helps, prob not cos it's all foreign 2 me :-/
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post by LT.BARNES »

didn't find anything.

i want a tank to go around my mp level and jus shoot at places
...prepare for your finest hour...
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post 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??
...prepare for your finest hour...
Parts
Sergeant
Posts: 72
Joined: Thu Apr 10, 2003 12:35 pm
Location: UK
Contact:

Post 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
[VS-UK]Capt.Parts[BnHQ]
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post by LT.BARNES »

where abouts is it in mohfiles??
...prepare for your finest hour...
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post 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
...prepare for your finest hour...
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post 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:
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post 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
...prepare for your finest hour...
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post 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
...prepare for your finest hour...
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

you dont use anim fire and startfiring. either use anim fire or stop/start firing
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post 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
...prepare for your finest hour...
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post 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
...prepare for your finest hour...
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post 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
...prepare for your finest hour...
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

you tell the tank to drive to $node1. have you tried giving it some speed/acceleration/lookahead/reachdistance values?
Post Reply