Armored when close scripts: Difference between revisions

From Spring
Jump to navigationJump to search
damagemodifier exemple
 
Knorke (talk | contribs)
mNo edit summary
Line 14: Line 14:


SetUnitValue (20,0)  
SetUnitValue (20,0)  
end
</code>
'''knorke says:'''<br />
SetUnitValue is evil TA engine way!
Use UnitPreDamaged callin or HitByWeapon, they can return new damage value.
<code>
script.HitByWeapon ( x, z, weaponDefID, damage )
if (doorclosed) then return damage/10 else return damage end


end
end
</code>
</code>

Revision as of 16:24, 13 November 2012

--activation of the UnitDef modifier--

in UnitDef the tag damagemodifier=0.1, mean 1/10 of damage will be deduced of health when activated by the AnimDef switch


  • armor of UnitDef activated when variable set to 1

local doorclosed

if doorcloosed=1

then SetUnitValue (20,1) else

SetUnitValue (20,0)

end

knorke says:
SetUnitValue is evil TA engine way! Use UnitPreDamaged callin or HitByWeapon, they can return new damage value.

script.HitByWeapon ( x, z, weaponDefID, damage )

if (doorclosed) then return damage/10 else return damage end

end