Ir para conteúdo

Absorb Rune By Colex


colex

Posts Recomendados

Acabei de fazer uma otra action que consiste em usar uma rune em um cara e ele perder um certu numero de mana (randomizado) e essa mana vai para u cara ke usou a rune. (;:

u cara em ke vc usar a rune precisa ter um certu numero de mana a tua escolha (aconselhu +pelo menus 1 maior que o maximu de mana ke pod eser absorvida)

naum pode ser usada em pz e contem exhaust.

agora u script:

no diretório data>actions>scripts faz um ficheiro chamado absorb.lua e adiciona u seguinte code:

 

------absorb rune by Colex--------function onUse(cid, item, frompos, item2, topos)pos = getPlayerPosition(cid)name = getPlayerName(item2.uid)storevalue = 9979 ---onde será guardado o exhaustexhausttime = 5 ---tempo de exhaustmanaplayer = 31 ---mana do player oponente necessita para usar esta rune max = 30 ---maximu de mana que pode ser absorvidamin = 10 ---minimu de mana que pode ser absorvidamana = math.random(min,max)if item2.itemid == cid then  if (getPlayerMana(item2.uid)) >= manaplayer then    if getTilePzInfo(pos) == 0 then      if getTilePzInfo(topos) == 0 then        if (exhaust(cid, storevalue, exhausttime) == 1) then          doPlayerAddMana(cid,mana)          doSendMagicEffect(pos,3)   doSendMagicEffect(topos,1)          doPlayerAddMana(item2.uid,-mana)          doPlayerSay(item2.uid,"ouch!",2)        else          doPlayerSendCancel(cid,"You are exhausted.")        end      else        doPlayerSendCancel(cid,"You can not use this rune on a protect zone.")      end    else       doPlayerSendCancel(cid,"You can not use this rune while you are in a protect zone.")    end  else    doPlayerSendCancel(cid,""..name.." hasn't enough mana.")  endelse  doPlayerSendCancel(cid,"You can not use this rune there.")endreturn 1endfunction exhaust(cid, storevalue, exhausttime)        newExhaust = os.time()    oldExhaust = getPlayerStorageValue(cid, storevalue)    if (lastexhaust == nil or lastexhaust < 0) then        lastexhaust = 0    end    if (exhausttime == nil or exhausttime < 0) then        exhausttime = 1    end    diffTime = os.difftime(newExhaust, oldExhaust)    if (diffTime >= exhausttime) then        setPlayerStorageValue(cid, storevalue, newExhaust)         return 1    else        return 0    endend

 

no diretório data>actions adicione no ficheiro actions.xml a seguinte frase:

 

<action itemid="2263" script="absorb.lua" allowfaruse="1" />

 

NOTA: não se esqueçam que o valor manaplayer deve ser maior ou do mesmu tamanho que u valor max

fiz este script para ser facilmente configurado ao seu gosto ;):

espero que gostem e disfrutem dos meus scripts

Colex

Link para o comentário
Compartilhar em outros sites

  • 2 weeks later...
×
×
  • Criar Novo...