View topic - Controlling Damage


All times are UTC + 1 hour


Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Controlling Damage
PostPosted: 18 Mar 2010, 02:13 
Conflict Terra Developer
User avatar

Joined: 21 Jan 2010, 06:21
Location: Tucson
Alright, I have a question.
Code:
         damage                  = {
           default = 10,
      planes  = 30,
           subs    = 0.3,
         },


I see this in the unitdefs in CA, and I wonder what's going on exactly. The core reason why I'm asking is I'd like to adjust/control the damage like what this tidbit of script implies, but I basically don't want to be limited to planes and subs. An example is that I'd like a shot to do more damage to a "mech" than it would a "tank."

I wonder how I can control this, because I don't see default, planes or subs as the Category (the stuff like LAND and FIXEDWING in the CA scripts) and I'm wondering how the engine knows exactly what a plane and sub is. Are these hardcoded parts of the engine and I'll just have to make do, or is there an easy way for me to assign different damages to category's like tanks and mechs, and how would I exactly assign my tanks and mechs to these roles so it'll all work in the end?
Top
 Offline Profile  
 
 Post subject: Re: Controlling Damage
PostPosted: 18 Mar 2010, 02:34 
Zero-K Developer
User avatar

Joined: 14 Mar 2007, 03:44
Location: Fillydelphia
http://trac.caspring.org/browser/trunk/ ... ordefs.lua

As seen in the file, CA's armordefs.lua automatically assigns units to the PLANES armor category based on the canFly tag and the ELSE category if they don't have another armorcat, all other categories are manually defined.

If for whatever reason you don't want to use armordefs.lua, you can simply place a file named armor.txt in the root of the mod archive, for instance:
Code:
[small] {
   dagger=1;
   sword=1;
   warhammer=1;
   claymore=1;
   dronelauncherm=1;
   wraith=1;
   probe=1;
   gunstar_cannon=1;
   gunstar_torpedo=1;
}
[large] {
   carrier=1;
   supportcarrier=1;
   queencarrier=1;
   starbase=1;
   starslayer=1;
   comet=1;
   meteor=1;
   minelayer=1;
   eclipse=1;
   imperator=1;
   imperator_turret_plasma=1;
   imperator_hangar=1;
   imperator_hive=1;
   imperator_turret_am=1;
   imperator_turret_cannon=1;
   imperator_turret_pd=1;
}
[magsmall] {
   mace=1;
   longbow=1;
}
[drone] {
   dronem=1;
}
[torpedo] {
   torpedo=1;
   ftorpedo=1;
   shuriken=1;
}

(the numbers don't mean anything, they're just there for the parser)
Top
 Offline Profile  
 
 Post subject: Re: Controlling Damage
PostPosted: 19 Mar 2010, 19:44 
Conflict Terra Developer
User avatar

Joined: 21 Jan 2010, 06:21
Location: Tucson
Ok, well, of course I could not get it working. Here's what happened.

Tried your Armor.txt because it sounded simpler, so I made one and this is what it looks like:
Code:
[Mech]
{
   bengineer1=1;
   bbasicmech=1;
   bsnipermech=1;
   bsiegemech=1;
   bmissilemech=1;
   bengineer2=1;
   bheavymech=1;
   bheavysiegemech=1;
   bheavymissilemech=1;
}


It's short for testing purposes.

In my unit def, I then set the attack values in a way so I could easily see if it was doing what I wanted it to. Here's an example:
Code:
         damage                  = {
           default = 9999999,
      Mech = 1,

         },


So if the unit got killed in one blow, I'd know it didn't work. Well, it didn't work. I then tried the armordefs.lua but that didn't work either and I have a feeling I just did it wrong. So I'm more interested in getting the .txt to work, just because it seems simpler, and I'm okay with simple. I like simple.

So, what did I do wrong?
Top
 Offline Profile  
 
 Post subject: Re: Controlling Damage
PostPosted: 20 Mar 2010, 01:34 
MC: Legacy & Spring 1944 Developer
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
You should really embrace lua if you want to go far with Spring modding. Armor.txt in particular is an historical peculiarity which should never have happened.

S44 armourdefs.lua example:

http://spring1944.svn.sourceforge.net/v ... iew=markup

A brief example:

Code:
local armorDefs = {
  dudes  =  {
    "myfirstdude", -- these are unitdef names
    "myseconddude",
  },
  trukz = {
    "myfirsttruk",
    "mysecondtruk",
  },
}
return armorDefs


Then in a weapon:
Code:
--weapontags
damage = {
  default = 10,
  dudes = 100,
  trukz = 1,
}


(The only thing possibly wrong here, is that armourDefs may expect a named map, because trepan didn't bother to ask a modder how armor.txt worked when he converted it to lua. I guess i should really test that before posting this. I'll go test it now.)


Last edited by FLOZi on 20 Mar 2010, 01:50, edited 1 time in total.
Top
 Online Profile  
 
 Post subject: Re: Controlling Damage
PostPosted: 20 Mar 2010, 01:43 
MC: Legacy & Spring 1944 Developer
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
SIGH. Yeah, ffs. You need to add this tidbit:

Code:
for categoryName, categoryTable in pairs(armorDefs) do
  local t = {}
  for _, unitName in pairs(categoryTable) do
    t[unitName] = 1
  end
  armorDefs[categoryName] = t
end


before the "return armorDefs" :roll:
Top
 Online Profile  
 
 Post subject: Re: Controlling Damage
PostPosted: 20 Mar 2010, 02:30 
Conflict Terra Developer
User avatar

Joined: 21 Jan 2010, 06:21
Location: Tucson
Thank you very much Flozi, that worked.

Quick question, is it possible for a unit to belong to two different armor types? Sort of like the Categories, say a unit has "Tank" and "Mech" armor, what would happen? Would it take both the Tank and Mech damage values, or just the Tank or Mech damage values, depending on what the weapon is? I'm asking this mostly out of curiousity, I may or may not use it.

I'm pretty sure this has been apparent to those who've helped me, but I have no background in all of this. No coding background, no idea how programs or any that works. I don't know anything about lua, other than what I could figure out in unit defs and animation scripts. What may seem obvious to you guys would go right by me unnoticed. I appreciate the help.
Top
 Offline Profile  
 
 Post subject: Re: Controlling Damage
PostPosted: 20 Mar 2010, 05:15 
MC: Legacy & Spring 1944 Developer
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
Most likely it'd do the damage of either the first or last armour def it found.
Top
 Online Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Site layout created by Roflcopter et al.