Postado Maio 30, 2014 10 anos Este é um post popular. Headshot - Critical hit Quando alguém te ataca, há a chance de ela te bater na cabeça(headshot) e você tomar 250%(configurável) do dano que ela causaria normalmente. Então, vamos lá. Adicione isso ao seu creaturescripts.xml <event type="login" name="HeadshotLogin" event="script" value="headshot.lua"/> <event type="statschange" name="HeadshotCritical" event="script" value="headshot.lua"/> E crie este arquivo: data/creaturescripts/scripts/headshot.lua local chance_percent = 50 -- Chance percenting local extra_damage_percent = 250 -- Extra Damage Percent function onLogin(cid) registerCreatureEvent(cid, "HeadshotCritical") return true end function onStatsChange(cid, attacker, type, combat, value) if type ~= STATSCHANGE_HEALTHLOSS then return true end if isPlayer(attacker) and getPlayerStorageValue(cid, 71257) < 1 then if math.random(100) <= chance_percent then local dmg = value * (extra_damage_percent / 100) setPlayerStorageValue(cid, 71257, 1) doTargetCombatHealth(attacker, cid, type, -dmg, -dmg, 255) setPlayerStorageValue(cid, 71257, -1) doCreatureSay(cid, "CRITICAL", 19) return false end end return true end
Postado Maio 30, 2014 10 anos Autor Tem como limitar as vocs que podem dar headshot? local chance_percent = 50 -- Chance percenting local extra_damage_percent = 250 -- Extra Damage Percent local vocations = {8, 2} -- Vocações function onLogin(cid) registerCreatureEvent(cid, "HeadshotCritical") return true end function onStatsChange(cid, attacker, type, combat, value) if type ~= STATSCHANGE_HEALTHLOSS then return true end if isPlayer(attacker) and isInArray(vocations, getPlayerVocation(cid)) and getPlayerStorageValue(cid, 71257) < 1 then if math.random(100) <= chance_percent then local dmg = value * (extra_damage_percent / 100) setPlayerStorageValue(cid, 71257, 1) doTargetCombatHealth(attacker, cid, type, -dmg, -dmg, 255) setPlayerStorageValue(cid, 71257, -1) doCreatureSay(cid, "CRITICAL", 19) return false end end return true end Ta dan
Postado Maio 30, 2014 10 anos Como eu posso fazer funcionar o código no tfs 1.0? Se eu não me engano não tem a função onStatsChange.
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.