Units not moving into attack range? Others are running up to practically hug enemy models.

Units not moving into attack range? Others are running up to practically hug enemy models.

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
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Units not moving into attack range? Others are running up to practically hug enemy models.

Post by smoth »

The ranges are normal just the units are behaving peculiar.

https://www.youtube.com/watch?v=0iNeAVR_doQ

anyone have thoughts?

Code: Select all

-- UNITDEF -- T61 --
--------------------------------------------------------------------------------

local unitName = "t61"

--------------------------------------------------------------------------------

local unitDef = {
  acceleration       = 0.05,
  bmcode             = "1",
  brakeRate          = 1,
  
  
  builder            = false,
  buildTime          = 10,
  buildpic			 = "T61.png",
  canAttack          = true,
  canGuard           = true,
  canMove            = true,
  canPatrol          = true,
  cantBeTransported  = true,
  canstop            = "1",
  category           = " NOTAIR",
  corpse             = "dead",
  defaultmissiontype = "standby",
  description        = "Support tank",
  explodeAs          = "RED_EXPLOSION",
  firestandorders    = "1",
  footprintX         = 3,
  footprintZ         = 3,
  collisionvolumetype  = "box",
  collisionvolumescales = "25 18 32",
  collisionvolumeoffsets = "0 0 0",
  iconType           = "fed",
  idleAutoHeal       = 0,
  leaveTracks        = true,
  maneuverleashlength = "300",
  mass               = 2000,
  maxDamage          = 900,
  maxSlope           = 15.00,
  maxVelocity        = 2.4,
  maxWaterDepth      = 2,
  minCloakDistance   = 76.84440612793,
  mobilestandorders  = "1",
  movementClass      = "tank3",
  name               = "Type 61 tank",
  noChaseCategory    = "AIR",
  objectName         = "units/T61.s3o",
  power              = 4,
  reclaimable        = false,
  script		 	 = "t61.cob",
  selfDestructAs     = "RED_EXPLOSION",
  shootme            = "1",
  side               = "renpou",
  sightDistance      = 900.00,
  smoothAnim         = true,
  standingfireorder  = "2",
  standingmoveorder  = "1",
  steeringmode       = "2",
  TEDClass           = "KBOT",
  threed             = "1",
  trackOffset        = 12,
  trackStrength      = 5,
  trackStretch       = 1,
  trackType          = "StdTank",
  trackWidth         = 18,
  transportByEnemy   = false,
  turnRate           = 500,
  unitname           = "t61",
  unitnumber         = "424",


  customparams = {    
	factionname		   = "federation",
	},
  sfxtypes = {
    explosiongenerators = {
      "custom:greymuzzle",
    },
  },
  sounds = {
    canceldestruct     = "cancel2",
    underattack        = "warning1",
    arrived = {
      "tank",
    },
    cant = {
      "cantdo4",
    },
    count = {
      "count5",
      "count4",
      "count3",
      "count2",
      "count1",
      "count0",
    },
    ok = {
      "tank",
    },
    select = {
      "tank",
    },
  },
  weapons = {
    [1]  = {
      name               = "t61shot",
      onlyTargetCategory = "NOTAIR",
    },
	[2]  = {
	  badTargetCategory  = "AIR",
      mainDir            = "0 0.5 1",
      maxAngleDif        = 110,
      name               = "smokegrenade",
    },
  },
}


--------------------------------------------------------------------------------

local featureDefs = {
  dead = {
    blocking           = false,
    category           = "_corpses",
    damage             = 800,
    description        = "Wreckage",
    footprintX         = 4,
    footprintZ         = 4,
    height             = "10",
    hitdensity         = "70",
	collisionvolumetype  = "box",
	collisionvolumescales = "25 18 32",
	collisionvolumeoffsets = "0 0 0",    
    object             = "T61_dead",
    reclaimable        = true,
    seqnamereclamate   = "tree1reclamate",
    world              = "All Worlds",
  },
}
unitDef.featureDefs = featureDefs


--------------------------------------------------------------------------------

return lowerkeys({ [unitName] = unitDef })

--------------------------------------------------------------------------------

Code: Select all

--------------------------------------------------------------------------------

local weaponDef = {
  areaOfEffect       = 32,
  beamTime           = 0.4,
  weapontype         = "LaserCannon",
  coreThickness      = 0.2,
  explosionGenerator = "custom:BulletImpact",
  fallOffRate        = 0.1,
  --filename           = "weapons/t61shot.tdf",
  impactOnly         = 0,
  impulseFactor      = 0,
  largeBeamLaser     = true,
  
  movingAccuracy     = 500,
  name               = "150mm cannon",
  noSelfDamage       = true,
  projectiles		 = 2,  
  range              = 470,
  reloadtime         = 2,
  rgbColor           = "1 0.2 0.0",  
  rgbColor2          = "1 0.5 0.3", 

  soundHit           = "boom1",
  soundStart         = "boom3",
  soundTrigger       = true,
  startVelocity      = 1000,
  texture1           = "bigshot",
  texture2           = "bigshot_front",
  thickness          = 1,
  turret             = true,
  weaponTimer        = 2,
  weaponVelocity     = 1000,
  customparams = {
	damagetype		= "explosive",  
  },      
  damage = {
    default            = 120,
  },
}
--------------------------------------------------------------------------------

return lowerkeys({["t61shot"] = weaponDef})

--------------------------------------------------------------------------------
raaar
Metal Factions Developer
Posts: 1094
Joined: 20 Feb 2010, 12:17

Re: Units not moving into attack range? Others are running up to practically hug enemy models.

Post by raaar »

there's an engine feature that makes units with two weapons stay at the range of the longest ranged weapon, which can be a secondary longer ranged low dps weapon instead of coming closer to fire with their primary weapon.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Units not moving into attack range? Others are running up to practically hug enemy models.

Post by smoth »

Thanks! I would have never been able to find that!

is there a way to tell the engine that I want it to make one of the weapons the range finder for that unit instead?
raaar
Metal Factions Developer
Posts: 1094
Joined: 20 Feb 2010, 12:17

Re: Units not moving into attack range? Others are running up to practically hug enemy models.

Post by raaar »

not sure, maybe you can set the range through this

Code: Select all

Spring.SetUnitMaxRange

 ( number unitID, number maxRange ) -> nil
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Units not moving into attack range? Others are running up to practically hug enemy models.

Post by smoth »

I'll have to add an override gadget, thanks for the help!

Any idea why units are not moving into position where they can shoot? as in there are 3 units, they don't walk to the side of the unit that already has sight instead they either push the unit or just stand there.
raaar
Metal Factions Developer
Posts: 1094
Joined: 20 Feb 2010, 12:17

Re: Units not moving into attack range? Others are running up to practically hug enemy models.

Post by raaar »

not sure, I think that's yet another unsolved engine fail.

units either stand there, move forward to try and get a clear line of fire or chase the enemy at max speed if it moves away, even if it's still well within firing range. This makes groups of fast short ranged units move in and hug a tough building or a slow retreating target, to the point where many won't even be able to fire...

the current workaround is educating the playerbase to use and redraw line formation often when maneuvering groups.
Last edited by raaar on 25 Nov 2016, 06:27, edited 1 time in total.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Units not moving into attack range? Others are running up to practically hug enemy models.

Post by smoth »

it wasn't there before, hopefully a fix is coming.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: Units not moving into attack range? Others are running up to practically hug enemy models.

Post by FLOZi »

The maxrange call doesn't quite work like that, unfortunately I can't quite remember what I did and why with that call. :( Seem to recall it didn't 100% resolve my issue either.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Units not moving into attack range? Others are running up to practically hug enemy models.

Post by smoth »

bugger all, I am pretty sure I remember it not being that way. Otherwise I would have said something earlier but I missed several versions of spring. Been playing in 93 for a while.
Post Reply

Return to “Game Development”