auto firing cannon at player
Posted: Tue May 02, 2006 9:51 am
I have'nt done scripting in ages (or mapping come to that)but i thought i would try to do this tut but i just can not get it to work.
Here is the script can anyone let me know if there something missing please.(oh yeah its to make a cannon auto fire at the player)
main
exec global/loadout.scr maps/test_flak.scr
exec global/exploder.scr
exec global/friendly.scr
exec global/ai.scr
level.script = maps/test_flak.scr
level waittill prespawn
exec global/ambient.scr m3l3 // Ambient sound of the Normandy-levels.
level waittill spawn // Wait until the player has spawned into the level
fadein 2 0 0 0 1
wait 3 // A slow level fade in
$player item weapons/m1_garand.tik // The player gets the Garand-rifle
$player ammo rifle 40 // And 40 bullets for it
$player item weapons/M2frag_grenade_sp.tik // Also, the player gets hand grenades
$player ammo grenade 15 // The amount of grenades
Fire_88mm_weapon: // This script part will start as soon as the player runs through the trigger
local.gun_name = $88mm_weapon1 // Initialize the flak
local.target = $player // Defines the player as the 88?s target
local.gun_name setaimtarget local.target // Let the 88 aim at the player
wait(1) // Let the 88 wait before firing until the turning is done
local.range = 96 + randomint(128)
local.offset = 96 + randomint(128) // Defines the range and accuracy of the gun
local.gun_name anim fire_scripted // Starts the gun firing
wait(0.7 + ((randomint(6)) * .1)) // Random time from shooting til impact
local.a = local.target.origin
if((randomint(100)) < 50)
local.a[0] = local.a[0] + local.range
else
local.a[0] = local.a[0] - local.range
if((randomint(100)) < 50)
local.a[1] = local.a[1] + local.offset
else
local.a[1] = local.a[1] - local.offset // Redefines the target to make it look realistical
local.Exp1 = spawn "fx/scriptbazookaexplosion.tik"
local.Exp2 = spawn "animate/fx_mortar_dirt.tik"
local.Exp3 = spawn "animate/fx_mortar_higgins.tik" // Play the explosions
exec global/earthquake.scr .23 4 0 0 // The screen shakes each impact
local.Exp1.origin = local.a local.Exp1 anim start
local.Exp2.origin = local.a
local.Exp2 anim start
local.Exp3.origin = local.a
local.Exp3 anim start
wait(1) // Disables the animation
local.Exp1 remove
local.Exp2 remove
local.Exp3 remove // Removes the animations
local.gun_name setaimtarget $FlakBaseAim
end // This brings the 88 gun back to its starting position (needs a script_origin inside the map)
Here is the script can anyone let me know if there something missing please.(oh yeah its to make a cannon auto fire at the player)
main
exec global/loadout.scr maps/test_flak.scr
exec global/exploder.scr
exec global/friendly.scr
exec global/ai.scr
level.script = maps/test_flak.scr
level waittill prespawn
exec global/ambient.scr m3l3 // Ambient sound of the Normandy-levels.
level waittill spawn // Wait until the player has spawned into the level
fadein 2 0 0 0 1
wait 3 // A slow level fade in
$player item weapons/m1_garand.tik // The player gets the Garand-rifle
$player ammo rifle 40 // And 40 bullets for it
$player item weapons/M2frag_grenade_sp.tik // Also, the player gets hand grenades
$player ammo grenade 15 // The amount of grenades
Fire_88mm_weapon: // This script part will start as soon as the player runs through the trigger
local.gun_name = $88mm_weapon1 // Initialize the flak
local.target = $player // Defines the player as the 88?s target
local.gun_name setaimtarget local.target // Let the 88 aim at the player
wait(1) // Let the 88 wait before firing until the turning is done
local.range = 96 + randomint(128)
local.offset = 96 + randomint(128) // Defines the range and accuracy of the gun
local.gun_name anim fire_scripted // Starts the gun firing
wait(0.7 + ((randomint(6)) * .1)) // Random time from shooting til impact
local.a = local.target.origin
if((randomint(100)) < 50)
local.a[0] = local.a[0] + local.range
else
local.a[0] = local.a[0] - local.range
if((randomint(100)) < 50)
local.a[1] = local.a[1] + local.offset
else
local.a[1] = local.a[1] - local.offset // Redefines the target to make it look realistical
local.Exp1 = spawn "fx/scriptbazookaexplosion.tik"
local.Exp2 = spawn "animate/fx_mortar_dirt.tik"
local.Exp3 = spawn "animate/fx_mortar_higgins.tik" // Play the explosions
exec global/earthquake.scr .23 4 0 0 // The screen shakes each impact
local.Exp1.origin = local.a local.Exp1 anim start
local.Exp2.origin = local.a
local.Exp2 anim start
local.Exp3.origin = local.a
local.Exp3 anim start
wait(1) // Disables the animation
local.Exp1 remove
local.Exp2 remove
local.Exp3 remove // Removes the animations
local.gun_name setaimtarget $FlakBaseAim
end // This brings the 88 gun back to its starting position (needs a script_origin inside the map)