Pearl
Active User
- Joined
- May 18, 2008
- Messages
- 71
- Reaction score
- 6
M?j system polega na tym, ?e wpisujemy do tabeli item UID (skrzynki),
wybieramy ilo?? w tabeli count,
od kt?rego poziomu mo?na wzi?? nagrod? level,
ID itemu (nagrody) w tabeli itemid,
EXP w nagrode tabela expierence
oraz storage co do storage mo?na zrobi? np. 3 skrzynki i jeden storage!
Pami?taj ?adna tabela nie mo?e by? pusta!
Jak dodawa? przyk?ady do tabeli?
Do ostatniej linijki dodajemy "," (przecinek)
i wklejamy [1000] = 1
1000 - Unique ID Skrzynki,
1 - w zale?no?ci od tabeli :
Count - Ilo?? Przedmiot?w (nagroda)
Level - Od kt?rego poziomu mo?na bra? nagrod?
Itemid - ID Itemu (nagrody)
StorageId - Storage Value (moze byc kilka tych samych lecz mo?na wzi?? jedna nagrod?!)
Expierence - PKT Expa w nagrod?.
Przyk?ady :
Skrypt :
W Actions/Scripts/Quests/ tworzymy plik pearl_system.lua
W actions.xml
Jak dodawa? questy na mape?
Robimy np. skrzynke, nadajemy mu AID (action id) 1000 oraz UID (unique id) JAKIE CHCEMY!
Oraz dodajemy do tabeli
@ Wersja 2 (Skr?cona)
Wszystkie b??dy zg?asza?!
wybieramy ilo?? w tabeli count,
od kt?rego poziomu mo?na wzi?? nagrod? level,
ID itemu (nagrody) w tabeli itemid,
EXP w nagrode tabela expierence
oraz storage co do storage mo?na zrobi? np. 3 skrzynki i jeden storage!
Pami?taj ?adna tabela nie mo?e by? pusta!
Jak dodawa? przyk?ady do tabeli?
Do ostatniej linijki dodajemy "," (przecinek)
i wklejamy [1000] = 1
1000 - Unique ID Skrzynki,
1 - w zale?no?ci od tabeli :
Count - Ilo?? Przedmiot?w (nagroda)
Level - Od kt?rego poziomu mo?na bra? nagrod?
Itemid - ID Itemu (nagrody)
StorageId - Storage Value (moze byc kilka tych samych lecz mo?na wzi?? jedna nagrod?!)
Expierence - PKT Expa w nagrod?.
Przyk?ady :
Code:
local count = {
[1000] = 25,
[1001] = 10
}
local level = {
[1000] = 8,
[1001] = 10
}
local itemid = {
[1000] = 2160,
[1001] = 2152
}
local storageid = {
[1000] = 10001,
[1001] = 10002
}
local expierence = {
[1000] = 100,
[1001] = 75
}
Skrypt :
W Actions/Scripts/Quests/ tworzymy plik pearl_system.lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local count = {
[1000] = 1
}
local level = {
[1000] = 8
}
local itemid = {
[1000] = 10001
}
local storageid = {
[1000] = 10001
}
local expierence = {
[1000] = 100
}
local exp = expierence[item.uid]
local storage = storageid[item.uid]
local queststatus = getPlayerStorageValue(cid, storage)
local itemid = itemid[item.uid]
local count = count[item.uid]
local itemname = getItemNameById(itemid)
local needlvl = level[item.uid]
local need = "You must have ".. needlvl .." level to get reward."
local found_one = "You have found ".. itemname .."."
local found_more = "You have found ".. count .." of ".. itemname .."."
local empty = "This ".. getItemNameById(item.itemid) .." is empty."
if queststatus == -1 and getPlayerLevel(cid) >= needlvl and count == 1 then
doPlayerSetStorageValue(cid, storage, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, found_one)
doPlayerAddItem(cid, itemid, count)
doPlayerAddExp(cid, exp)
doSendAnimatedText(getCreaturePosition(cid), exp, TEXTCOLOR_WHITE)
return TRUE
elseif queststatus == -1 and getPlayerLevel(cid) >= needlvl and count > 1 then
doPlayerSetStorageValue(cid, storage, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, found_more)
doPlayerAddItem(cid, itemid, count)
doPlayerAddExp(cid, exp)
doSendAnimatedText(getCreaturePosition(cid), exp, TEXTCOLOR_WHITE)
return TRUE
elseif getPlayerLevel(cid) < needlvl then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, need)
elseif queststatus > 0 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, empty)
end
return TRUE
end
W actions.xml
Code:
<action actionid="1000" script="quests/pearl_system.lua" />
Jak dodawa? questy na mape?
Robimy np. skrzynke, nadajemy mu AID (action id) 1000 oraz UID (unique id) JAKIE CHCEMY!
Oraz dodajemy do tabeli
@ Wersja 2 (Skr?cona)
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local quest = {
[5908] = {3, 2160, 1000, 1000} --count, itemid, storageid, experience
}
local storage = quest[item.uid][4]
local queststatus = getPlayerStorageValue(cid, storage)
if queststatus > 0 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This ".. getItemNameById(item.itemid) .." is empty.")
end
local storage = quest[item.uid][3]
local queststatus = getPlayerStorageValue(cid, storage)
local exp = quest[item.uid][4]
local itemid = quest[item.uid][2]
local count = quest[item.uid][1]
local itemname = getItemNameById(itemid)
if queststatus == -1 and count == 1 then
doPlayerSetStorageValue(cid, storage, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found ".. itemname ..".")
doPlayerAddItem(cid, itemid, count)
doPlayerAddExp(cid, exp)
doSendAnimatedText(getCreaturePosition(cid), exp, TEXTCOLOR_WHITE)
elseif queststatus == -1 and count > 1 then
doPlayerSetStorageValue(cid, storage, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found ".. count .." of ".. itemname ..".")
doPlayerAddItem(cid, itemid, count)
doPlayerAddExp(cid, exp)
doSendAnimatedText(getCreaturePosition(cid), exp, TEXTCOLOR_WHITE)
end
return TRUE
end