Odp: 7.6 - Manarune (Lekka przer?bka)
[LUA]-- Advanced mana runes - by Coffe (v2.22)
minMana = 46 -- Enter minimum mana possible to gain
maxMana = 203 -- Enter maximum mana possible to gain
storevalue = 1000 -- Enter the storagevalue that will be used for exhaustion (has to be a unique value that isn't already used in quests or other scripts)
exhaustion = 1 -- Enter the time in seconds that character is exhausted for
smallruneid = 2270 -- Itemid of the normal mana rune
bigruneid = 2271 -- Itemid of the big mana rune
if (item.itemid == smallruneid) then
-- Normal mana rune (with my settings: 80-120 mana, 100 on average)
exhast = exhaust(cid, storevalue, exhaustion)
if (exhast == 0) then
doPlayerSendCancel(cid, "You are exhausted.")
else
if (getPlayerAccess(item2.uid) == 0) then
-- Decrease charges - remove if 0
if (item.type > 1) then
doChangeTypeItem(item.uid, item.type-1)
elseif (getPlayerAccess(cid) == 0) then
doRemoveItem(item.uid, 1)
end
mana = math.random(minMana, maxMana)
if (topos.x ~= getPlayerPosition(cid).x or topos.y ~= getPlayerPosition(cid).y or topos.z ~= getPlayerPosition(cid).z) then
doPlayerSendTextMessage(item2.uid, 20, getPlayerName(cid).." gave you "..mana.." mana.")
doSendMagicEffect(topos, 14)
doPlayerSendTextMessage(cid, 20, "You gave "..getPlayerName(item2.uid).." "..mana.." mana.")
doSendMagicEffect(getPlayerPosition(cid), 12)
storemana = getPlayerStorageValue(item2.uid, 444) + mana
setPlayerStorageValue(item2.uid, 444, storemana)
else
doPlayerSendTextMessage(item2.uid, 20, "You recieved "..mana.." mana.")
doSendMagicEffect(topos, 14)
storemana = getPlayerStorageValue(cid, 444) + mana
setPlayerStorageValue(cid, 444, storemana)
end
return 0
end
end
function exhaust(cid, storevalue, exhausttime)
-- Returns 1 if not exhausted and 0 if exhausted
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
end
end[/LUA]
hm co? takiego wygrzeba?em jeszcze w czelu?ciach internet?w
ew takie z tym ze tutaj s? 2 manaruny:
[LUA]function onUse(cid, item, frompos, item2, topos)
-- Advanced mana runes - by Coffe (v2.22)
minMana = 46 -- Enter minimum mana possible to gain
maxMana = 203 -- Enter maximum mana possible to gain
bigmana = 3 -- Enter bigmana multiplier for big mana rune (how many times more mana does bigmana rune give compared to normal)
storevalue = 1000 -- Enter the storagevalue that will be used for exhaustion (has to be a unique value that isn't already used in quests or other scripts)
exhaustion = 1 -- Enter the time in seconds that character is exhausted for
smallruneid = 2270 -- Itemid of the normal mana rune
bigruneid = 2271 -- Itemid of the big mana rune
if (item.itemid == smallruneid) then
-- Normal mana rune (with my settings: 80-120 mana, 100 on average)
exhast = exhaust(cid, storevalue, exhaustion)
if (exhast == 0) then
doPlayerSendCancel(cid, "You are exhausted.")
else
if (getPlayerAccess(item2.uid) == 0) then
-- Decrease charges - remove if 0
if (item.type > 1) then
doChangeTypeItem(item.uid, item.type-1)
elseif (getPlayerAccess(cid) == 0) then
doRemoveItem(item.uid, 1)
end
mana = math.random(minMana, maxMana)
if (topos.x ~= getPlayerPosition(cid).x or topos.y ~= getPlayerPosition(cid).y or topos.z ~= getPlayerPosition(cid).z) then
doPlayerSendTextMessage(item2.uid, 20, getPlayerName(cid).." gave you "..mana.." mana.")
doSendMagicEffect(topos, 14)
doPlayerSendTextMessage(cid, 20, "You gave "..getPlayerName(item2.uid).." "..mana.." mana.")
doSendMagicEffect(getPlayerPosition(cid), 12)
storemana = getPlayerStorageValue(item2.uid, 444) + mana
setPlayerStorageValue(item2.uid, 444, storemana)
else
doPlayerSendTextMessage(item2.uid, 20, "You recieved "..mana.." mana.")
doSendMagicEffect(topos, 14)
storemana = getPlayerStorageValue(cid, 444) + mana
setPlayerStorageValue(cid, 444, storemana)
end
if (getPlayerAccess(cid) >= 1) then
doPlayerSendTextMessage(cid, 16, getPlayerName(item2.uid).." has gotten "..getPlayerStorageValue(item2.uid, 444).." mana from mana runes.")
end
doPlayerAddMana(item2.uid, mana)
else
doPlayerSendCancel(cid, "You can only use this rune on players.")
end
end
return 1
elseif (item.itemid == bigruneid) then
-- Normal mana rune (with my settings: 240-360 mana, 300 on average)
exhast = exhaust(cid, storevalue, exhaustion)
if (exhast == 0) then
doPlayerSendCancel(cid, "You are exhausted.")
else
if (getPlayerAccess(item2.uid) == 0) then
-- Decrease charges - remove if 0
if (item.type > 1) then
doChangeTypeItem(item.uid, item.type-1)
elseif (getPlayerAccess(cid) == 0) then
doRemoveItem(item.uid, 1)
end
mana = math.random(minMana*bigmana, maxMana*bigmana)
if (topos.x ~= getPlayerPosition(cid).x or topos.y ~= getPlayerPosition(cid).y or topos.z ~= getPlayerPosition(cid).z) then
doPlayerSendTextMessage(item2.uid, 20, getPlayerName(cid).." gave you "..mana.." mana.")
doSendMagicEffect(topos, 14)
doPlayerSendTextMessage(cid, 20, "You gave "..getPlayerName(item2.uid).." "..mana.." mana.")
doSendMagicEffect(getPlayerPosition(cid), 12)
storemana = getPlayerStorageValue(item2.uid, 444) + mana
setPlayerStorageValue(item2.uid, 444, storemana)
else
doPlayerSendTextMessage(item2.uid, 20, "You recieved "..mana.." mana.")
doSendMagicEffect(topos, 14)
storemana = getPlayerStorageValue(cid, 444) + mana
setPlayerStorageValue(cid, 444, storemana)
end
if (getPlayerAccess(cid) >= 1) then
doPlayerSendTextMessage(cid, 16, getPlayerName(item2.uid).." has gotten "..getPlayerStorageValue(item2.uid, 444).." mana from mana runes.")
end
doPlayerAddMana(item2.uid, mana)
else
doPlayerSendCancel(cid, "You can only use this rune on players.")
end
end
return 1
else
return 0
end
end
function exhaust(cid, storevalue, exhausttime)
-- Returns 1 if not exhausted and 0 if exhausted
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
end
end[/LUA]
actions.xml:[XML]
<action itemid="2270" script="mana_rune.lua" allowfaruse="1" blockwalls="0" /> -- mana rune --
<action itemid="2271" script="mana_rune.lua" allowfaruse="1" blockwalls="0" /> -- big mana rune --[/XML]
Nie mam silnika 7.6 ?eby sprawdzi? co ci dzia?a a co nie...