Bomber spread problem
Moderator: Moderators
Bomber spread problem
Hello i've played spring for a while and decided to make some units to it (i've made an unit already) and is using Zero-k as base, now i'm working on an kamikaze bomber that spawns 3 types of units (total 5 units) when the bombs impacts. The problem is to make that it don't shoot all of the weapons at one spot (3 weapons) i've tryed with accuracy and sprayangle in the unitdef but it doesn't work, how do i accomplish this spray (or formation)? Another problem is when i destroy the bomber, i can't destroy the bomber instant when it has fired because then the bombs don't spawn units on impact i've made an solution where i hide the bomber and wait untill the bombs should have exploded, is there an callin when the bombs have exploded?
PS. The unitdef and scipt is partialy stolen from Zero-k's licho.
PS. The unitdef and scipt is partialy stolen from Zero-k's licho.
Re: Bomber spread problem
Is a true dropped weapon? iirc sprayangle doesn't work on those, you may have to fake bombs with another weapon type.
As for the callin, you can use: But you have to use the call: to enable it, where weaponDefID is the ID of your bomb weapondef.
As for the callin, you can use:
Code: Select all
Explosion(weaponID, px, py, pz, ownerID)
Code: Select all
Script.SetWatchWeapon(weaponDefID, true)
Re: Bomber spread problem
The explosion callin don't work i think it is because the gadget that handles the unit spawn overrides the explosion (even if u have and explosion on the weapon it isn't showed. The weapontype is an missilelauncher
(I commented out the sprayangle and the accuracy)
Code: Select all
name = [[Levler Bomb]],
-- accuracy = 1024,
areaOfEffect = 0.1,
avoidFeature = false,
avoidFriendly = false,
burnblow = true,
collideFriendly = false,
commandfire = false,
damage = {
default = 100,
planes = 100,
subs = 125,
},
edgeEffectiveness = 0.5,
fireStarter = 0,
flightTime = 4,
impulseBoost = 0,
interceptedByShieldType = 0,
model = [[bigunitbomb.s3o]],
pitchtolerance = [[16000]],
range = 500,
reloadtime = 80,
renderType = 1,
smokedelay = [[0.2]],
smokeTrail = true,
startsmoke = [[1]],
startVelocity = 200,
-- sprayangle = 1000,
targetable = 1,
tolerance = 16000,
tracks = true,
turnRate = 16000,
weaponAcceleration = 100,
weaponTimer = 6,
weaponType = [[MissileLauncher]],
weaponVelocity = 600,
Re: Bomber spread problem
I think I added that actually.FLOZi wrote:Is a true dropped weapon? iirc sprayangle doesn't work on those, you may have to fake bombs with another weapon type.
Re: Bomber spread problem
Sprayangle dont work (is 10k sprayangle much?
)

Re: Bomber spread problem
Maybe the tracking is so strong that sprayAngle has no effect, try removing that/lower turnrate.tracks = true,
turnRate = 16000,
no idea if sprayAngle works on bombs but you could get spread out bombs by making the weapon fire a burst of bombs, then bombs should impact in a line because the plane is moving.
Re: Bomber spread problem
I commented out the turnrate and now it works!
but still no explosion callin... 




Re: Bomber spread problem
Did you use Script.SetWatchWeapon? You won't get any Explosion(...) callin without it.
Re: Bomber spread problem
Yup.FLOZi wrote:Did you use Script.SetWatchWeapon? You won't get any Explosion(...) callin without it.
Code: Select all
function script.Create()
Spring.Echo("create")
StartThread(SmokeUnit)
Hide( rearthrust)
Hide( wingthrust1)
Hide( wingthrust2)
Hide( drop1)
Hide( drop2)
Script.SetWatchWeapon(1, true)
Script.SetWatchWeapon(2, true)
Script.SetWatchWeapon(3, true)
Script.SetWatchWeapon(4, true)
Script.SetWatchWeapon(5, true)
end
function Explosion(num, px, py, pz, ownerID)
Spring.Echo("Explosion")
Spring.Echo(num)
if num == 1 then
gun1fired = true
checkDestroy()
elseif num==2 then
gun2fired = true
checkDestroy()
elseif num==3 then
gun3fired = true
checkDestroy()
elseif num==4 then
gun4fired = true
checkDestroy()
elseif num==5 then
gun5fired = true
checkDestroy()
end
end
Re: Bomber spread problem
That isn't how it works.
It is not a LUS callout * (i know the Script. prefix may be confusing).
Try, in a gadget:
Note that Explosion() is also a gadget callin and not a LUS one.
* (Although technically you could find the weapon def id in a LUS and call it there if you really wanted to!)

It is not a LUS callout * (i know the Script. prefix may be confusing).
Try, in a gadget:
Code: Select all
function gadget:Initialize()
local bombDefID = WeaponDefNames["TheNameOfMyAwesomeBombWeapon"].id -- change to suit :P
Script.SetWatchWeapon(bombDefID, true)
end
* (Although technically you could find the weapon def id in a LUS and call it there if you really wanted to!)
Re: Bomber spread problem
I modifyed the unit_explosion_spawn gadget and now it works
! Thx for the support!
