Page 1 of 1

Do weapons support categories for damage?

Posted: 24 Oct 2006, 14:19
by MadRat
I'm new here and have just skimmed over the tutorials. One of my pet peeves with modding TA was that you couldn't tell weapons that they could only affect certain unit categories. Instead one had to define every unit under the sun if they had slightly different effects per unit. And when creating games with 3rd party units you had to meticulously go back through every weapon to make sure they were within the weapons files. I've always thought that it would of been more wise to say something anti-air has so much effect on air units. Something anti-vehicle has so much anti-vehicle, and so on.

Does Spring fix this?

Posted: 24 Oct 2006, 14:46
by FireCrack
I beleive you can do this.

Posted: 24 Oct 2006, 17:02
by KDR_11k
Yes, instead of unitnames the damage section now takes the keywords defined in the armor.txt that's supposed to be in the root folder of your mod.

Posted: 24 Oct 2006, 20:29
by PauloMorfeo
Just keep in mind that the system is broken as you can read in this thread:
http://taspring.clan-sy.com/phpbb/viewt ... 632#128632

To sum it up, a unit can only efectively belong to one class in Armor.txt.

Posted: 25 Oct 2006, 01:31
by Argh
Just because you're not doing it right does not mean it doesn't work, as I stated in that thread :P

Posted: 25 Oct 2006, 03:46
by MadRat
Its explained like mud in that thread unfortunately. I would think it would build an array with weapons in one coordinate and unit names in another. When it builds the array I'd think it would first look through damage according to a unit category (in this case its per unit in the armor.txt file?) and then individual listings under the specified damage lists. I'd think the latter value would overwrite the former value.

Argh, can you explain this in simple layman's terms?

Posted: 25 Oct 2006, 08:28
by Argh
Firstly, go download NanoBlobs 0.63... it is full of things that will teach you how mods should be structured, how to use many advanced features of Spring, has commented animation scripts, and much more. If you still have questions after looking through it, let me know.

Posted: 25 Oct 2006, 13:28
by PauloMorfeo
Argh wrote:Just because you're not doing it right does not mean it doesn't work, as I stated in that thread :P
I'm sorry Argh, but you are quite wrong. As i stated in that thread :P.

https://taspring.clan-sy.com/svn/spring ... /UnitDef.h

Code: Select all

struct UnitDef
{
	...
	int armorType;
	...
}
https://taspring.clan-sy.com/svn/spring ... andler.cpp

Code: Select all

void CUnitDefHandler::ParseTAUnit(std::string file, int id)
{
	ud.armorType=damageArrayHandler->GetTypeFromName(ud.name);
}
Units can belong to only one armor type. Your mod works fine because you don't have any unit in more than one class. If you did, you would notice that the armor.txt thing is broken, that a unit would be associated to only one of the classes in armor.txt to which it would suposedly belong.

I swear, this is the last time i will bother explaining that it is broken...

Posted: 26 Oct 2006, 02:15
by Argh
It is not broken... you're just expecting it to do something it wasn't designed to do. Why is using one Armor class so hard? You can just adjust by weapon, like I did in NanoBlobs... no problems. If you have a very special case you need a very special value for, then create that special case. It's not that hard :P

Posted: 26 Oct 2006, 13:56
by PauloMorfeo
Argh wrote:It is not broken... you're just expecting it to do something it wasn't designed to do. ...
- The documentation in the wiki explains diferently.
- It was meant to work diferently (don't know how it actually did in oTA).
- It sucks...
Argh wrote:... Why is using one Armor class so hard? ...
And it sucks because, imagine this: i have a Bulldog. I want it to belong to all of these classes:
- GroundUnits
- BattleTanks
- Lvl2Units
- Lvl2BattleTanks
So i can make weapons give dif dmg to all ground units, or only to battletanks, or ..., or ...

Not that it bothers me that much, you know, because i have always been all for using the least amount (few or none) of special damages. (i don't like rock/paper/scissors) But i think it is important to be noted because i know for sure that newcoming moderss, like the original poster, will try to put units into more than one class in armor.txt and will end up wondering why it doesn't works (if it notices at all).

Posted: 27 Oct 2006, 05:39
by Pxtl
Well, multiple armour classes does create the problem of which to choose when a weapon has damages defined for two different classes that the target is both a member of.

Really, single class would be enough _if_ your classes and various other stats are being generated through an external script. If you're hand coding, it's not really expressive enough if you have complex armour classing system.

Posted: 27 Oct 2006, 06:13
by Argh
Paulo... if you have a Bulldog, and you need it to have a very special class... just make a class called "Bulldog"... add it to the weapons... and you're done. Then the Bulldog either takes default damage, or Bulldog damage, if it exists. This is how it was done in OTA, and since weapons can only apply one type of damage to one type of object, I still don't see the problem here.

If you assigned a Bulldog to multiple damage categories, then... how would the engine decide which one to apply? For example:

Code: Select all

[DAMAGE]
{
default=1000;
GroundUnits=200;
BattleTanks=2000;
Lvl2Units=1500;
Lvl2BattleTanks=1000;
}
The first one? The last one? A random one? Give me a break! If you really need to have that Bulldog take special damage from a certain weapon, make class like this:

[BULLDOG]
{
Bulldog=99;
}

Then have any weapons that do special damage to the Bulldog have a Bulldog category in their damage table, otherwise have them do default :-) It's really that easy. I don't see adding a Bulldog category, in the very few cases that might call for it in a mod that doesn't make very strong use of RPS balance ... as a major big deal. In NanoBlobs, where I do very strongly make use of RPS, I solved the problem by simply thinking through my categories logically, and reducing them to the lowest possible number that made game-design sense. Any small wrinkles that showed up are soooooo easily corrected by hitpoint adjustments to the unit that is having problems that it really isn't an issue at all.

Posted: 27 Oct 2006, 13:13
by Snipawolf
I am going to have flesh, light, heavy, and fortified armors :P

Flesh is kinda simple, huh?
Light covers light vehicles and airplanes.
Heavy covers my tanks and other stuff.
Fortified is for buildings and extremely large units..

Posted: 27 Oct 2006, 19:47
by Caydr
As Argh says, units can only exist in one category if you want things to work right. That's all there is to it.

The reason the wiki says otherwise can be found in the list of users who contributed to that particular page and the dates on which they did so. They were individuals who had little or not experience in modding Spring at the time.