legal rep +
- Fórum
- OTServ
- Recursos
- Scripting
- CreatureScripts e Movements
- [0.3.6-0.4] Passive System
2
2.4k
2 meses depois...
info
Grupo: Visconde
Registrado: 21/05/13
Posts: 303
Reputação: +25

24 de abril de 2017 às 21:25
info
Grupo: Visconde
Registrado: 21/05/13
Posts: 303
Reputação: +25

legal rep +
info
Grupo: Visconde
Registrado: 23/02/17
Posts: 368
Reputação: +136
Gênero: Masculino
Infos:
Quando player perde vida a uma chance de ativar a passiva e encher entre 20 e 25% da vida maxima dele.
Em data/creaturescripts/scripts
Crie um arquivo chamado Passiva.lua
function onStatsChange(cid, attacker, type, combat, value)local t = {storage = 189678, -- storage, so mude se tiver usando pra outra coisa.tempo = 120 --tempo em segundos }local hp = math.random(1,99) -- em porcentagemlocal lvl = 200 -- level para usar a passivalocal percent = math.floor((getCreatureHealth(cid)*100)/getCreatureMaxHealth(cid)) -- nao mechalocal enche = math.random(20,25)-- Enche entre 20 e 25 % de vidaif getPlayerStorageValue(cid, 498567) >= 1 then -- Storage para ativarif getPlayerStorageValue(cid, t.storage) < os.time() thenif type == STATSCHANGE_HEALTHLOSS and percent <= hp and getPlayerLevel(cid) >= lvl thendoCreatureAddHealth(cid, (enche*getCreatureMaxHealth(cid))/100)doSendAnimatedText(getCreaturePosition(cid), "+ "..enche.."% ", TEXTCOLOR_GREEN)setPlayerStorageValue(cid, t.storage, os.time() + t.tempo)doCreatureSay(cid, "PASSIVA!", 19)doPlayerSendTextMessage(cid, 25, "Passiva Ativada. \n Recarga: 2 minutos.")return trueendreturn trueendreturn trueendreturn trueendEm creaturescripts.xml adicione essa linha:
Em data/creaturescripts/scripts:
Abra o arquivo login.lua e adicione isso antes do ultimo : Return true
-------------------------------------------------------------------------------------------------------------------------------------
Em data/talkactions/scripts
Crie um arquivo chamado passiva.lua
Em talkactions.xml
Se você gostou da Script da um REP+ e me segui! ( Sou Novo Aqui no xTibia )