skapmet Posted August 11, 2015 Share Posted August 11, 2015 how to add 2sec cooldown between next attack? Link to comment https://forums.kleientertainment.com/forums/topic/56998-weapon-attack-cooldown/ Share on other sites More sharing options...
DarkXero Posted August 11, 2015 Share Posted August 11, 2015 @skapmet:-- For one weapon only-- in yourweapon.lualocal function onequip(inst, owner) -- other code goes here local cooldown = owner.components.combat.min_attack_period + 2 owner.components.combat:SetAttackPeriod(cooldown)endlocal function onunequip(inst, owner) -- other code goes here local cooldown = owner.components.combat.min_attack_period - 2 owner.components.combat:SetAttackPeriod(cooldown)end-- inst:AddComponent("equippable")-- inst.components.equippable:SetOnEquip(onequip)-- inst.components.equippable:SetOnUnequip(onunequip)-- For all weapons for your character-- in character.lua-- in master_postinitinst.components.combat:SetAttackPeriod(2) Link to comment https://forums.kleientertainment.com/forums/topic/56998-weapon-attack-cooldown/#findComment-662472 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