What's new

Actions MineSystem - G?rnictwo

Status
Not open for further replies.

SanninStory

https://www.twitch.tv/sdrn
Joined
Oct 13, 2012
Messages
1,778
Reaction score
119
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 !
 

misztrz440

Banned
Joined
Dec 15, 2012
Messages
1,032
Reaction score
39
Odp: MineSystem - G?rnictwo

Jest tu takie co?, ?e jak walisz na ten kamie? to on ma wytrzyma?o??, ?e niszczy si? po kilku uderzeniach, a nie za pierwszym razem?
 

Glombersik

github.com/glombers
Joined
Oct 21, 2013
Messages
502
Reaction score
33
Odp: MineSystem - G?rnictwo

zapewne tak skoro jest
local txt = {"Bam", "Tick", "Buh", "Tink"}
local effects = {2, 3, 9, 34, 44}
local tempo = 10
 

SanninStory

https://www.twitch.tv/sdrn
Joined
Oct 13, 2012
Messages
1,778
Reaction score
119
Odp: MineSystem - G?rnictwo

Niestety nie.
System dzia?a tak, ?e po stukaniu jest pewien % szans na zdobycie przedmiotu(Ustalamy samemu), no i gdy si? nie powiedzie pojawia si? komunikat, ?e nic nie znale?li?my.

@Webo,
local txt - to jest tekst pokazywany przy uderzeniu, co? A'la d?wi?k xD
local effects - S? to efekty, dok?adnie tak samo dzia?aj?ce jak UP
local tempo - Jest to ilo?? uderze? podczas jednej "Akcji"
 
Last edited:

misztrz440

Banned
Joined
Dec 15, 2012
Messages
1,032
Reaction score
39
Odp: MineSystem - G?rnictwo

Jak by? m?g? dorobi?, ?e jest tam te? jaki? % na to, ?e kamie? si? zniszczy. Fajnie by by?o.
 

Payoss

Advanced User
Joined
May 15, 2012
Messages
214
Reaction score
10
Odp: MineSystem - G?rnictwo

Bardzo fajny system, nie widzialem takiego wczesniej:)
 
Status
Not open for further replies.
Top