W zależności od tego czy chcemy ulepszyć atak, bądź obronę musimy użyć innego kamienia. Teraz przejdźmy do skryptu.
Robimy 3 pliki lua w actions (każdemu nadajemy inna nazwę)
nazwa1.lua
Kod:
function onUse(cid, item, frompos, item2, topos)
local ile = 1
local atk = getItemAttack(item2.uid)
if item2.uid ~=0 then
descr = "Values: "
if(atk ~= 0) then
setItemAttack(item2.uid, atk + ile)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
else
doPlayerSendCancel(cid,"You can't upgrade this.")
end
return TRUE
end
return FALSE
end
Kod:
function onUse(cid, item, frompos, item2, topos)
local ile = 1
local def = getItemDefense(item2.uid)
if item2.uid ~=0 then
descr = "Values: "
if(def ~= 0) then
setItemDefense(item2.uid, def + ile)
doSendMagicEffect(topos,CONST_ME_MAGIC_GREEN)
doRemoveItem(item.uid,1)
else
doPlayerSendCancel(cid,"You can't upgrade this.")
end
return TRUE
end
return FALSE
end
Kod:
function onUse(cid, item, frompos, item2, topos)
local ile = 1
local arm = getItemArmor(item2.uid)
if item2.uid ~=0 then
descr = "Values: "
if(arm ~= 0) then
setItemArmor(item2.uid, arm + ile)
doSendMagicEffect(topos,CONST_ME_MAGIC_BLUE)
doRemoveItem(item.uid,1)
else
doPlayerSendCancel(cid,"You can't upgrade this.")
end
return TRUE
end
return FALSE
end
Kod:
<action itemid="8300" script="nazwa1.lua" />
<action itemid="8310" script="nazwa2.lua" />
<action itemid="8306" script="nazwa3.lua" />
I
ID przedmiotów
Kod:
8300 - attack gem
8310 - defense gem
8306 - armor gem
II
Ponieważ przedmioty te nie są lootem żadnego potwora, można je umieścić w SMS SHOPIE, jednak wg mnie najlepiej ustawić je jako loot bosów (POI, INQ, bądź jakichkolwiek innych).
Zalety systemu
- Po wykonaniu wszystkich zadań gracz nadal może "zmieniać swoją broń".
- Teraz miecz i obuch nie będą ostawać od toporów!
- Twój ulubiony pancerz może być najlepszy!
- każdy przedmiot może ulec przemianie, nawet chain armor, tylko czy jest to opłacalne... (w koncu można szpanować leather setem :))
Pozdrawiam
Deaven
PS skrypt opublikowałem na tnet pod takim samym nickiem.
Zakładki