Error

Post your scripting questions / solutions here

Moderator: Moderators

User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Glad you got it to work . If you want to save a bit of typeing you could have named all the targets and boom with the same targetnames like $flak_axis_target and $flak_axis_boom and done this . When more than one entity has the same targetname the game creates a targetname array so you put two or more $flak_axis_target and the game makes them into $flak_axis_target[1] $flak_axis_target[2] etc . You can find out how many you have in the game by useing $flak_axis_target.size so if you have 5 of them with the same targetname then

$flak_axis_target.size = 5 just easier when you do a random selection .

local.rand= randomint($flak_axis_target.size)+1 // random numbers start at 0 targetname arrays start at 1
$flak.gun setaimtarget $flak_axis_target[local.rand]
wait 5
$flak.gun waittill ontarget
$flak.gun anim fire
wait 0.5
$flak.gun sound flak_snd_reload
local.index=randomint($flak_axis_boom.size)+1
local.ent = spawn models/projectiles/Berlin_Bombs.tik origin $flak_axis_boom[local.index].origin
Post Reply