Need togroundweapon=1; and general BAWWING

Need togroundweapon=1; and general BAWWING

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Need togroundweapon=1; and general BAWWING

Post by Forboding Angel »

Because currently there is no way to force a fighter to only attack ground.

OnlyTargetCategory and BadTargetCategory DO not work in this instance.

Relevant luadef:

Code: Select all

-- UNITDEF -- TSTEALTHBOMBER2 --
--------------------------------------------------------------------------------

local unitName = "tstealthbomber2"

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

local unitDef = {
  acceleration       = 0.05,
  altfromsealevel    = "1",
  BadTargetCategory  = "VTOL",
  bmcode             = "1",
  brakeRate          = 0.5,
  buildCostEnergy    = 3000,
  buildCostMetal     = 220,
  builder            = false,
  buildTime          = 4000,
  canAttack          = true,
  canDropFlare       = true,
  canFly             = true,
  canGuard           = true,
  canLoopbackAttack  = true,
  canMove            = true,
  canPatrol          = true,
  canstop            = "1",
  category           = "VTOL",
  collide            = false,
  collisionSphereScale = 1,
  copyright          = "Copyright 1997 Humongous Entertainment. All rights reserved.",
  corpse             = "ammobox",
  cruiseAlt          = 1000,
  defaultmissiontype = "VTOL_standby",
  description        = "Strategic Bomber",
  designation        = "VA-B3",
  energyMake         = 0.6,
  energyStorage      = 0,
  energyUse          = 0.6,
  explodeAs          = "BIG_UNITEX",
  firestandorders    = "1",
  flareDelay         = 0.3,
  flareDropVector    = "0 -.4 -1.3",
  flareefficieny     = "0.3",
  flareReload        = 4,
  floater            = true,
  footprintX         = 6,
  footprintZ         = 3,
  frenchdescription  = "Bombardier strat├â┬®gique",
  frenchname         = "Ouragan",
  germandescription  = "Strategischer Bomber",
  germanname         = "Hurricane",
  idleAutoHeal       = .5,
  idleTime           = 2200,
  italiandescription = "Bombardiere strategico",
  italianname        = "Hurricane",
  loopbackattack     = "1",
  maneuverleashlength = "1280",
  maxAcc             = 0.25,
  maxDamage          = 600,
  maxSlope           = 10,
  maxVelocity        = 10.1,
  maxWaterDepth      = 0,
  metalStorage       = 0,
  mobilestandorders  = "1",
  name               = "Whirlwind",
  noAutoFire         = false,
  noChaseCategory    = "VTOL",
  objectName         = "tstealthbomber2.s3o",
  onlytargetcategory1 = "NOTAIR",
  onlytargetcategory2 = "NOTAIR",
  onlytargetcategory5 = "NOTAIR",
  onlytargetcategory6 = "NOTAIR",
  ovradjust          = "1",
  radarDistance      = 0,
  radarDistanceJam   = 100,
  selfDestructAs     = "BIG_UNIT",
  shootme            = "1",
  side               = "CORE",
  sightDistance      = 612,
  smoothAnim         = true,
  spanishdescription = "Bombardero estrat├â┬®gico",
  spanishname        = "Hurricane",
  standingfireorder  = "2",
  standingmoveorder  = "1",
  stealth            = true,
  steeringmode       = "1",
  threed             = "1",
  turnRate           = 256,
  unitname           = "tstealthbomber2",
  unitnumber         = "112",
  version            = "1",
  workerTime         = 0,
  zbuffer            = "1",

  sfxtypes = {
    explosiongenerators = {
      "custom:jetbtrail",
    },
  },

  sounds = {
    underattack        = "unitsunderattack1",
    ok = {
      "ack",
    },
    select = {
      "unitselect",
    },
  },
  weapons = {
    [1]  = {
      def                = "SBOMB2",
      onlyTargetCategory = "NOTAIR",
      BadTargetCategory  = "VTOL",
    },
  },
}


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

local weaponDefs = {
  SBOMB2 = {
    areaOfEffect       = 250,
    avoidFriendly      = false,
    ballistic          = true,
    burst              = 10,
    burstrate          = 0.1,
    cegTag             = "heavybomb",
    collideFriendly    = false,
    commandfire        = true,
    explosionGenerator = "custom:xamelimpact",
    id                 = 5,
    interceptedByShieldType = 1,
    model              = "rocket.s3o",
    name               = "Bombs",
    noSelfDamage       = true,
    range              = 850,
    reloadtime         = 8,
    renderType         = 4,
    soundHit           = "bombhit.wav",
    soundStart         = "18393_inferno_reject.wav",
    sprayAngle         = 5000,
    startVelocity      = 50,
    turret             = true,
    tolerance          = 5000,
    weaponVelocity     = 200,
    damage = {
      default            = 165,
    },
  },
engineflare = {
    areaOfEffect       = 0,
    avoidFeature       = false,
    avoidFriendly      = false,
    beamlaser          = 1,
    beamTime           = 0.1,
    beamWeapon         = true,
    collideFeature     = false,
    collideFriendly    = false,
    coreThickness      = 0.1,
    duration           = 10,
    energypershot      = 0,
    fallOffRate        = 0.8,
    fireStarter        = 90,
    id                 = 666,
    impluse            = "0",
    largeBeamLaser     = true,
    lineOfSight        = true,
    name               = "Laser Battery",
    range              = 25,
    reloadtime         = 0,
    renderType         = 0,
    rgbColor           = "0.2 0.4 0.9",
    rgbColor2          = "0.8 0.7 0.9",
    sweep              = "1",
    sweepfire          = true,
    targetMoveError    = 0.3,
    texture            = "shot",
    thickness          = 1.5,
    tolerance          = 8000,
    turret             = true,
    weaponVelocity     = 1000,
    damage = {
      default            = 0,
    },
  },
}
unitDef.weaponDefs = weaponDefs


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

return lowerkeys({ [unitName] = unitDef })

--------------------------------------------------------------------------------
Last edited by Forboding Angel on 27 May 2008, 21:38, edited 1 time in total.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Need togroundweapon=1;

Post by smoth »

Code: Select all

	OnlyTargetCategory1=GROUND;
would do only ground units. if you want it to not target units or anything but can only target the ground..

Code: Select all

	OnlyTargetCategory1=CHUMBAWUMBA;
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Re: Need togroundweapon=1;

Post by Peet »

Do you know what toairweapon DOES? It just adds an onlytargetcategory to VTOL, using the existing category system, which is largely functional afaik.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Need togroundweapon=1;

Post by Forboding Angel »

All my ground units are in the notair category smoth.

Yes peet I know what it does, and it works perfectly. WOuld be nice to have a tag that does the same for ground as well.

And appearently OnlyTargetCategory only works when it feels like it. Pay attention. It is a fighter masquerading as a bomber seeings how spring's dropped=1 makes for uncounterable fail.
Last edited by Forboding Angel on 27 May 2008, 07:07, edited 1 time in total.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Need togroundweapon=1;

Post by smoth »

then category notair.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Need togroundweapon=1;

Post by Forboding Angel »

For christs sake, READ!
Forboding Angel wrote: onlytargetcategory1 = "NOTAIR",
onlytargetcategory2 = "NOTAIR",
:roll:


and lets not forget
onlyTargetCategory = "NOTAIR",
In the weapon thingy, just to make sure that it isn't missed anywhere.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Need togroundweapon=1;

Post by Forboding Angel »

Care to guess what these 2 fucknuggets are doing?
screen086.jpg
(78.46 KiB) Downloaded 48 times
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Re: Need togroundweapon=1;

Post by Gnomre »

viewtopic.php?f=21&t=11141
Argh wrote:
while executing a fight or patrol command, the aircraft is being given a command to attack the neutral unit, as evidenced by, with shift held down, a line from the aircraft to the neutral
Yes, that's what is happening. I'll send you a copy of the latest build of P.U.R.E., so that you can see it.
ILMTitan wrote:From what I could see, when the aircraft where executing a fight/patrol command, they acted correctly. The problem was when they became idle. r5453 should fix that behavior as well.
Argh wrote:Works! Great... one problem solved.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Need togroundweapon=1;

Post by smoth »

I am tempted to reply in kind but rather then that...

I redirect you to my prior post. Otherwise your prior post was unclear and you need to say what you want it targeting and what you don't. As it stands, it appears you misunderstand the purpose of categories.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Need togroundweapon=1;

Post by Forboding Angel »

Well the only purpose that I Use categories for is targetting. THat said, you didn't read the obvious and you aren't getting it.

I want the bombers to attack the notair category, so onlytargetcategory notair. Every ground unit is in the notair category. Every unit that flies is in the vtol category.

So how exactly am I missing the point here?

It's very simple

Only target this category means Don't target a completely different category (only target the category that I took the precious time to define). Funny how it works on everything but fighters huh? Works fine on gunships. The exact opposite happens with Dropped=1 bombers (but that's to be expected). Also works fine with ground units. Hovers, ships etc.


Tempted to respond in kind? Because you didn't read? In my first post I mentioned 2 tags, ctrl+f both of them. I wouldn't be irritated if you were trying to help, but neither you nor peet are even attempting to help. Peet thinks I don't understand what the toairweapon tag does, tho I clearly do. And can't understand why a togroundweapon tag would be useful.

Well here is why it would be useful. Because it always freaking works!
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Re: Need togroundweapon=1;

Post by Snipawolf »

Code: Select all

		BadTargetCategory=AIR;
	
		Weapon1=OSPREYFALSE;
		WeaponMainDir1=0 -1 1;
		MaxAngleDif1=135;
		
		Weapon2=OSPREYFALSEMG;
		WeaponMainDir2=0 -1 1;
		MaxAngleDif2=60;
		OnlyTargetCategory2=GROUND;
		
		Weapon3=OSPREYMG;
		
		Weapon4=OSPREYGATLING;
		WeaponMainDir4=0 0 1;
		MaxAngleDif4=90;
		
		Weapon5=OSPREYROCKET;
		WeaponMainDir5=0 0 1;
		MaxAngleDif5=180;
		OnlyTargetCategory5=GROUND;
		
		Weapon6=OSPREYROCKET;
		WeaponMainDir6=0 0 1;
		MaxAngleDif6=180;
		OnlyTargetCategory6=GROUND;
I get no problems with this...
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Re: Need togroundweapon=1;

Post by Gnomre »

Forboding Angel wrote:Well here is why it would be useful. Because it always freaking works!
Terrible argument:
1) toairweapon is just another method of saying "OnlyTargetCategoryN=VTOL" with a hardcoded category name
2) adding 'togroundweapon' would be an alias for 'GROUND' or whatever in the same way, creating another hardcoded category in an otherwise unrestricted system
3) adding 'togroundweapon' would fix nothing BECAUSE IT WOULD NOT CHANGE ANY BEHAVIOR it would just be another way of expressing "OnlyTargetCategoryN=GROUND"

Think of it in terms of some simple math:
a = b * stupidfuckingfightercode
c = b
a = c * stupidfuckingfightercode

a = the end result
b = OnlyTargetCategory
c = togroundweapon

Changing b to c changes exactly jack shit because the fighter code is (was) the thing that's fucked up, and it's supposedly already fixed. Had you searched a little...
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Need togroundweapon=1;

Post by Argh »

Not that I particularly want to get in the middle of this, since people aren't being pleasant... but, meh, it's fairly straightforward:

1. So far as I know, setting up the target categories works, for all Units. The only problem was with Fighters, and it only came up with Fighters dealing with Neutrals, where they weren't getting the same attack-cancellation result as other stuff. That was a side-issue, related to attack-handling of Neutral stuff in general, it's not even really relevant to this.

I haven't seen the problems you're describing, Forb- I have fighters (non-gunship, non-bombers) that can only attack ground, and fighters with mixed-use weaponry (anti-air, anti-ground) and they all work just fine in SVN. They no longer blindly chase other fighters that they cannot attack, for example. I just tested it, and it works.

2. So... meh, what I do is set up all of my categories...

Category=AIR LANDAIR;

Now, the only things that can target this Unit use OnlyTargetCategoryN == AIR || LANDAIR... all other types will not return a valid result.

Then set one for GROUND (and, eventually, one for WATER and UNDERWATER) and all of the situations are covered, basically.

So, basically, if a Unit's Category == GROUND, and OnlyTargetCategoryN == GROUND, then it can be targeted. Otherwise, no.

This was broken, pre current SVN, but is working at this time.

Using the generic "VTOL" label is, imo, complete fail. I created the LANDAIR category to separate out weapon systems that can attack both air and ground targets, to make the distinction very clear-cut. If you need even further distinctions, i.e., "use this long-range missile only on bombers or other high-value targets", you can definitely do that. It all works at this time, so far as I can determine, other than the well-known issues with flight behaviors.
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: Need togroundweapon=1;

Post by Evil4Zerggin »

Note that you can use multiple target categories for onlyTargetCategory, etc., as well as unit categories. So you can say onlyTargetCategory = "LAND AIR", and it will target anything with either the LAND or AIR categories. For example, the current CA setup doesn't have NOTAIR; instead I say onlyTargetCategory = "HOVER FLOAT SINK". I don't know if it's useful to you, but it simplified things when I found out about it; that way, we don't have to bother with categories like VTOLORFIREPROOF and such.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Need togroundweapon=1;

Post by KDR_11k »

The unit itself and its weapons all target independently of each other. To make the unit not target something you need NoChaseCategory AFAIK, OnlyTargetCategory only affects the weapons. For ground units it doesn't matter so much as they don't move very much when attacking but planes react a lot to their target so you notice when the unit body picks the wrong target.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Need togroundweapon=1;

Post by Pxtl »

Okay, so just to make this clear: right problem (air units are attacking units outside of their target categories) but wrong fix (a new tag). And the correct fix (make air units obey target categories) is already corrected by other means, am I right?

Either way, I really would like a ToAirWeapon and ToGroundWeapon, but with an implementation that actually considers the altitude of the given unit, instead of the current tag hack. That would be useful for every mod that has a clear land/air weapon delineation, from EE to BA. Thus, we could have SAMs that fire upon land-units that get impulsed into the air, and ground-only weapons that will fire upon landed aircraft.
Last edited by Pxtl on 27 May 2008, 15:31, edited 1 time in total.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Need togroundweapon=1;

Post by smoth »

forb most of us are unsure of what you are asking so attacking our ability to read does not do you any good. that said, I'll wash my hands of this thread until you calm down.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Need togroundweapon=1;

Post by Forboding Angel »

It's a little hard to be calm when I have been fighting this for 6+ months.

My implementation is very very simple

If it flies it is in the "VTOL" Category.
If it hovers or rolls on the ground or touches the ground at all it is in the "NOTAIR" Category.

Pretty simple right?

Well I wanted high altitude dive bombers, so I made fighters with a low velocity weapon and turret=false (I changed that to true recently to help their aim a little bit).

At any rate, the bombers try to attack one another, regardless of any instructions I give them. Even if togroundweapon is a hacky solution... Who cares? Not all of us use special damages. I for one hate them.

How are new modders supposed to learn about categories? We don't even have a compiled list of which ones are used and which ones aren't!

Is anyone going to fix categories and make the legible and easy to use? Oh and btw (I think it's fixed now), atm custom categories don't even work... You must use the hardcoded ones. Go Figure.

These little nuances need to be dealt with instead of brushed over because they "kind of" work.

/frustration

BTW smoth, none of this has been directed at you on a personal level. It was just very frustrating to me that I was receiving the same kind of answers that I expected to. Sorry if I came on too harsh. THis is just one of 2 or 3 things that have continually caused me trouble for over half a year, and I'm finally starting to get fed up with it.


On a good note, thanks to this issue, I found the solution to several other non spring related things I was struggling with (work stuff -- THis problem caused my mind to wander :-)).
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Need togroundweapon=1;

Post by KDR_11k »

ToGroundWeapon wouldn't do anything there because it would affect the weapon but your problem is the unit.
Is anyone going to fix categories and make the legible and easy to use? Oh and btw (I think it's fixed now), atm custom categories don't even work... You must use the hardcoded ones. Go Figure.
WTF are you talking about? You can use all the custom categories you want and they work fine. The only hardcoded ones are VTOL for toairweapon and COMMANDER for ctrl-c.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Need togroundweapon=1;

Post by smoth »

forb, I am pretty sure categories work. I will check them when i get home.
Post Reply

Return to “Engine”