kavaline Posted December 4, 2021 Share Posted December 4, 2021 Hi, how to make the Balloon (pop damage) deals different damage only for certain targets? (Checking player tag and follower component with a leader) I want edit Wes balloons to deal 1 damage on them, and 5 to all other targets, someone can help? Link to comment Share on other sites More sharing options...
skittles sour Posted December 5, 2021 Share Posted December 5, 2021 You can look at how other code handle AOE damage. They usually do a TheSim:FindEntities search, and then apply damage or work depending on each item. Try taking a look at the combat component's aoe functions or the explosive component's onburnt function Link to comment Share on other sites More sharing options...
kavaline Posted December 5, 2021 Author Share Posted December 5, 2021 "Solved", I did check on combat.CalcDamage, with AddComponentPostInit. Unfortunelly doing it on 'balloon' prefab dont works for me, so, all calc damages will check this. Isn't the best, but if someone want know how do it, here is: local ALLY_DMG = 1 local function OverrideCombat(comp) local oldCalcDamage = comp.CalcDamage comp.CalcDamage = function(self, target, weapon, multiplier) local dmg = oldCalcDamage(self, target, weapon, multiplier) if target ~= nil and self.inst.prefab == "balloon" then local has_player_leader = target.components.follower ~= nil and target.components.follower.leader ~= nil and target.components.follower.leader:HasTag("player") and true or false if (target:HasTag("Player")) or (target:HasTag("companion") or has_player_leader) then dmg = ALLY_DMG end end return dmg end end AddComponentPostInit("combat", OverrideCombat) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now