• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lucky Powder

pera

Kopytko
Joined
Jul 16, 2008
Messages
24
Reaction score
0
Location
Poland - ZPP
Hej.
Mam pytanie czy możliwe jest zrobienie skryptu itemu - Lucky Powder, który będzie dawał szczęście dla gracza przy upgradowaniu itemu?
Gdy gracz zupgraduje item, to Lucky Powder znika.
Lucky Powdery - 60%,80%,100% szczęścia.

Oczywiście do upgradowania, item jest oddzielny. Lucky Powder to tylko dodatek dający szczeście dla upgradingu.
 
LUA:
local conf = {}

conf["level"] = {
-- [item_level] = {successParcent=PARCENT FOR UPGRADING SUCCESS, downrageLevel = IF UPGRADING FAIL - ITEM WAS DECRASED TO LEVEL HERE}
 [1] = {successParcent = 80, downrageLevel = 0},
 [2] = {successParcent = 60, downrageLevel = 1},
 [3] = {successParcent = 40, downrageLevel = 2},
 [4] = {successParcent = 20, downrageLevel = 2},
 [5] = {successParcent = 15, downrageLevel = 3},
 [6] = {successParcent = 14, downrageLevel = 3},
 [7] = {successParcent = 13, downrageLevel = 3},
 [8] = {successParcent = 12, downrageLevel = 4},
 [9] = {successParcent = 11, downrageLevel = 4},
 [10] = {successParcent = 10, downrageLevel = 4},
 [11] = {successParcent = 10, downrageLevel = 4},
 [12] = {successParcent = 9, downrageLevel = 5},
 [13] = {successParcent = 8, downrageLevel = 5},
 [14] = {successParcent = 7, downrageLevel = 5},
 [15] = {successParcent = 6, downrageLevel = 5}, 
 [16] = {successParcent = 5, downrageLevel = 5},
 [17] = {successParcent = 4, downrageLevel = 16},
 [18] = {successParcent = 3, downrageLevel = 17},
 [19] = {successParcent = 2, downrageLevel = 18},
 [20] = {successParcent = 1, downrageLevel = 19}

}
conf["upgrade"] = { -- how many parcent attributes are rised?
    attack = 2, -- attack %
    extraAttack = 2, -- extra Attack %
    defense = 2, -- defence %
    extraDefense = 3, -- extra defence %
    armor = 3, -- armor %
    hitChance = 3, -- 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 strong!")
            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
 
Ulepszacz
LUA:
local config =
{
bonus	= 3,
effect	= CONST_ME_MAGIC_BLUE
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	doCreatureSetStorage(cid, 1000, config.bonus)
	doSendMagicEffect(fromPosition, config.effect)
	doRemoveItem(item.uid, 1)
	return true
end
Bazowy skrypt
LUA:
local conf = {}
 
conf["level"] = {
-- [item_level] = {successParcent=PARCENT FOR UPGRADING SUCCESS, downrageLevel = IF UPGRADING FAIL - ITEM WAS DECRASED TO LEVEL HERE}
 [1] = {successParcent = 80, downrageLevel = 0},
 [2] = {successParcent = 60, downrageLevel = 1},
 [3] = {successParcent = 40, downrageLevel = 2},
 [4] = {successParcent = 20, downrageLevel = 2},
 [5] = {successParcent = 15, downrageLevel = 3},
 [6] = {successParcent = 14, downrageLevel = 3},
 [7] = {successParcent = 13, downrageLevel = 3},
 [8] = {successParcent = 12, downrageLevel = 4},
 [9] = {successParcent = 11, downrageLevel = 4},
 [10] = {successParcent = 10, downrageLevel = 4},
 [11] = {successParcent = 10, downrageLevel = 4},
 [12] = {successParcent = 9, downrageLevel = 5},
 [13] = {successParcent = 8, downrageLevel = 5},
 [14] = {successParcent = 7, downrageLevel = 5},
 [15] = {successParcent = 6, downrageLevel = 5}, 
 [16] = {successParcent = 5, downrageLevel = 5},
 [17] = {successParcent = 4, downrageLevel = 16},
 [18] = {successParcent = 3, downrageLevel = 17},
 [19] = {successParcent = 2, downrageLevel = 18},
 [20] = {successParcent = 1, downrageLevel = 19}
 
}
conf["upgrade"] = { -- how many parcent attributes are rised?
    attack = 2, -- attack %
    extraAttack = 2, -- extra Attack %
    defense = 2, -- defence %
    extraDefense = 3, -- extra defence %
    armor = 3, -- armor %
    hitChance = 3, -- 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.max(getCreatureStorage(cid, 1000), 0)) >= 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 strong!")
            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
 
I jak on ma działać?
W którym miejscu dajeokreśloną ilość szczęścia na upgradowanie (%)?
 
Używasz przedmiot - i masz więcej szczęścia. Wartość config.bonus to dodatkowy modyfikator szczęścia - czyli po dana postać ma x szanse plus ten bonus.
 
Okej, zrobione.
Teraz tylko potrzebuje funkcji, która dawała by lucky na określony czas (30 sec) lub do zużycia itema upgradującego - obojętne.
 
Last edited:
To jest na to drugie
LUA:
local conf = {}
 
conf["level"] = {
-- [item_level] = {successParcent=PARCENT FOR UPGRADING SUCCESS, downrageLevel = IF UPGRADING FAIL - ITEM WAS DECRASED TO LEVEL HERE}
 [1] = {successParcent = 80, downrageLevel = 0},
 [2] = {successParcent = 60, downrageLevel = 1},
 [3] = {successParcent = 40, downrageLevel = 2},
 [4] = {successParcent = 20, downrageLevel = 2},
 [5] = {successParcent = 15, downrageLevel = 3},
 [6] = {successParcent = 14, downrageLevel = 3},
 [7] = {successParcent = 13, downrageLevel = 3},
 [8] = {successParcent = 12, downrageLevel = 4},
 [9] = {successParcent = 11, downrageLevel = 4},
 [10] = {successParcent = 10, downrageLevel = 4},
 [11] = {successParcent = 10, downrageLevel = 4},
 [12] = {successParcent = 9, downrageLevel = 5},
 [13] = {successParcent = 8, downrageLevel = 5},
 [14] = {successParcent = 7, downrageLevel = 5},
 [15] = {successParcent = 6, downrageLevel = 5}, 
 [16] = {successParcent = 5, downrageLevel = 5},
 [17] = {successParcent = 4, downrageLevel = 16},
 [18] = {successParcent = 3, downrageLevel = 17},
 [19] = {successParcent = 2, downrageLevel = 18},
 [20] = {successParcent = 1, downrageLevel = 19}
 
}
conf["upgrade"] = { -- how many parcent attributes are rised?
    attack = 2, -- attack %
    extraAttack = 2, -- extra Attack %
    defense = 2, -- defence %
    extraDefense = 3, -- extra defence %
    armor = 3, -- armor %
    hitChance = 3, -- 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.max(getCreatureStorage(cid, 1000), 0)) >= math.random(1,100)) and (level+1) or conf["level"][level].downrageLevel
            doCreatureSetStorage(cid, 1000, -1)
			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 strong!")
            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
 
Powinienem tu dać id itemu w obu skryptach, którym się upgraduje?
Nie, te cyfry oznaczają "storage" gracza, który będzie przechowywał ten dodatkowy "modyfikator" wartości. Jeśli używasz już tego storage (lub kiedyś poprawiałem ci skrypt - a ja zawsze używam cyfr: 100, 1000, 10000) to powinieneś go zmienić - żeby skrypty ci się nie gryzły.
 
Ale juz kombinujecie zeby wyciągnac kase od dzieciaków z Evo. Załosne
Żałosne jest to, że nazywasz się jak rasa psa.
Chce zrobić coś nowego na serwerze to się ceni - pomysł dość niewielki, ale jest zawsze jakiś postęp - a to czy zarobi na tym grosz, czy złotówkę to jego sprawa. Każdy musi wykarmić swoją rodzinę.


@down
Literówka, widzę że od razu ją wykorzystałeś przeciwko mnie - ale jak nie ty to inni hejterzy. To co napisałeś to brzmi tak: "ale żal mi dupę ściska o jego serwer, bo ja w życiu zrobiłem tylko wielkie...".
@down @down
True, wyrazy mi się mieszają.
 
Last edited:
Żałosne jest to, że nazywam się jak rasa psa.
Chce zrobić coś nowego na serwerze to się ceni - pomysł dość niewielki, ale jest zawsze jakiś postęp - a to czy zarobi na tym grosz, czy złotówkę to jego sprawa. Każdy musi wykarmić swoją rodzinę.
czy ja śnie? w tym poscie napisałeś że nazywasz się jak rasa psa i że dzieciaki bawiące się w otsy (znacząca wiekszość) zarabiają na tym gównianym "interesie"? hahahaah no proszę cię, LITOŚCI! podejrzewam że gówno kogo obchodzą twoje kompleksy co do twojego nazwiska, a jeśli już jakiś syn musi karmić mamę i siostrę, to na pewno nie siedzi całymi dniami na kompie i nie przerabia thais...

podsumowując, tym postem udowodniłeś że jesteś ograniczony
 
czy ja śnie? w tym poscie napisałeś że nazywasz się jak rasa psa i że dzieciaki bawiące się w otsy (znacząca wiekszość) zarabiają na tym gównianym "interesie"? hahahaah no proszę cię, LITOŚCI! podejrzewam że gówno kogo obchodzą twoje kompleksy co do twojego nazwiska, a jeśli już jakiś syn musi karmić mamę i siostrę, to na pewno nie siedzi całymi dniami na kompie i nie przerabia thais...

podsumowując, tym postem udowodniłeś że jesteś ograniczony

Im więcej się wie, tym więcej się wie, ile się jeszcze nie wie - zawsze jest się ograniczonym, a Twoje ograniczenie jest podwójnie ograniczone ograniczeniem, biorącym się z Twoich własnych ograniczeń.

Jaki masz z tym problem, że chcę dodać nowy skrypt do serwera?
Martwisz się, że tak Cię pokusi, że aż wejdziesz na mój serwer i będziesz musiał wykupić cały sklepik?
Nie wiem po co robisz taki śmietnik w temacie, w którym jak widać nie masz pojęcia - już to pokazałeś.

Więc wrzuć na luz, nie spinaj się, nie martw się o dzieci, które na mój serwer wejdą i o to jakim synem będę by wykarmić rodzinę.

Pozdro.
 
Wszystko już działa, potrzebuje teraz funkcji, która by usuwała to szczęście po użyciu lucky powdera i zupgradowaniu itemu o jeden +, tzn żeby szczęście wróciło do normy.
 
Według mnie to lepiej by było jakbyś zrobił tak jak jest w innych grach mmo, że masz jakiś item o id xxx który 1 sztuka zwiększa szanse na upr o 2% i wtedy przy upr. skrypt liczy ile masz takich itemow w backpacku (powder = getPlayerItemCount(cid,xxx)) i tyle ile masz mnożysz *2% (powder * 2) i o tyle zwiększa się "tymczasowa" szansa na upr. i odrazu takie itemy znikaja z backpacka (doPlayerTakeItem(cid,xxx,powder)) bez zadnych storage i innych pierdolek itp. Tak było w Aionie jeśli się nie mylę.
 
Last edited:
Ale przecież to ja mam to samo, tylko, że u mnie zamiast kilkunastu itemów dających 2% szans, jest jeden item dający 60% szans, problem jest w tym, że po użyciu on znika, ale nie znika szczęście, które dał po użyciu..
Myślisz, że Twoim sposobem by nie było tego problemu?
 
Literówka, widzę że od razu ją wykorzystałem przeciwko mnie...

1 - to nie literof(w)ka
2 - sory ale twoje posty jebią po oczach :)
3 - już wiem że na pewno jesteś ograniczony, albo ćpiesz...


boxer to nie tylko rasa psa i nie widać w tym nicku nic żałosnego, bardziej żałosne jest sn4ake gdzie wykazałeś się pomysłowością i "a" zamieniłeś uwaga1!! na zacne 4444444 !!!!!1 nie lepiej 5/\/aK3 ?
Więcej ci nie odpiszę bo po prostu nie mam siły na typa co robi takie "literówki" że mu się wyrazy jebią.
 
Stary nie musisz mi robić offtopu w temacie.
Jak masz coś do niego, to leć na priv, a nie robisz mi tu śmietnik.
 
Back
Top