local items = {
[1] = { old = 8918, new = 4446 },
[2] = { old = 2662, new = 4447 },
[3] = { old = 4756, new = 4448 },
[4] = { old = 7730, new = 4449 },
[5] = { old = 4759, new = 4450 },
[6] = { old = 2506, new = 4451 },
[7] = { old = 4758, new = 4452 },
[8] = { old = 2469, new = 4453 },
[9] = { old = 2517, new = 4442 },
[10] = { old = 7461, new = 4443 },
[11] = { old = 8886, new = 4444 },
[12] = { old = 7894, new = 4445 }
}
function onLogin(cid)
for y = 1, 12 do
count = getPlayerItemCount(cid,items[y].old)
if count >= 1 then
doPlayerRemoveItem(cid,items[y].old, count)
for x = 1, count do
doPlayerAddItem(cid, items[y].new)
oldname = getItemNameById(items[y].old)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your ["..oldname.."] has been upgraded. Bind it with another item to increase it's armor.")
end
end
end
return true
end
local items = {
[1] = { old = 8918, new = 4446 },
[2] = { old = 2662, new = 4447 },
[3] = { old = 4756, new = 4448 },
[4] = { old = 7730, new = 4449 },
[5] = { old = 4759, new = 4450 },
[6] = { old = 2506, new = 4451 },
[7] = { old = 4758, new = 4452 },
[8] = { old = 2469, new = 4453 },
[9] = { old = 2517, new = 4442 },
[10] = { old = 7461, new = 4443 },
[11] = { old = 8886, new = 4444 },
[12] = { old = 7894, new = 4445 }
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
for y = 1, 12 do
count = getPlayerItemCount(cid,items[y].old)
if count >= 1 then
doPlayerRemoveItem(cid,items[y].old, count)
for x = 1, count do
doPlayerAddItem(cid, items[y].new)
oldname = getItemNameById(items[y].old)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your ["..oldname.."] has been upgraded. Bind it with another item to increase it's armor.")
end
end
end
return true
end
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
<event type="preparedeath" name="onPrepareDeath" event="script" value="preparedeath.lua"/>
<event type="look" name="eventtimers" event="script" value="event_timers.lua"/>
<event type="login" name="PlayerLogin" event="script" value="login.lua"/>
<event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
<event type="receivemail" name="Mail" event="script" value="mail.lua"/>
<event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
<event type="think" name="Idle" event="script" value="idle.lua"/>
<event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>
<event type="advance" name="AdvanceSave" event="script" value="advancesave.lua"/>
<event type="joinchannel" name="teamchannels" event="script" value="teamchannels.lua"/>
<!--BEGIN CUSTOM SCRIPTS-->
<event type="death" name="PlayerDeath" event="script" value="playerdeath.lua"/>
<event type="advance" name="advance" script="advance.lua"/>
<event type="death" name="onDeath" event="script" value="ondeath.lua"/>
<event type="combat" name="GuildAttack" event="script" value="castle wars/guild_attack.lua"/>
<event type="death" name="KillKing" event="script" value="castle wars/kill_king.lua"/>
<event type="combat" name="CombatKing" event="script" value="castle wars/combat_king.lua"/>
<!--Vocation Items-->
<event type="statschange" name="KnightShieldBlock" event="script" value="buffs/knightshieldblock.lua"/>
<!--Vocation Items-->
<!--Reflect Spells-->
<event type="statschange" name="ReflectSpellKnight" event="script" value="spells/reflectknight.lua"/>
<event type="statschange" name="ReflectSpellPally" event="script" value="spells/reflectpally.lua"/>
<event type="statschange" name="ReflectSpellMage" event="script" value="spells/reflectmage.lua"/>
<!--Reflect Spells-->
<!--Death Note-->
<event type="textedit" name="DeathNote" event="script" value="deathnote.lua"/>
<event type="login" name="exchangeDonor" event="script" value="exchangedonor.lua"/>
<event type="kill" name="xmasArena" event="script" value="xmas_Arena.lua"/>
<event type="kill" name="satan" event="script" value="satanDeath.lua"/>
<!--END CUSTOM SCRIPTS-->
</creaturescripts>
<event type="login" name="ExDonor" event="script" value="exchangedonor.lua"/>
local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}
local items = {
[0] = { 8819, 8820, 2468, 2509, 2643, 2190, 7620, 2175, 7731, 5710, 2160, 2173 },
[1] = { 8819, 8820, 2468, 2509, 2643, 2190, 7620, 2175, 7731, 5710, 2160, 2173 },
[2] = { 8819, 8820, 2468, 2509, 2643, 2182, 7620, 2175, 7731, 5710, 2160, 2173 },
[3] = { 2509, 2643, 8923, 8891, 2481, 2389, 7620, 2175, 7731, 5710, 2160, 2173 },
[4] = { 2643, 2478, 2465, 2481, 2509, 2383, 7620, 2175, 7731, 5710, 2160, 2173 }
}
function onLogin(cid)
local target = cid
if getPlayerStorageValue(cid, 999999) > 0 then
doAddSpecialExhaust(target,getPlayerStorageValue(cid, 999999))
end
if getPlayerStorageValue(cid, 1987) > 0 then
setPlayerStorageValue(cid, 1987, 0)
end
if getPlayerStorageValue(cid, 20015) > 0 then
if getPlayerStorageValue(cid, 20015) < 11 then
setPlayerStorageValue(cid, 20015, 0)
end
end
if getPlayerStorageValue(cid, 50781) == 1 then
setPlayerStorageValue(cid, 50781, 0)
end
local temple = {x=501, y=807, z=7}
if getPlayerStorageValue(cid, 6612) == 1 then
setPlayerStorageValue(cid, 6612, 0)
doPlayerPopupFYI(cid, "You have recently died, but since you are below level 200 you did not lose anything.\n At 201+ you will lose levels/items and PVP will be ON.")
end
if getPlayerStorageValue(cid, 2000) > 0 then
setPlayerStorageValue(cid, 2000, 0)
end
if getPlayerStorageValue(cid, 12346) <=0 then
doTeleportThing(cid,temple, FALSE)
setPlayerStorageValue(cid, 12346, 1)
end
if getPlayerStorageValue(cid, 30001) == -1 then
for voc, item in pairs(items) do
if getPlayerVocation(cid) == voc then
local container = doPlayerAddItem(cid, 2000, 1)
for i = 1, table.maxn(item) do
doAddContainerItem(container, item[i], 1)
end
setPlayerStorageValue(cid, 30001, 1)
end
end
end
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
end
local accountManager = getPlayerAccountManager(cid)
if(accountManager == MANAGER_NONE) then
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
elseif(accountManager == MANAGER_ACCOUNT) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
end
if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "GuildMotd")
registerCreatureEvent(cid, "onPrepareDeath")
registerCreatureEvent(cid, "Idle")
if(config.useFragHandler) then
registerCreatureEvent(cid, "SkullCheck")
end
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "advance")
registerCreatureEvent(cid, "PrepareDeath")
registerCreatureEvent(cid, "onDeath")
--(hunting graphics) registerCreatureEvent(cid, "kill")
--CTF/War Arena
registerCreatureEvent(cid, "TeamAttack")
registerCreatureEvent(cid, "WarDeath")
registerCreatureEvent(cid, "CtfDeath")
--Castle Wars (Unfinished)
registerCreatureEvent(cid, "GuildAttack")
--Reflect Spells
registerCreatureEvent(cid, "ReflectSpellKnight")
registerCreatureEvent(cid, "ReflectSpellPally")
registerCreatureEvent(cid, "ReflectSpellMage")
--DeathNote
registerCreatureEvent(cid, "DeathNote")
--Vocation Items
registerCreatureEvent(cid, "KnightShieldBlock")
registerCreatureEvent(cid, "xmasArena")
registerCreatureEvent(cid, "satan")
registerCreatureEvent(cid, "teamchannels")
registerCreatureEvent(cid, "eventtimers")
doCreatureSay(cid, "Welcome!", 20)
return true
end
registerCreatureEvent(cid, "ExDonor")
local items = {
[1] = { old = 8918, new = 4446 },
[2] = { old = 2662, new = 4447 },
[3] = { old = 4756, new = 4448 },
[4] = { old = 7730, new = 4449 },
[5] = { old = 4759, new = 4450 },
[6] = { old = 2506, new = 4451 },
[7] = { old = 4758, new = 4452 },
[8] = { old = 2469, new = 4453 },
[9] = { old = 2517, new = 4442 },
[10] = { old = 7461, new = 4443 },
[11] = { old = 8886, new = 4444 },
[12] = { old = 7894, new = 4445 }
}
function onLogin(cid)
for y = 1, 12 do
count = getPlayerItemCount(cid,items[y].old)
if count >= 1 then
doPlayerRemoveItem(cid,items[y].old, count)
for x = 1, count do
doPlayerAddItem(cid, items[y].new)
oldname = getItemNameById(items[y].old)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your ["..oldname.."] has been upgraded. Bind it with another item to increase it's armor.")
end
end
end
return true
end
data/actions/scripts/upgrading.lua:45: attempt to index field '?' (a nil value
local conf = {}
conf["level"] = {
-- [item_level] = {successParcent=PARCENT FOR UPGRADING SUCCESS, downrageLevel = IF UPGRADING FAIL - ITEM WAS DECRASED TO LEVEL HERE}
[1] = {successParcent = 85, downrageLevel = 0},
[2] = {successParcent = 80, downrageLevel = 1},
[3] = {successParcent = 75, downrageLevel = 2},
[4] = {successParcent = 70, downrageLevel = 3},
[5] = {successParcent = 65, downrageLevel = 4},
[6] = {successParcent = 60, downrageLevel = 5},
[7] = {successParcent = 55, downrageLevel = 0},
[8] = {successParcent = 50, downrageLevel = 0},
[9] = {successParcent = 45, downrageLevel = 0}
}
conf["upgrade"] = { -- how many parcent attributes are rised?
attack = 5, -- attack %
extraAttack = 10, -- extra Attack %
defense = 5, -- defence %
extraDefense = 10, -- extra defence %
armor = 5, -- armor %
hitChance = 5, -- hit chance %
}
-- // do not touch // --
-- Upgrading system v.3.1 by Azi [Ersiu] --
local upgrading = {
upValue = function (value, level, parcent)
if(not(value>0))then return 0 end
for i=1,level do
value = math.ceil(((value/100)*parcent)+value)+1
end
return (value > 0) and value or 0
end,
getLevel = function (item)
local name = string.explode(getItemName(item), '+')
return (#name == 1) and 0 or math.abs(name[2])
end,
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local getItem = getItemInfo(itemEx.itemid)
if((getItem.weaponType > 0 or getItem.armor > 0) and not isItemStackable(itemEx.itemid))then
local level = upgrading.getLevel(itemEx.uid)
if(level < #conf["level"])then
local nLevel = (conf["level"][(level+1)].successParcent >= math.random(1,100)) and (level+1) or conf["level"][level].downrageLevel
if(nLevel > level)then
doSendMagicEffect(toPosition, 30)
doPlayerSendTextMessage(cid, 22, "Congratz! Upgraded was successful, your item has become stronger!")
else
doSendMagicEffect(toPosition, 2)
doPlayerSendTextMessage(cid, 22, "Argh! Upgrading fail... you item lost some of power!")
end
doItemSetAttribute(itemEx.uid, "name", getItem.name..((nLevel>0) and "+"..nLevel or ""))
doItemSetAttribute(itemEx.uid, "attack", upgrading.upValue(getItem.attack, nLevel, conf["upgrade"].attack))
doItemSetAttribute(itemEx.uid, "extraattack", upgrading.upValue(getItem.extraAttack, nLevel, conf["upgrade"].extraAttack))
doItemSetAttribute(itemEx.uid, "defense", upgrading.upValue(getItem.defense,nLevel, conf["upgrade"].defense))
doItemSetAttribute(itemEx.uid, "extradefense", upgrading.upValue(getItem.extraDefense, nLevel, conf["upgrade"].extraDefense))
doItemSetAttribute(itemEx.uid, "armor", upgrading.upValue(getItem.armor, nLevel, conf["upgrade"].armor))
doItemSetAttribute(itemEx.uid, "hitChance", upgrading.upValue(getItem.hitChance,nLevel, conf["upgrade"].hitChance))
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, 19, "Sorry this item is on max level.")
end
else
doPlayerSendTextMessage(cid, 19, "You cannot upgrade this item.")
end
end
[12/01/2011 21:27:11] [Warning] NpcSystem:
[12/01/2011 21:27:11] Parameter 'keyword_reply3' missing. Skipping...
[12/01/2011 21:27:11] [Warning] NpcSystem:
[12/01/2011 21:27:11] Parameter 'keyword_reply4' missing. Skipping...
<action fromid="6541" toid="6545" script="upgrade.lua"/>