Damage buffs

Everything about mods can be found here.

Moderator: Morax

Damage buffs

Postby Franck » 06 Jan 2016, 14:42

Hi everybody,

I'm currently looking at SupCom FA buff system, and i wanna to make a test.

I define a new BuffBlueprint :

Code: Select all
BuffBlueprint {
    Name = 'TestBoost',
    DisplayName = 'TestBoost',
    BuffType = 'GlobalBoost',
    Stacks = 'REPLACE',
    Duration = 60,
    Affects = {
      MaxHealth = {
            Add = 0,
            Mult = 1.5,
        },
      MoveMult = {
         Add = 0,
         Mult = 1.5,
      },
      Damage = {
         Add = 300,
         Mult = 1.5,
      },
   },
}


It do just for 60s a +50% Health bonus, a +50% speed, acceleration and turn rate bonus, and a +300 and +50% Weapon bonus.

Then i call it in my mod during the unit creation like this :
Code: Select all
Buff.ApplyBuff( self, 'TestBoost')


Everything works fine, the 60s time, the Health bonus, the speed bonus, all are ok.

But the damage bonus doesn't work.

I checked the code, and it seems that this method in the buff.lua at line 263 simply do nothing :
Code: Select all
local wep = unit:GetWeapon(i)
wep:ChangeDamage(val)


Do you know if the ChangeDamage method is active ? Any idea why it doesn't work. I've got no warning or error message in the log.
Franck
Crusader
 
Posts: 28
Joined: 24 Dec 2015, 16:16
Has liked: 1 time
Been liked: 1 time
FAF User Name: Franck

Re: Damage buffs

Postby Kalvirox » 06 Jan 2016, 14:49

Not that I can help with the issue you have. But may I ask how you intend for the buffs to be given.. let me rephrase, what prerequisite us required for a unit to get a buff?
[SFo]T4ffytr0n2014: You can tell Kalvirox comes from the south by what he is having for lunch
SeraphimLeftNut: Two pieces of copper are electrically the same, but you can stab people with one piece and send UDP packets through another
User avatar
Kalvirox
Evaluator
 
Posts: 623
Joined: 31 Aug 2013, 16:19
Has liked: 121 times
Been liked: 133 times
FAF User Name: Kalvirox

Re: Damage buffs

Postby Franck » 06 Jan 2016, 14:59

Kalvirox wrote:Not that I can help with the issue you have. But may I ask how you intend for the buffs to be given.. let me rephrase, what prerequisite us required for a unit to get a buff?


Not so hard ;) :

You have to :
- Add new Buffblueprint as i do in my post in the BuffDefinitions.lua file
- import the buff.lua file in your module
- call the ApplyBuff(unit,Nameofyourbuff) method at the event you want. In my post i call it just at unit creation. But i can imagine that you can call it with shortcut. The unit must be created. It will not work at the beginning of the unit oncreate function.

You can check the possible affects in the function BuffAffectUnit in buff.lua. You can buff Health, Regen, RegenPercent, Damage (may be buggy), DamageRadius, BuildRate...)


It's very interesting, but why the damage buff simply doesn't work...
Franck
Crusader
 
Posts: 28
Joined: 24 Dec 2015, 16:16
Has liked: 1 time
Been liked: 1 time
FAF User Name: Franck

Re: Damage buffs

Postby Franck » 06 Jan 2016, 15:27

i checked the unit database by putting a LOG(repr(wep)), and it seems that the buff table is updated with the buff :

Code: Select all
INFO: *BUFF: Unit \000"0"\000 buffed damage to \000450
INFO: > SetProperty(1048576, HitCount): 0
INFO: > SetProperty(1048576, Xp): 0
INFO: { <metatable=table: 1332E370>
INFO:   AimControl={ <metatable=table: 177A7370>
INFO:     _c_object=userdata: CScriptObject* at 1CD74DF8 = [CScriptObject at 0x156C1180]
INFO:   },
INFO:   CurrentRackSalvoNumber=1,
INFO:   DamageMod=0,
INFO:   DamageRadiusMod=0,
INFO:   Disabledbf={ },
INFO:   NumMuzzles=2,
INFO:   RackRecoilReturnSpeed=0.625,
INFO:   RecoilManipulators={ },
INFO:   WeaponAimIsEnabled=true,
INFO:   WeaponCanFire=true,
INFO:   WeaponIsEnabled=true,
INFO:   __mainthread=thread: 1CBDC2D0,
INFO:   _c_object=userdata: CScriptObject* at 1CD74330 = [CScriptObject at 0x159C6A40],
INFO:   unit={ <metatable=table: 1332EC30>
INFO:     ActiveConsumption=false,
INFO:     BeamExhaustEffectsBag={ },
INFO:     Buffs={
INFO:       Affects={
INFO:         Damage={
INFO:           TestBoost={ Add=300, BuffName="TestBoost", Count=1, Mult=1.5 }
INFO:         },
INFO:         MaxHealth={
INFO:           TestBoost={ Add=0, BuffName="TestBoost", Count=1, Mult=1.5 }
INFO:         },
INFO:         MoveMult={
INFO:           TestBoost={ Add=0, BuffName="TestBoost", Count=1, Mult=1.5 }
INFO:         }
INFO:       },
INFO:       BuffTable={
INFO:         GlobalBoost={
INFO:           TestBoost={
INFO:             BuffName="TestBoost",
INFO:             Count=1,
INFO:             Trash={ <metatable=table: 151C1D70> thread: 12424DC0 }
INFO:           }
INFO:         }
INFO:       }
INFO:     },
INFO:     BuildEffectsBag={ },
INFO:     CanBeKilled=true,
INFO:     CanTakeDamage=true,
INFO:     CaptureEffectsBag={ },
INFO:     DamageEffectsBag={ { }, { }, { } },
INFO:     Dead=false,
INFO:     EnergyModifier=0,
INFO:     EventCallbacks={
INFO:       OnCaptured={ },
INFO:       OnCapturedNewUnit={ },
INFO:       OnDamaged={ },
INFO:       OnFailedBeingCaptured={ },
INFO:       OnFailedCapture={ },
INFO:       OnFailedToBuild={ },
INFO:       OnHorizontalStartMove={ },
INFO:       OnKilled={ },
INFO:       OnReclaimed={ },
INFO:       OnStartBeingCaptured={ },
INFO:       OnStartBuild={ },
INFO:       OnStartCapture={ },
INFO:       OnStartReclaim={ },
INFO:       OnStopBeingBuilt={ },
INFO:       OnStopBeingCaptured={ },
INFO:       OnStopCapture={ },
INFO:       OnStopReclaim={ },
INFO:       OnUnitBuilt={ },
INFO:       OnVeteran={ },
INFO:       ProjectileDamaged={ },
INFO:       SpecialToggleDisableFunction=false,
INFO:       SpecialToggleEnableFunction=false
INFO:     },
INFO:     FxDamage1Amount=1,
INFO:     FxDamage2Amount=1,
INFO:     FxDamage3Amount=1,
INFO:     HasFuel=true,
INFO:     IdleEffectsBag={ },
INFO:     MaintenanceConsumption=false,
INFO:     MassModifier=0,
INFO:     MovementEffectsBag={ },
INFO:     OnBeingBuiltEffectsBag={ },
INFO:     ProductionEnabled=true,
INFO:     ReclaimEffectsBag={ },
INFO:     Sync={ <metatable=table: 18C7E370> army=2, id="1048576" },
INFO:     TopSpeedEffectsBag={ },
INFO:     TransportBeamEffectsBag={ },
INFO:     Trash={ <metatable=table: 151C1D70>
INFO:       { <metatable=table: 177A7370>
INFO:         _c_object=userdata: CScriptObject* at 1CD74DF8 = [CScriptObject at 0x156C1180]
INFO:       },
INFO:       thread: 12424DC0
INFO:     },
INFO:     UpgradeEffectsBag={ },
INFO:     VeteranLevel=0,
INFO:     _c_object=userdata: CScriptObject* at 1CD743F8 = [CScriptObject at 0x1CBB7800]
INFO:   }
INFO: }


So it's so strange that the damage buff isn't applied. The aeon commander base dam = 100. The ACU is buffed up to 450 (100*1.5+300) as it said in the log.
Franck
Crusader
 
Posts: 28
Joined: 24 Dec 2015, 16:16
Has liked: 1 time
Been liked: 1 time
FAF User Name: Franck

Re: Damage buffs

Postby Franck » 06 Jan 2016, 15:46

Ok guys,

I fixed my problem by hooking the function BuffAffectUnit(unit, buffName, instigator, afterRemove) in the buff.lua file.

This is the code (line 263) :

Code: Select all
wep.DamageMod = val
-- wep.ChangeDamage(val)


It rocks now :D ! the changeDamage method doesn't work.
Franck
Crusader
 
Posts: 28
Joined: 24 Dec 2015, 16:16
Has liked: 1 time
Been liked: 1 time
FAF User Name: Franck

Re: Damage buffs

Postby DDDX » 23 Apr 2019, 13:37

Need help.

so...been trying to get a hero unit that has an aura that buffs allies with a % damage increase.
Other hero units have different auras and they all work fine and dandy - maxhp aura, more range aura, more regen... so I know my way around auras.

All except the Affects: Damage one.
It does not affect damage, the same way as Franck states.
I have hooked the buff file in my mod, changed the line just as he instructs, but the buff remains unapplied.
And yes, I did remember to tell the hero units script.lua to load the local buff from the hooked file and not the default one ;)

Anya ideas...anyone?
Check out my 2 maps: "Survival_Mayhem&BO_3d_v1" "Survival_Mayhem&BO_3d_RPG"
as well as my mod: "Survival Mayhem&BO balance"
-- let me know of any bugs or issues regarding those 3.
DDDX
Avatar-of-War
 
Posts: 170
Joined: 21 Mar 2016, 16:13
Has liked: 18 times
Been liked: 16 times
FAF User Name: DDDX


Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest