Działanie: Po użyciu mamy prawdopodobienstwo 1 na 6 że padniemy (tak jak w rosyjskiej ruletce). Jeśli mamy farta dostajemy 100 gp lub exp (nasz lvl razy 100, np.: lvl 25 dostanie 2500 expa).
Wchodzimy w ots/data/action/script i tworzymy notatnik , a w nim wpisujemy:
function onUse(cid, item, frompos, item2, topos)
local hp = getPlayerHealth(cid) local mana = getPlayerMana(cid) local level = getPlayerLevel(cid)
local ded = (hp) + (mana) local ileexpa = (level * 100)
text = math.random(1, 6) if text == 1 then doPlayerAddItem(cid,2152,1) doSendMagicEffect(topos, 1) doSendAnimatedText(topos,'Masz farta!',137) elseif text == 2 then doPlayerAddItem(cid,2152,1) doSendMagicEffect(topos, 1) doSendAnimatedText(topos,'Masz farta!',137) elseif text == 3 then doPlayerAddExp(cid,ileexpa) doSendMagicEffect(topos, 1) doSendAnimatedText(topos,'Masz farta!',137) elseif text == 4 then doPlayerAddExp(cid,ileexpa) doSendMagicEffect(topos, 1) doSendAnimatedText(topos,'Masz farta!',137) elseif text == 5 then doPlayerAddExp(cid,ileexpa) doSendMagicEffect(topos, 1) doSendAnimatedText(topos,'Masz farta!',137) elseif text == 6 then doPlayerAddHealth(cid,-ded) doSendMagicEffect(topos, 17) doSendAnimatedText(topos,'Pech...!',180) end return 1
end
Zapisujemy jako: ruletka.lua
Następnie dodajemy linijke do ots/data/action Actions.xml <action itemid="xxxx" script="ruletka.lua" />
xxxx to id itema jakim będzie ta ruleta. W grafikach tibii nie znalazłem rzeczy która mogła by tak wyglądać dlatego nie podałem konkretnego id.
|