ED

{Pedido} Script De Item

Por eduardosm14, 14 de out. de 2011 em Scripts

script
3
1.1k
eduardosm14E
14 de outubro de 2011 às 10:43

{Pedido} Script Que Quando Chega Num Serto Lvl Ele Ganha Um Item.

 

Exemplo:

 

Quando o Player Chegar Lvl 20 Ele Altomaticamente Ira Ganhar 20k

 

Quando o Player Chegar No Lvl 200 Ele Sera Teletransportado Automaticamente Para Um Lugar Para Fazer A Quest De Um Item Da Minha Escolha....

 

Se Alguem Puder Mi Ajudar Dou Rep+++++

SkyDangerousS
14 de outubro de 2011 às 10:47

Crie um arquivo premio.lua na pasta creaturescript.

Cole isso:

local prizes = {
   [60001] = {level = 50000, reward = {9653, 1}},
   [60002] = {level = 80000, reward = {{7958, 1},  {2157, 100}}},
}

function onAdvance(cid, skill, oldlevel, newlevel)
   if(skill ~= SKILL__LEVEL)then    return TRUE end
   for i,t in ipairs(prizes) do
       if not(getPlayerStorageValue(cid, i)) and t.level <= newlevel then
           if type(t.reward[1] ~= "table") then
               local add = doPlayerAddItem(cid, t.reward[1], t.reward[2])
               if add then
                   doPlayerSendTextMessage(cid, 19, "You have received ".t.reward[2]." ".getItemNameById(t.reward[2])." due to reaching level ".t.level.".")
                   setPlayerStorageValue(cid, i, true)
               end
           else    
               local bp = doCreateItemEx(1988, 1)
               for _,item in ipairs(t.reward) do
                   doAddContainerItem(bp, item[1], item[2])
               end
               local add = doPlayerAddItemEx(cid, bp)
               if add then
                   doPlayerSendTextMessage(cid, 19, "You have received backpack with items due to reaching level ".t.level.".")
                   setPlayerStorageValue(cid, i, true)
               end
           end
       end
   end
   return TRUE
end

 

Agora no arquivo xml

 

<event type="advance" name="reward" event="script" value="premio.lua"/>

Editado Outubro 14 por SkyDangerous

bepokemonB
14 de outubro de 2011 às 14:46

Pegando o topico da SkyDangerous, muda o code para isso:

local prizes = {
   [60001] = {function = item, level = 20, reward = {2160, 2}},
   [60002] = {function = teleport, level = 150, pos = {x=X,y=Y,z=Z}, msg = "Mensagem aqui"},
   [60003] = {function = itemByVoc, level = 200, reward = {
[1] = {id = IDDOITEM,count=1},
[2] = {id = ID, count=1},
[3] = {id = ID,count=1},
[4] = {id = ID,count=1}}
}

function onAdvance(cid, skill, oldlevel, newlevel)
   if(skill ~= SKILL__LEVEL)then    return TRUE end
   for i,t in ipairs(prizes) do
       if not(getPlayerStorageValue(cid, i)) and t.level <= newlevel then
          if t.function == itemByVoc then
          local voc = getPlayerVocation(cid)
          local vocation = voc < 5 and voc or voc-4
          local add = doPlayerAddItem(cid, t.reward[vocation].id, t.reward[vocation].count)

          if add then
          doPlayerSendTextMessage(cid, 19, "You have received ".getItemArticleById(t.reward[vocation].id)." ".getItemNameById(t.reward[2])." due to reaching level ".t.level.".")
          setPlayerStorageValue(cid, i, true)
          end

          return TRUE
          end

          if t.function == teleport then
          doTeleportThing(cid, t.pos)
          setPlayerStorageValue(cid, i, 1)
          doPlayerSendTextMessage(cid, 19, t.msg)
          return TRUE
          end
           if type(t.reward[1] ~= "table") then
               local add = doPlayerAddItem(cid, t.reward[1], t.reward[2])
               if add then
                   doPlayerSendTextMessage(cid, 19, "You have received ".t.reward[2]." ".getItemNameById(t.reward[2])." due to reaching level ".t.level.".")
                   setPlayerStorageValue(cid, i, true)
               end
           else    
               local bp = doCreateItemEx(1988, 1)
               for _,item in ipairs(t.reward) do
                   doAddContainerItem(bp, item[1], item[2])
               end
               local add = doPlayerAddItemEx(cid, bp)
               if add then
                   doPlayerSendTextMessage(cid, 19, "You have received backpack with items due to reaching level ".t.level.".")
                   setPlayerStorageValue(cid, i, true)
               end
           end
       end
   end
   return TRUE
end

Nao testei mas deve funcionar. Tem que alterar ali

{x= POSIÇAO X, y = POSIÇAO Y, z = POSIÇAO Z}

e

msg = "MENSAGEM QUE IRA RECEBER QUANDO RECEBER O LEVEL"

 

Edit --

Vi em um outro topico que voce queria especificar o item que vai ganhar de acordo com a vocation, ai fiz o script denovo.

Tem que editar tambem o ID e o IDDOITEM para os items que voce quer.

Lembrando que

1 = sorc, master sorc

2 = druid, elder druid

3 = paladin, royal paladin

4 = knight, elite knight

Editado Outubro 14 por Byerne