Tenshin Posted June 7, 2014 Share Posted June 7, 2014 How does the game decide which armor takes priority as primary armor and which is secondary between the body armor and the helmet? I've been testing this out but I'm having a hard time figuring out how the system works precisely. Can someone explain please? According to the wiki it should be last equipped, but this happens very rarely. I've been trying to unequip just one, both, in different order but nothing can give a precise answer. Leaving some time inbetween the swaps seems to increase the chance that the last equipped becomes primary but doesn't always work and can't figure out what the exact interval is. The only sure way is to Save & Quit and reload. "Primary armor, i.e. the armor that absorbs the most damage, is always the last equipped. In order to save one's helmet, he would be to equip the helmet first, then the suit. If a suit is hot switched, i.e. replaced right away, it keeps its positions. However, if there is any moment in which the helmet slot is empty (occurs when a helmet breaks, even if the player has a replacement in his inventory), the helmet assumes the primary slot and the suit has to be taken off and equipped again." I've also been trying to find the answer in the game files but with no success:-> armor.luafunction Armor:SetTags(tags) self.tags = tagsend function Armor:CanResist(attacker, weapon) if attacker and self.tags then for k,v in pairs(self.tags) do if attacker:HasTag(v) then return true end if weapon and weapon:HasTag(v) then return true end end return falseelse return self.tags == nilendend function Armor:TakeDamage(damage_amount, attacker, weapon) if self:CanResist(attacker, weapon) then local leftover = damage_amount local max_absorbed = damage_amount * self.absorb_percent; local absorbed = math.floor(math.min(max_absorbed, self.condition)) leftover = damage_amount - absorbed ProfileStatsAdd("armor_absorb", absorbed) if METRICS_ENABLED thenFightStat_Absorb(absorbed)end self:SetCondition(self.condition - absorbed)if self.ontakedamage thenself.ontakedamage(self.inst, damage_amount, absorbed, leftover)end if self.absorb_percent >= 1 then return 0 end return leftover else return damage_amount end end -> inventory.luafunction Inventory:ApplyDamage(damage, attacker, weapon) --check resistance for k,v in pairs(self.equipslots) do if v.components.resistance and v.components.resistance:HasResistance(attacker, weapon) then return 0 end end --check specialised armor for k,v in pairs(self.equipslots) do if v.components.armor and v.components.armor.tags then damage = v.components.armor:TakeDamage(damage, attacker, weapon) if damage <= 0 then return 0 end end end --check general armor for k,v in pairs(self.equipslots) do if v.components.armor then damage = v.components.armor:TakeDamage(damage, attacker, weapon) if damage <= 0 then return 0 end end end return damageend Can anyone shed some light on this? Thanks. Link to comment https://forums.kleientertainment.com/forums/topic/37240-armor-priority/ Share on other sites More sharing options...
DevilXD Posted June 8, 2014 Share Posted June 8, 2014 As you can see at the bottom of the posted code, game uses "pairs" to iterate over armors, so it's pretty much semi random... Link to comment https://forums.kleientertainment.com/forums/topic/37240-armor-priority/#findComment-496512 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.