Finger of God power drain?

Hi all, I'm consistently working on a mostly-comp-stomp mod that has change a lot of the game, levels, etc that I play on LAN with friends.

I'm looking to attempt to add another effect to the Finger of God to make it a little more "viscious" without just making it hit really hard.

For reference, the ability is defined in \lua\common\AbilityDefinitions.lua @ ~ Line 306: Name = 'SuperWeapon01',

 

I looked at the power drain gloves (couldn't think of any power drain that wasn't targeted) for reference, but it just uses a definition and not a function. The Finger of God function seems to be a targeted AE, but really has no target.

Any ideas without haveing to create a whole new DamageArea() and DealDamage() functions?

Thanks for any help.

-Drum

1,001 views 1 replies
Reply #1 Top

This is from HW so change name etc appropriatley but should now remove 700 mana (note: not tested)

 

ItemBlueprint {
    Name = 'AchievementFinger',
    DisplayName = '<LOC ITEM_Achievement_0043>Heaven\'s Wrath',
    Description = '<LOC ITEM_Achievement_0044>Use: Fire a beam of searing light at the targeted location, dealing [GetDamage] damage and throwing smaller units into the air.',
    GetMaxRange = function(self) return Ability['AchievementFinger'].RangeMax end,
    GetEnergyCost = function(self) return Ability['AchievementFinger'].EnergyCost end,
    GetCastTime = function(self) return Ability['AchievementFinger'].CastingTime end,
    GetCooldown = function(self) return Ability['AchievementFinger'].Cooldown end,
    GetDamage = function(self) return Ability['AchievementFinger'].DamageAmount end,
    Mesh = '/meshes/items/chest/chest_mesh',
    Animation = '/meshes/items/chest/Animations/chest_Idle_anim.gr2',
    MeshScale = 0.10,
    InventoryType = 'Achievement',
    Icon = '/NewIcons/AchievementRewards/FingerofGod',
    Useable = true,
    Abilities = {
        AbilityBlueprint {
            Name = 'AchievementFinger',
            AbilityType = 'TargetedArea',
            AbilityCategory = 'USABLEITEM',
            TargetAlliance = 'Ally',
            TargetCategory = 'MOBILE - UNTARGETABLE',
            TargetingMethod = 'AREAARGETED',
            Cooldown = 45,
            EnergyCost = 0,
            Reticule = 'AoE_Finger_of_God',
            AffectRadius = 7,
            Icon = '/NewIcons/AchievementRewards/FingerofGod',
            MetaImpactRadius = 10,
            MetaImpactAmount = 8,
            DamageAmount = 250,

#     added Code      

ManaAmount = -700,


#     end added Code      

            FromItem = 'AchievementFinger',
            Audio = {
                 OnStartCasting = {Sound = 'Forge/ITEMS/snd_item_conjure',},
                 OnFinishCasting = {Sound = 'Forge/ITEMS/Achievement/snd_item_achievement_AchievementFinger',},
                 OnAbortCasting = {Sound = 'Forge/ITEMS/snd_item_abort',},

             },
            OnStartAbility = function(self, unit, params)
                local thd = ForkThread(self.SuperWeaponThread, self, unit, params)
                unit.TrashOnKilled:Add(thd)
            end,

            Effects = {
                Base = 'FingerOfGod',
                Beams = 'Beam01',
                Impact = 'Impact01',
                Muzzle = 'Muzzle01',
                Charge = 'Charge01',
            },

            SuperWeaponThread = function(self, unit, params)
                #Start Firing
                local weps = unit:GetAIBrain():GetListOfUnits(categories.SUPERWEAPON, false)
                if table.getn(weps) > 0 then
                    unit = weps[1]
                end
                local beginEnt = Entity{}
                local upos = table.copy(unit:GetPosition())
                local epos = params.Target.Position
                upos[2] = 500
                local army = unit:GetArmy()
                local emitTrash = TrashBag()
                Warp(beginEnt, upos)

                #### Muzzle Charge Emitters
                local emitIds = AttachEffectAtBone( unit, self.Effects.Base, self.Effects.Charge, 0, unit.TrashOnKilled )
                if emitIds then
                    for k, v in emitIds do
                        emitTrash:Add(v)
                    end
                end

                WaitSeconds(0.75)

                #### Muzzle Flash Emitters
                emitIds = AttachEffectAtBone( unit, self.Effects.Base, self.Effects.Muzzle, 0, unit.TrashOnKilled )

                local viz = import('/lua/sim/VizMarker.lua').VizMarker {
                    X = epos[1],
                    Z = epos[3],
                    LifeTime = 3,
                    Radius = 2 * self.AffectRadius,
                    Army = army,
                    Omni = false,
                    Radar = false,
                    WaterVision = false,
                    Vision = true,
                }

                unit.TrashOnKilled:Add(viz)
                emitTrash:Add(viz)

                WaitSeconds(0.25)

                #End!
                local endEnt1 = Entity{}
                local endEnt2 = Entity{}
                local endEntPos = table.copy(epos)
                endEntPos[2] = 500
                Warp(endEnt1, endEntPos)
                Warp(endEnt2, epos)

                unit.TrashOnKilled:Add(beginEnt)
                emitTrash:Add(beginEnt)
                unit.TrashOnKilled:Add(endEnt1)
                emitTrash:Add(endEnt1)
                unit.TrashOnKilled:Add(endEnt2)
                emitTrash:Add(endEnt2)

                endEnt2:ShakeCamera(1000, 5, 3, 0.2)
                endEnt2:PlaySound ( 'Forge/ITEMS/Achievement/snd_item_achievement_AchievementFinger_impact');
                #IMPACT!

                #### Beam Downwards
                emitIds = AttachBeamEffectOnEntities( self.Effects.Base, nil, self.Effects.Beams, endEnt1, -1, endEnt2, -1, army, unit.TrashOnKilled )
                if emitIds then
                    for k, v in emitIds do
                        emitTrash:Add(v)
                    end
                end

                #### Impact Emitters
                local fxpos = epos
                fxpos[2] = GetSurfaceHeight(fxpos[1], fxpos[3])
                emitIds = CreateTemplatedEffectAtPos( self.Effects.Base, nil, self.Effects.Impact, unit:GetArmy(), fxpos, nil, unit.TrashOnKilled )

                local data = {
                    Instigator = unit,
                    InstigatorBp = unit:GetBlueprint(),
                    InstigatorArmy = unit:GetArmy(),
                    Origin = epos,
                    Radius = self.MetaImpactRadius,
                    Amount = self.MetaImpactAmount,
                    Category = 'METAINFANTRY',
                    DamageFriendly = false,
                }
                MetaImpact(data)

                data = {
                    Instigator = unit,
                    InstigatorBp = unit:GetBlueprint(),
                    InstigatorArmy = unit:GetArmy(),
                    Amount = self.DamageAmount,
                    Type = 'Light',
                    Radius = self.AffectRadius,
                    DamageAction = self.Name,

                    DamageSelf = false,

#added Code               

Energy = self.ManaAmount,


# end added Code      

                    Origin = epos,
                    CanCrit = false,
                    CanBackfire = false,
                    CanBeEvaded = false,
                    CanMagicResist = true,
                    ArmorImmune = true,
                    NoFloatText = false,
                    Group = 'UNITS',
                }

                DamageArea(data)
                WaitSeconds(1.0)
                emitTrash:Destroy()
                emitTrash = nil
            end,
        }
    },
}

 

I have not tested this but it should work