Bomber spread problem

Bomber spread problem

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
shooter98
Posts: 12
Joined: 06 Jul 2011, 11:21

Bomber spread problem

Post by shooter98 »

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.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: Bomber spread problem

Post by FLOZi »

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:

Code: Select all

Explosion(weaponID, px, py, pz, ownerID)
But you have to use the call:

Code: Select all

Script.SetWatchWeapon(weaponDefID, true)
to enable it, where weaponDefID is the ID of your bomb weapondef.
shooter98
Posts: 12
Joined: 06 Jul 2011, 11:21

Re: Bomber spread problem

Post by shooter98 »

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

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,
(I commented out the sprayangle and the accuracy)
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Bomber spread problem

Post by KDR_11k »

FLOZi wrote:Is a true dropped weapon? iirc sprayangle doesn't work on those, you may have to fake bombs with another weapon type.
I think I added that actually.
shooter98
Posts: 12
Joined: 06 Jul 2011, 11:21

Re: Bomber spread problem

Post by shooter98 »

Sprayangle dont work (is 10k sprayangle much? :roll: )
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Bomber spread problem

Post by knorke »

tracks = true,
turnRate = 16000,
Maybe the tracking is so strong that sprayAngle has no effect, try removing that/lower turnrate.

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.
shooter98
Posts: 12
Joined: 06 Jul 2011, 11:21

Re: Bomber spread problem

Post by shooter98 »

I commented out the turnrate and now it works! :lol: but still no explosion callin... :cry:

Image
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: Bomber spread problem

Post by FLOZi »

Did you use Script.SetWatchWeapon? You won't get any Explosion(...) callin without it.
shooter98
Posts: 12
Joined: 06 Jul 2011, 11:21

Re: Bomber spread problem

Post by shooter98 »

FLOZi wrote:Did you use Script.SetWatchWeapon? You won't get any Explosion(...) callin without it.
Yup.

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
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: Bomber spread problem

Post by FLOZi »

That isn't how it works. :P

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
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!)
shooter98
Posts: 12
Joined: 06 Jul 2011, 11:21

Re: Bomber spread problem

Post by shooter98 »

I modifyed the unit_explosion_spawn gadget and now it works :lol: ! Thx for the support!
Post Reply

Return to “Game Development”