Game Development Community

Buffs and Applying Modifiers not working ?

by James Novosel · in RTS Starter Kit · 01/25/2005 (6:12 pm) · 13 replies

Problem - modifier "Bonus" applied to attacking unit and target unit.
The target unit has an initial armor value of 4. The attacking unit,
in this case the rifleman has baseDamage of 50. The modifier is never
applied to the damage for the attacker. The modifier is never applied
to the armor of the target. buffs.cs, rifleman.cs and console.log
excerpts follow.

Is this a bug ? I dropped back to the base code (away from modifications I am making) to test this.

buffs.cs
---------
datablock RTSUnitModifierData(Bonus)
{
baseDamage = 1.5;
attackDelay = 0.75;
armor = 2.0;
moveSpeed = 1.5;
};

rifleman.cs
-----------
function riflemanBlock::onAttack(%this, %attacker, %target)
{
%damage = %attacker.getDataBlock().baseDamage;
echo("riflemanBlock onAttack damage1: " @ %damage); <--------------

if(%attacker.getNetModifier().baseDamage)
%damage *= %attacker.getNetModifier().baseDamage;

echo("riflemanBlock onAttack damage2: " @ %damage);<--------------

%armor = %target.getDataBlock().armor;
echo("riflemanBlock onAttack armor1: " @ %armor);<--------------

if(%target.getNetModifier().armor)
%armor *= %target.getNetModifier().armor;

echo("riflemanBlock onAttack armor2: " @ %armor);<--------------

console.log
-----------
Changing command state to: Attack
Changing command state to: None
Mapping string: IssueAttack to index: 8
riflemanBlock onAttack damage1: 50
riflemanBlock onAttack damage2: 50
riflemanBlock onAttack armor1: 4
riflemanBlock onAttack armor2: 4
Mapping string: MsgUnitAttacked to index: 22
riflemanBlock onAttack damage1: 50
riflemanBlock onAttack damage2: 50
riflemanBlock onAttack armor1: 4

#1
02/12/2005 (6:35 pm)
%attacker.getNetModifier().baseDamage
%target.getNetModifier().armor

return nothing.......


Must be a bug
#2
02/12/2005 (10:12 pm)
Those last two lines don't seem right to me... I could be wrong. Do you get any errors in the console?
#3
02/13/2005 (5:47 am)
No, no errors. That exact code is present in the rifleman.cs, bot.cs and shocker.cs to determine whether or not to add to the attack damage being applied or to add to the armor when the target takes damage: (see above or check the .cs files for the bot/rifleman or shocker).

if(%attacker.getNetModifier().baseDamage)
%damage *= %attacker.getNetModifier().baseDamage;

and

if(%target.getNetModifier().armor)
%armor *= %target.getNetModifier().armor;

The modifiers are being applied, I can see the "Bonus" modifier when doing a .dump() on getModifierList.

I guess the real question is: If the above syntax does not work for getting the modifier's value (and it does not appear to be working), what would return the modifiers so that they could be applied in the onAttack function ?
#4
02/13/2005 (10:48 am)
No clue. I'll ping Josh about this.
#5
02/13/2005 (5:40 pm)
Josh is pinged, gears in motion. Might be a good thing the new RTS installer hasn't gone up yet...
#6
02/14/2005 (4:27 am)
Thanks Ben !!!
#7
02/14/2005 (11:32 pm)
New RTS installer is up now... but I'll look into this issue this week as soon as I can. Thanks for the report.

update: just a quick note to say that I haven't had time to look at this yet. Sorry guys, have to have a bit of patience until T2D ships. :)
#8
03/03/2005 (4:26 am)
Any progress on this yet ?
Looks like T2D is out the door :)

Thanks
#9
03/14/2005 (4:42 pm)
We're approaching 60 days on resolution for this.

If I find three more bugs (and I think I will), that'll be 6 months. Six bugs would be pushing a year.

Not sure if this is your main line of business or if GG is a part time venture but I code for a living, and 60 days would place me in the unemployment line.

Don't take this wrong, I think the RTS kit is great. As a matter of fact there are three more GG products I would probably be purchasing, but this one is scaring me enough to not drop the $ on the other ones........

Thanks :)
#10
03/14/2005 (5:27 pm)
Please keep in mind I do not work for GG, nor do I represent them in any way!

The RTS-SK does need work in some areas, and GG is very aware of that. It also has been almost dead last in priority for the last several months, and that is obviously not a "fun" thing for the RTS-SK community. I know that it will certainly be getting a lot more attention in the next 2 months. I can personally promise you that!

Also keep in mind that they distribute major revisions now, instead of each and every little bug as it comes out--this is actually in the best interests of the community, since it keeps you from having to make sure you apply every single 2 line change to stay current.

I'm not trying to defend GG here by the way, just calling it like it is, as I see it. I've been noodling them myself about it, so I know they are aware!
#11
03/15/2005 (8:02 am)
Thanks Zepp, and thanks for all your input on these boards.

Just getting a little impatient here I guess. One of the last things I need to implement is damage/armor/speed/vision/range etc and was hoping to avoid having to hack away at the C code, but if push comes to shove......

Thanks
#12
08/23/2005 (4:30 am)
We're now approaching 8 months on this item.
#13
08/23/2005 (3:51 pm)
I fixed this awhile ago.. if I remember it was a typo in the code.. Ill try and compare my code to the stock and post here.