Armored when close scripts: Difference between revisions

From Spring
Jump to navigationJump to search
Flozi (talk | contribs)
m removed the cob
 
Line 2: Line 2:


in UnitDef the tag  <code>damagemodifier=0.1,</code>  mean 1/10 of damage will be deduced of health when activated by the AnimDef switch
in UnitDef the tag  <code>damagemodifier=0.1,</code>  mean 1/10 of damage will be deduced of health when activated by the AnimDef switch
*know the state of armored and the armormodifier
<code>
local armored,numberarmorMultiple
armored,numberarmorMultiple=Spring.GetUnitArmored(unitID)
</code>




Line 10: Line 19:
if doorcloosed=1
if doorcloosed=1


then SetUnitValue (20,1)  
then  
 
Spring.SetUnitArmored(unitID,true)
 
else  
else  


SetUnitValue (20,0)  
Spring.SetUnitArmored(unitID,false)


end
end
</code>
</code>


'''knorke <big>gametutorial</big> maker 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
*[[SpringRtsTutorialAnimDef]] return to the list of animDef exemples
</code>
no idea of your logic here...this not related with UnitDef the tag  <code>damagemodifier=0.1,</code>(tought noidea why this tag must be activated by AnimDef maybe for gamemaking team work)
:'''just lets go for edit factory & on off able page for teach me more'''


[[Category:Emmanuel]]
[[Category:Emmanuel]]

Latest revision as of 16:50, 18 March 2013

--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


  • know the state of armored and the armormodifier

local armored,numberarmorMultiple

armored,numberarmorMultiple=Spring.GetUnitArmored(unitID)


  • armor of UnitDef activated when variable set to 1

local doorclosed

if doorcloosed=1

then

Spring.SetUnitArmored(unitID,true)

else

Spring.SetUnitArmored(unitID,false)

end