• logo_cipsoft
    Nowe serwery zostały otwarte 19 Lut 2025:
    Noctalia (Open PvP) Ignitera (Open PvP) us_logo Xybra (Open PvP)

Skrypty & Kody 7.6 - Manarune (Lekka przer?bka)

Status
Zamknięty.

Budowlan

Advanced User
Dołączył
Luty 10, 2011
Posty
286
Liczba reakcji
0
Siemanko, chcia?bym aby do skryptu poni?ej by?a opcja tylko u?ycia na sobie (w chwili obecnej dzia?a lewo/prawo) to wszystko :)


[LUA]function onUse(cid, item, frompos, item2, topos)
local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)
local mana_min = (level * 2) + (mlevel * 3) / 1.5
local mana_max = (level * 2) + (mlevel * 3) / 1.2
local mana_add = math.random(mana_min, mana_max)
if (item.type > 1) then
doPlayerAddMana(cid, mana_add)
doChangeTypeItem(item.uid, item.type - 1)
doSendMagicEffect(topos, CONST_ME_MAGIC_BLUE)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_RED)
end
if (item.type == 1) then
doPlayerAddMana(cid, mana_add)
doRemoveItem(item.uid, 1)
doSendMagicEffect(topos, CONST_ME_MAGIC_PINK)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_RED)
end
return TRUE
end[/LUA]

---------- Tre?? dodana o 21:00 ----------

refresh.
 
Odp: 7.6 - Manarune (Lekka przer?bka)

Actions xml
[XML]<action itemid="XXXX" event="script" value="rune.lua"/>[/XML]

[LUA]function onUse(cid, item, frompos, item2, topos)
addmanapos = topos
addmanapos.stackpos = 253
playeraddmana = getThingfromPos(addmanapos)

if getPlayerMagLevel(cid) >= 4 then
if playeraddmana.itemid > 0 then
random_number = math.random(210,250)
doSendMagicEffect(topos,12)
doPlayerAddMana(playeraddmana.uid,random_number)
doPlayerSay(cid,"You can change it",1)
if item.type > 1 then
doChangeTypeItem(item.uid,item.type-1)
else
doRemoveItem(item.uid,1)
end
else
doSendMagicEffect(frompos,2)
return 0
end
else
doSendMagicEffect(frompos,2)
doPlayerSendCancel(cid,"You don't have the required magic level to use that rune.")
end
return 1
end[/LUA]

Skrypt nie m?j wi?c upewnij si? czy dzia?a (powinien), nie mam silnika 7.6 aby sprawdzi?.

Mo?esz te? spr?bowa? tak wrzuci? sw?j ale w?tpi? aby zadzia?a?o...
 
Odp: 7.6 - Manarune (Lekka przer?bka)

Wszystko zajebi?cie dzia?a tylko chcia?bym aby by?o wida? ile dostajemy many, da?by? rade da? wycinek kodu albo doda? do tego powy?ej?

#edit
Upora?em si? sam. Dzi?ki za pomoc :D
#edit 2
Brak exh :/ mo?e kto? zapoda? odpowiednie linijki ?
 
Ostatnia edycja:
Odp: 7.6 - Manarune (Lekka przer?bka)

[LUA]function onUse(cid, item, frompos, item2, topos)
addmanapos = topos
addmanapos.stackpos = 253
playeraddmana = getThingfromPos(addmanapos)

if getPlayerMagLevel(cid) >= 4 then
if playeraddmana.itemid > 0 then
random_number = math.random(210,250)
doSendMagicEffect(topos,12)
doPlayerAddMana(playeraddmana.uid,random_number)
doPlayerSay(cid,"You can change it",1)
if item.type > 1 then
local exhausted_seconds = 1
doChangeTypeItem(item.uid,item.type-1)
else
doRemoveItem(item.uid,1)
end
else
doSendMagicEffect(frompos,2)
return 0
end
else
doSendMagicEffect(frompos,2)
doPlayerSendCancel(cid,"You don't have the required magic level to use that rune.")
end
return 1
end[/LUA]

A mo?e ta?
 
Ostatnia edycja:
Odp: 7.6 - Manarune (Lekka przer?bka)

Runa nie dzia?a wgl, wystarczy?o by os.time itp itd ale nie pami?tam jak si? to stosowa?o i nie umiem tego zrobi? :/
 
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...
 
Odp: 7.6 - Manarune (Lekka przer?bka)

Oba skrypty mam 1 dzia?a? ale przesta? po dodaniu jednej rzeczy a drugi nie dzia?a wgl.

---------- Tre?? dodana o 02:27 ----------

Dobra dzi?ki za pomoc, mo?na zamkn??.
 
Status
Zamknięty.
Do góry