SanninStory
https://www.twitch.tv/sdrn
- Joined
- Oct 13, 2012
- Messages
- 1,778
- Reaction score
- 116
Siemka.
Jako, ?e m?j projekt Withes Burial dawno upad?, dodam tutaj skrypt napisany przeze mnie w okresie nauczania przez Oskara xD <- Pozdro dla niego.
Jest to mianowicie MineSystem.
Dzia?anie:
Po u?yciu przedmiotu o id 4874 na dan? "Rud?" w tym przypadku tabela Rocks(ustalacie w niej swoje ID Rud) jest szansa na znalezienie przedmiotu, czyli jakiego? kawa?ka rudy.
Jak go doda?:
1. Wchodzimy w data/actions/ i tworzymy tam plik minesystem.lua oraz wklejamy do niego t? zawarto??:
[LUA]-- MineSystem by Sedron dla Withes Burial
function onUse(cid, item, fromPosition, itemEx, toPosition)
CreatureEventChecker = function(event, ...)
if isCreature(arg[1]) or isCreature(arg[3]) or isCreature(arg[4]) then
event(unpack(arg))
end
end
CreatureEvent = function(event, delay, ...)
addEvent(CreatureEventChecker, delay, event, unpack(arg))
end
local txt = {"Bam", "Tick", "Buh", "Tink"}
local effects = {2, 3, 9, 34, 44}
local tempo = 10
local rocks = {
[11430] = {
rockProvides = {
{rew = 2143, count = 1},
{rew = 2144, count = 1},
{rew = 5887, count = 1}},
chance = 10},
[11431] = {
rockProvides = {
{rew = 5880, count = 1},
{rew = 2225, count = 1},
{rew = 2147, count = 1}},
chance = 10},
[11432] = {
rockProvides = {
{rew = 5880, count = 1},
{rew = 5880, count = 3}},
chance = 10},
[11433] = {
rockProvides = {
{rew = 5880, count = 1},
{rew = 5880, count = 3}},
chance = 10}
}
rocks[11430] = rocks[11431]
rocks[11431] = rocks[11431]
rocks[11432] = rocks[11432]
rocks[11433] = rocks[11433]
if rocks[itemEx.itemid] then
local provides = rocks[itemEx.itemid].rockProvides
local itemToGive = provides[math.random(#provides)]
if not exhaustion.check(cid, 65866) then
exhaustion.make(cid, 65866, tempo)
doCreatureSetNoMove(cid, 1)
for i = 1, tempo do
if i ~= tempo then
CreatureEvent(doSendMagicEffect, 1000*i, toPosition, effects[math.random(#effects)], cid)
CreatureEvent(doSendAnimatedText, 1000*i, toPosition, txt[math.random(#txt)], math.random(255), cid)
else
if math.random(100) <= rocks[itemEx.itemid].chance then
CreatureEvent(doCreatureSetNoMove, 1000*tempo, cid, 0)
CreatureEvent(doPlayerAddItem, 1000*tempo, cid, itemToGive.rew,itemToGive.count)
CreatureEvent(doPlayerSendTextMessage, 1000*tempo, cid, 25, "You found an ".. getItemNameById(itemToGive.rew) ..".")
else
CreatureEvent(doPlayerSendCancel, 1000*tempo, cid, "You could not pick anything.")
CreatureEvent(doCreatureSetNoMove, 1000*tempo, cid, 0)
end
end
end
else
doPlayerSendCancel(cid, "You can only dig a rock at a time.")
end
elseif(itemEx.uid <= 65535 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355) then
doTransformItem(itemEx.uid, 392)
doDecayItem(itemEx.uid)
doSendMagicEffect(toPosition, CONST_ME_POFF)
else
doPlayerSendCancel(cid, "Sorry not possible.")
end
return true
end[/LUA]
2. Nast?pnie otwieramy plik actions.xml z lokacji data/actions/ i dodajemy tam linijk?:
[XML]<action itemid="4874" event="script" value="mine system.lua" /> [/XML]
Film przedstawiaj?cy skrypt:
Pozdrawiam i mam nadziej?, ?e skrypt komu? si? przyda !
Jako, ?e m?j projekt Withes Burial dawno upad?, dodam tutaj skrypt napisany przeze mnie w okresie nauczania przez Oskara xD <- Pozdro dla niego.
Jest to mianowicie MineSystem.
Dzia?anie:
Po u?yciu przedmiotu o id 4874 na dan? "Rud?" w tym przypadku tabela Rocks(ustalacie w niej swoje ID Rud) jest szansa na znalezienie przedmiotu, czyli jakiego? kawa?ka rudy.
Jak go doda?:
1. Wchodzimy w data/actions/ i tworzymy tam plik minesystem.lua oraz wklejamy do niego t? zawarto??:
[LUA]-- MineSystem by Sedron dla Withes Burial
function onUse(cid, item, fromPosition, itemEx, toPosition)
CreatureEventChecker = function(event, ...)
if isCreature(arg[1]) or isCreature(arg[3]) or isCreature(arg[4]) then
event(unpack(arg))
end
end
CreatureEvent = function(event, delay, ...)
addEvent(CreatureEventChecker, delay, event, unpack(arg))
end
local txt = {"Bam", "Tick", "Buh", "Tink"}
local effects = {2, 3, 9, 34, 44}
local tempo = 10
local rocks = {
[11430] = {
rockProvides = {
{rew = 2143, count = 1},
{rew = 2144, count = 1},
{rew = 5887, count = 1}},
chance = 10},
[11431] = {
rockProvides = {
{rew = 5880, count = 1},
{rew = 2225, count = 1},
{rew = 2147, count = 1}},
chance = 10},
[11432] = {
rockProvides = {
{rew = 5880, count = 1},
{rew = 5880, count = 3}},
chance = 10},
[11433] = {
rockProvides = {
{rew = 5880, count = 1},
{rew = 5880, count = 3}},
chance = 10}
}
rocks[11430] = rocks[11431]
rocks[11431] = rocks[11431]
rocks[11432] = rocks[11432]
rocks[11433] = rocks[11433]
if rocks[itemEx.itemid] then
local provides = rocks[itemEx.itemid].rockProvides
local itemToGive = provides[math.random(#provides)]
if not exhaustion.check(cid, 65866) then
exhaustion.make(cid, 65866, tempo)
doCreatureSetNoMove(cid, 1)
for i = 1, tempo do
if i ~= tempo then
CreatureEvent(doSendMagicEffect, 1000*i, toPosition, effects[math.random(#effects)], cid)
CreatureEvent(doSendAnimatedText, 1000*i, toPosition, txt[math.random(#txt)], math.random(255), cid)
else
if math.random(100) <= rocks[itemEx.itemid].chance then
CreatureEvent(doCreatureSetNoMove, 1000*tempo, cid, 0)
CreatureEvent(doPlayerAddItem, 1000*tempo, cid, itemToGive.rew,itemToGive.count)
CreatureEvent(doPlayerSendTextMessage, 1000*tempo, cid, 25, "You found an ".. getItemNameById(itemToGive.rew) ..".")
else
CreatureEvent(doPlayerSendCancel, 1000*tempo, cid, "You could not pick anything.")
CreatureEvent(doCreatureSetNoMove, 1000*tempo, cid, 0)
end
end
end
else
doPlayerSendCancel(cid, "You can only dig a rock at a time.")
end
elseif(itemEx.uid <= 65535 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355) then
doTransformItem(itemEx.uid, 392)
doDecayItem(itemEx.uid)
doSendMagicEffect(toPosition, CONST_ME_POFF)
else
doPlayerSendCancel(cid, "Sorry not possible.")
end
return true
end[/LUA]
2. Nast?pnie otwieramy plik actions.xml z lokacji data/actions/ i dodajemy tam linijk?:
[XML]<action itemid="4874" event="script" value="mine system.lua" /> [/XML]
Film przedstawiaj?cy skrypt:
Pozdrawiam i mam nadziej?, ?e skrypt komu? si? przyda !