
How to control amount of damage done by flying debris?
Moderator: Moderators
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
How to control amount of damage done by flying debris?
I'm pretty sure it's really simple, I just can't remember 

Re: How to control amount of damage done by flying debris?
function UnitPreDamaged(... weaponDefID ...)
if weaponDefID == -1 then return newDamageByDebris end
iirc debris only does damage when SFX.EXPLODE and/or SXF.FIRE
damage amount, radius etc is hardcoded somewhere here https://github.com/spring/spring/tree/d ... rojectiles
if weaponDefID == -1 then return newDamageByDebris end
iirc debris only does damage when SFX.EXPLODE and/or SXF.FIRE
damage amount, radius etc is hardcoded somewhere here https://github.com/spring/spring/tree/d ... rojectiles
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: How to control amount of damage done by flying debris?
Change all HP and damage values by the same factor. The only (iirc) unchanged thing is debris damage so you're set (well fall damage is unchanged too but that is default off).
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: How to control amount of damage done by flying debris?
Code: Select all
function gadget:UnitPreDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weaponDefID, attackerID, attackerDefID, attackerTeam)
if weaponDefID == -1 then
return 0
end
end
As I said it works correctly, but this spammy bit kinda sucks.InfoLog wrote:[f=0000712] Warning: UnitPreDamaged(): 1st value returned should be a number (newDamage)
Re: How to control amount of damage done by flying debris?
Code: Select all
function gadget:UnitPreDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weaponDefID, attackerID, attackerDefID, attackerTeam)
if weaponDefID and weaponDefID == -1 then
return 0
end
return damage
end
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: How to control amount of damage done by flying debris?
That's it? Derp. Thanks.
Could you explain why for the not-so-learned in the room (aka, me)? Well I suppose what I mean is, why is that necessary? Is this common as in something that is done often or is this a special case for one reason or another?
Could you explain why for the not-so-learned in the room (aka, me)? Well I suppose what I mean is, why is that necessary? Is this common as in something that is done often or is this a special case for one reason or another?
Re: How to control amount of damage done by flying debris?
acuelly is untested but something like that.That's it?
when there is no return, function returns nil.
nil isnt a number, so instead just pass old damage.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: How to control amount of damage done by flying debris?
Oh. That was a lot less complicated that I thought it would be. Thanks for the help and explanation.
Re: How to control amount of damage done by flying debris?
The odd thing is, I've seen some other gadgets using the UnitPreDamaged callins, that don't retun anything explicitely in most case, and yet they didn't cause that warning.
Re: How to control amount of damage done by flying debris?
yes, me too but maybe was confusion with UnitDamaged.
also there is paralyzer, maybe return that too.
also there is paralyzer, maybe return that too.
Code: Select all
return damage, paralyzer