Page 1 of 1

What can I do to my tank tik or script so the bots will atta

Posted: Mon Aug 04, 2003 4:16 pm
by small_sumo
What can I do to my tank tik or script so the bots will attack it?

Thanks

Posted: Mon Aug 04, 2003 5:25 pm
by jv_map
Attach a hidden AI to it ;). Use the ai_off and nodamage commands to make sure it works properly.

Posted: Mon Aug 04, 2003 6:10 pm
by small_sumo
So like

$glue bob to mytank

$bob ai_off etc etc

Posted: Mon Aug 04, 2003 6:45 pm
by jv_map
Yeah but if the tank doesn't want to drive anymore, attach him to a passengerslot.

Posted: Tue Aug 05, 2003 1:08 am
by small_sumo
Ok thanks, I have a couple in my spr map, one busts through a wall then gets bombed by a plane, I might not make him a target till the plane does the job. And if he dies in the wrong place the bots get stuck on him.

How can I script him so he wont take damage till he reaches the end of his path, or even better on a timer because the plane is on a timer and also, might have to cancel out the bot running over bit so the tank doesnt get held up at all.

This is the script

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Save the"
setcvar "g_obj_alliedtext2" "Bridge"
setcvar "g_obj_alliedtext3" "..da"
setcvar "g_obj_axistext1" "Bombardieren"
setcvar "g_obj_axistext2" "Sie Br?cke"
setcvar "g_obj_axistext3" "..da"

setcvar "g_scoreboardpic" "obj_spr-final-scene"

exec global/DMprecache.scr

//jv's new sound workaround ..... here goes.

local.master = spawn ScriptMaster

//local.master aliascache wind_top sound/sumo/topwind.wav soundparms 2.0 0.0 1.0 0.0 1000 3000 auto loaded maps "obj"
//local.master aliascache wind_bottom sound/sumo/bottomwind.wav soundparms 2.0 0.0 1.0 0.0 1000 3000 auto loaded maps "obj"
//local.master aliascache radio_loop2 sound/sumo/Rachmaninov.mp3 soundparms 1.5 0.0 1.0 0.0 1000 3000 auto loaded maps "obj"



level waitTill prespawn ///////////////////////***********************************************************

exec global/exploder.scr
exec global/bomber.scr
level.script = maps/obj/obj_spr-final-scene.scr
exec global/ambient.scr mohdm1
//$exploder notsolid
$bridge_bike notsolid
$baggy_bum notsolid
thread tanks
thread bomb_that_tank


level waittill spawn ///////////////////////***********************************************************

level.jvbot_showavatar = 0
level.debug_light = 0
level.jvbot_respawning = 1 // uhm, better just leave at 1 for the beta
level.alliesbots = 4 // max number of bots
level.axisbots = 6
level.dmrespawning = 1 // respawn players, necessary!
level.dmroundlimit = 10
level.clockside = "allies" // allies win when timelimit is hit
level.defusing_team = "allies"
level.planting_team = "axis" // can be set per individual bomb as well by using the $plantteam key
level.bomb_damage = 128
level.bomb_explosion_radius = 128
level.jvbot_tasks_priority[follow] = 3
level.jvbot_weapon_priority["bazooka"] = 5
level.jvbot_weapon_priority["panzerschrek"] = 5
$bomb thread global/jv_obj_dm.scr::bomb_thinker
level.routelist[bomb] = river::bridge::wiggle
waitthread global/jv_bots/jv_mp_ai.scr::enable 0 0 0 0 // enables bots
while !(level.roundstart)
wait 0.5
thread axis_win_check



end

axis_win_check:

while($bomb.exploded != 1)
wait 0.5

//while($bomb2.exploded != 1)
//wait 0.5

//while($bomb3.exploded != 1)
//wait 0.5

//while($bomb4.exploded != 1)
//wait 0.5

level.axiswin = 1
//level.dmroundlimit = (level.dmroundlimit + 18)
// thread camera_mover
//wait 18

teamwin axis


end

bomb_that_tank:

wait 75
thread global/bomber.scr::bomb 8

end

tanks:
//exec global/jv_mp_players.scr::main_player_handler

wait 30

thread global/exploder.scr::explode 2
wait .5
$panzer.health = 100
$panzer.destroyed_model = "models/vehicles/panzer_iv_eud.tik"

$panzer.accuracy = 75
// steady barrel time
$panzer.shoottime = 0.5
$panzer.firedelay = 4
$panzer waitexec global/jv_mp_library.scr::tank_setup
$panzer.turret.targetlist = NULL
$panzer thread targeting
$panzer thread global/jv_mp_library.scr::think
while (level.roundstart != 1)
wait 2
$panzer thread global/jv_mp_library.scr::tank_drive_path $panzerroute 7
$panzer thread dontcrushbots
$panzer waittill death
wait 0.5
$panzer_destroyed thread getout

end

get_targets:
// find player targets
local.players = waitthread global/jv_mp_players.scr::get_active_players $player
local.enemy_players = waitthread global/jv_mp_players.scr::get_team_players local.players allies
local.enemy_players_inrange = waitthread global/jv_mp_players.scr::get_area_entities local.enemy_players self.origin self.maxrange

// find bot targets
local.j = 0
if(level.botlastid != NIL)
{
for(local.i = 1; local.i <= level.botlastid; local.i++)
{
local.bot = level.actualbots[local.i]
if(isAlive local.bot)
{
if(local.bot.dmteam == allies)
{
if(vector_within local.bot.origin self.origin self.maxrange)
{
local.j++
local.enemy_bots_inrange[local.j] = local.bot
}
}
}
}
}

for(local.i = 1; local.i <= local.enemy_players_inrange.size; local.i++)
local.targets[local.i] = local.enemy_players_inrange[local.i]

for(local.i = local.enemy_players_inrange.size + 1; local.i <= local.enemy_players_inrange.size + local.enemy_bots_inrange.size; local.i++)
local.targets[local.i] = local.enemy_bots_inrange[local.i]


end local.targets

targeting:
// panzer tank barrel targeting
while(self)
{
local.targets = waitthread get_targets

// ready!
self.turret.targetlist = local.targets

waitframe
}
end

dontcrushbots:
while(isAlive self && self.driving)
{
if(level.botlastid != NIL)
{
for(local.i = 1; local.i <= level.botlastid; local.i++)
{
local.bot = level.actualbots[local.i]
if(self cansee local.bot 45 500)
{
// wait
//self modifydrive 0 20 256
while(self.driving && isAlive self && isAlive local.bot && self cansee local.bot 45 500)
{
self modifydrive 0 20 256
waitframe
}
if(self.driving && isAlive self)
self modifydrive self.speed 20 256
}
if !(self.driving && isAlive self)
break
}
}
waitframe
}
end

// copied from vehicles_thinkers.scr

getout:
local.anims[0] = panzer_exit_1
local.anims[1] = panzer_exit_2
local.anims[2] = panzer_exit_3

local.name = self

wait 3
if (self.state != "open")
self anim open
wait 1
//self waittill animdone
if (self.state != "open")
{
self anim open_idle
self.state = "open"
}

//insert roberts random sorter here
exec global/randomorder.scr local.anims

for (local.i = 0; local.i < 4; local.i ++)
{
if ((randomint 100) <= 70)
{
if (local.anims[local.i])
{
waitthread tank_guy_spawn local.anims[local.i] local.name
}
}
}
end

tank_guy_spawn local.type local.name:
println "z: spawning guy to get out " local.type

local.model_type = "models/human/sumo_german_wehrmact_grenadier.tik"

local.ent = spawn local.model_type
local.ent.origin = self gettagposition "tag_start"
local.ent.angles = self gettagangles "tag_start"

local.ent noticescale 1
local.ent sight 4500
local.ent mindist 2024
local.ent maxdist 2448
local.ent leash 10000

if (level.dontdropweapons == 1)
local.ent dontdropweapons

local.ent exec global/disable_ai.scr
local.ent notsolid

println "z: starting anim: " local.name " " local.type
local.ent anim_noclip local.type
local.ent waittill animdone
println "z: ending anim: " local.name " " local.type


if (local.type == "panzer_exit_2")
local.ent.position = "crawl"
else if (local.type == "panzer_exit_3")
local.ent.health = 45

wait .4
println "z: making solid: " local.name " " local.type

local.ent solid


// wait 3
println "z: enabling AI: " local.name " " local.type

local.ent exec global/enable_ai.scr
end

Posted: Tue Aug 05, 2003 3:04 am
by Alcoholic
didnt look at it, but if you give the line

$whatever nodamage

he will be invulnerable, and

$whatever takedamage

will make him vulnerable again.

Posted: Tue Aug 05, 2003 5:08 am
by small_sumo
Thanks, hehe dah! LOL

And so one more thing how do I script his death

$mytank die

$kill mytank ???????


Th plane doesnt always kill it.

Posted: Tue Aug 05, 2003 6:29 am
by jv_map
$mytank takedamage
$mytank hurt (10 * $mytank.health)

8-)

Posted: Tue Aug 05, 2003 8:14 am
by small_sumo
he still takes damage while driving the path :(, but I have a solution fer now in this thread I have

kablooey:

thread global/exploder.scr::explode 9

//radiusdamage 512 512

end

that goes off when the bomb is dropped.

can we add $mytank die ?????

script looks like this now.







main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Save the"
setcvar "g_obj_alliedtext2" "Bridge"
setcvar "g_obj_alliedtext3" "..da"
setcvar "g_obj_axistext1" "Bombardieren"
setcvar "g_obj_axistext2" "Sie Br?cke"
setcvar "g_obj_axistext3" "..da"

setcvar "g_scoreboardpic" "obj_spr-final-scene"

exec global/DMprecache.scr

//jv's new sound workaround ..... here goes.

local.master = spawn ScriptMaster

//local.master aliascache wind_top sound/sumo/topwind.wav soundparms 2.0 0.0 1.0 0.0 1000 3000 auto loaded maps "obj"
//local.master aliascache wind_bottom sound/sumo/bottomwind.wav soundparms 2.0 0.0 1.0 0.0 1000 3000 auto loaded maps "obj"
//local.master aliascache radio_loop2 sound/sumo/Rachmaninov.mp3 soundparms 1.5 0.0 1.0 0.0 1000 3000 auto loaded maps "obj"



level waitTill prespawn ///////////////////////***********************************************************

exec global/cardgame.scr
exec global/exploder.scr
exec global/bomber.scr
level.script = maps/obj/obj_spr-final-scene.scr
exec global/ambient.scr mohdm1
//$exploder notsolid
$bridge_bike notsolid
$baggy_bum notsolid


level waittill spawn ///////////////////////***********************************************************


$panzer_bob exec global/disable_ai.scr
$panzer_bob hide
$panzer_bob threatbias ignoreme
$doods threatbias ignoreme
thread tanks
thread bomb_that_tank
level.jvbot_showavatar = 0
level.debug_light = 0
level.jvbot_respawning = 1 // uhm, better just leave at 1 for the beta
level.alliesbots = 1 // max number of bots
level.axisbots = 6
level.dmrespawning = 1 // respawn players, necessary!
level.dmroundlimit = 10
level.clockside = "allies" // allies win when timelimit is hit
level.defusing_team = "allies"
level.planting_team = "axis" // can be set per individual bomb as well by using the $plantteam key
level.bomb_damage = 128
level.bomb_explosion_radius = 128
level.jvbot_tasks_priority[follow] = 3
level.jvbot_weapon_priority["bazooka"] = 5
level.jvbot_weapon_priority["panzerschrek"] = 5
$bomb thread global/jv_obj_dm.scr::bomb_thinker
level.routelist[bomb] = river::bridge::wiggle
waitthread global/jv_bots/jv_mp_ai.scr::enable 0 0 0 0 // enables bots
while !(level.roundstart)
wait 0.5
thread axis_win_check



end

axis_win_check:

while($bomb.exploded != 1)
wait 0.5

//while($bomb2.exploded != 1)
//wait 0.5

//while($bomb3.exploded != 1)
//wait 0.5

//while($bomb4.exploded != 1)
//wait 0.5

level.axiswin = 1
//level.dmroundlimit = (level.dmroundlimit + 18)
thread camera_mover
wait 18

teamwin axis


end

bomb_that_tank:

wait 75
thread global/bomber.scr::bomb 8

end

tanks:
//exec global/jv_mp_players.scr::main_player_handler

$panzer nodamage
wait 30

thread global/exploder.scr::explode 2
wait .5
$panzer.health = 1
$panzer.destroyed_model = "models/vehicles/panzer_iv_eud.tik"

$panzer.accuracy = 75
// steady barrel time
$panzer.shoottime = 0.5
$panzer.firedelay = 4
$panzer waitexec global/jv_mp_library.scr::tank_setup
$panzer.turret.targetlist = NULL
$panzer thread targeting
$panzer thread global/jv_mp_library.scr::think
while (level.roundstart != 1)
wait 2
$panzer thread global/jv_mp_library.scr::tank_drive_path $panzerroute 7
$panzer takedamage
$panzer thread dontcrushbots
$panzer waittill death
wait 0.5
$panzer_destroyed thread getout

end

get_targets:
// find player targets
local.players = waitthread global/jv_mp_players.scr::get_active_players $player
local.enemy_players = waitthread global/jv_mp_players.scr::get_team_players local.players allies
local.enemy_players_inrange = waitthread global/jv_mp_players.scr::get_area_entities local.enemy_players self.origin self.maxrange

// find bot targets
local.j = 0
if(level.botlastid != NIL)
{
for(local.i = 1; local.i <= level.botlastid; local.i++)
{
local.bot = level.actualbots[local.i]
if(isAlive local.bot)
{
if(local.bot.dmteam == allies)
{
if(vector_within local.bot.origin self.origin self.maxrange)
{
local.j++
local.enemy_bots_inrange[local.j] = local.bot
}
}
}
}
}

for(local.i = 1; local.i <= local.enemy_players_inrange.size; local.i++)
local.targets[local.i] = local.enemy_players_inrange[local.i]

for(local.i = local.enemy_players_inrange.size + 1; local.i <= local.enemy_players_inrange.size + local.enemy_bots_inrange.size; local.i++)
local.targets[local.i] = local.enemy_bots_inrange[local.i]


end local.targets

targeting:
// panzer tank barrel targeting
while(self)
{
local.targets = waitthread get_targets

// ready!
self.turret.targetlist = local.targets

waitframe
}
end

dontcrushbots:
while(isAlive self && self.driving)
{
if(level.botlastid != NIL)
{
for(local.i = 1; local.i <= level.botlastid; local.i++)
{
local.bot = level.actualbots[local.i]
if(self cansee local.bot 45 500)
{
// wait
//self modifydrive 0 20 256
while(self.driving && isAlive self && isAlive local.bot && self cansee local.bot 45 500)
{
self modifydrive 0 20 256
waitframe
}
if(self.driving && isAlive self)
self modifydrive self.speed 20 256
}
if !(self.driving && isAlive self)
break
}
}
waitframe
}
end

// copied from vehicles_thinkers.scr

getout:
local.anims[0] = panzer_exit_1
local.anims[1] = panzer_exit_2
local.anims[2] = panzer_exit_3

local.name = self

wait 3
if (self.state != "open")
self anim open
wait 1
//self waittill animdone
if (self.state != "open")
{
self anim open_idle
self.state = "open"
}

//insert roberts random sorter here
exec global/randomorder.scr local.anims

for (local.i = 0; local.i < 4; local.i ++)
{
if ((randomint 100) <= 70)
{
if (local.anims[local.i])
{
waitthread tank_guy_spawn local.anims[local.i] local.name
}
}
}
end

tank_guy_spawn local.type local.name:
println "z: spawning guy to get out " local.type

local.model_type = "models/human/sumo_german_wehrmact_grenadier.tik"

local.ent = spawn local.model_type
local.ent.origin = self gettagposition "tag_start"
local.ent.angles = self gettagangles "tag_start"

local.ent noticescale 1
local.ent sight 4500
local.ent mindist 2024
local.ent maxdist 2448
local.ent leash 10000

if (level.dontdropweapons == 1)
local.ent dontdropweapons

local.ent exec global/disable_ai.scr
local.ent notsolid

println "z: starting anim: " local.name " " local.type
local.ent anim_noclip local.type
local.ent waittill animdone
println "z: ending anim: " local.name " " local.type


if (local.type == "panzer_exit_2")
local.ent.position = "crawl"
else if (local.type == "panzer_exit_3")
local.ent.health = 45

wait .4
println "z: making solid: " local.name " " local.type

local.ent solid


// wait 3
println "z: enabling AI: " local.name " " local.type

local.ent exec global/enable_ai.scr
end

kablooey:

thread global/exploder.scr::explode 9

//radiusdamage 512 512

end

camera_mover:


//$camera_trigger waittill trigger
local.player = parm.other
//thread flyby

//fadein 5 0 0 0 1
drawhud 0 // clear the screen
$player nodamage
$player hide
freezeplayer
letterbox .5
//$watch_camera fov 80 2
//$watch_camera speed (level.camera_speed)
//$watch_camera follow $camera_path $camera_target
$watch_camera follow $camera_target
//forcemusic aux3 aux3
$panzer_bob show
$panzer_bob thread panzer_bobs_big_thing

cuecamera $watch_camera

wait 10
locprint 300 300 ("Map By Small_Sumo" + "\n" + "\n" + "many thanks to" + "\n" + "Jv_map" + "\n" + "and TLTrude")
wait 7

drawhud 1
//setcvar cg_3rd_person 0
$watch_camera cut

//cueplayer


end



panzer_bobs_big_thing:


wait 5

self holster
self.enableEnemy = 0
while(isAlive self)
{
self walkto $panzer_bob_stand_here
self waittill movedone
//self anim scientist_scratch
//self waittill animdone
self anim smoking01
self waittill animdone
self anim smoking02
self waittill animdone
//self animfacial_idle_anger
//self waittill animdone
//self animfacial_idle_smile
//self waittill animdone
self anim american_salute
self waittill animdone
self anim idle

}

Posted: Tue Aug 05, 2003 9:02 pm
by Alcoholic
I don't think die is a valid function. :(

edit: May look confusing, but it's worth a shot.

$mytank damage NULL 9999 NULL (0 0 0) (0 0 0) (0 0 0) 10 20 15 -1

the most important number is 15, thats the meansofdeath. 15 is for rocket, so if its immune to rocket u gotta change it to somethign else..

Posted: Wed Aug 06, 2003 12:57 am
by small_sumo
This worked I found scorpio on msn.

:)


end

kablooey:

thread global/exploder.scr::explode 9
$panzer takedamage
$panzer hurt ($panzer.health+1)

end

Posted: Wed Aug 06, 2003 6:48 am
by jv_map
jv_map wrote:$mytank takedamage
$mytank hurt (10 * $mytank.health)

8-)
:roll: :wink:

Posted: Wed Aug 06, 2003 10:35 am
by small_sumo
Awe you did too. Hehe

I deserve the :roll:

Posted: Wed Aug 06, 2003 11:39 am
by Bjarne BZR
I prefer jv's version...





( Overkill.... sweeeeet... )

Posted: Tue Nov 18, 2003 6:39 am
by small_sumo
How do you tell how many passenger slots are in a vehecle?