What's new

tibia 8.2-8.5 Quest z zabiciem potwora

Status
Not open for further replies.

Aragornkk

Senior User
Joined
Oct 11, 2008
Messages
705
Reaction score
44
Odp: tibia 8.2-8.5 Quest z zabiciem potwora

Witam, zrobi?em kolejn? przer?bk? tego skryptu. Podobna do Gelia tylko nie ma bugu.
Nazywa si?, zanim we?miesz nagrod? zabij potwory.
actions
Code:
function onUse(cid, item, frompos, item2, topos)
local monsters = {"rat", "rat", "rat", "rat"}
local positions = {{x=150, y=56, z=6}, {x=151, y=56, z=6}, {x=151, y=57, z=6}, {x=152, y=56, z=6}}


if getPlayerStorageValue(cid, 9999)==-1 then
for i=1, #monsters do
doSummonCreature(monsters[i], positions[i])
end
setPlayerStorageValue(cid,9999,1)
doPlayerSendTextMessage(cid,22,"To plapka!Co to za bestie?")
elseif getPlayerStorageValue(cid, 9999)==5 then
doPlayerSendTextMessage(cid,22,"Teraz moge bezpiecznie wziasc nagrode!")
doPlayerAddItem(cid,nagroda,ile)
setPlayerStorageValue(cid,9999,6)
elseif getPlayerStorageValue(cid, 9999)==6 then
doPlayerSendTextMessage(cid,22,"Nic tu nie ma!")
else
doPlayerSendTextMessage(cid,22,"Wpierw musze zabic potwory!!")
end
end
creaturescripts
Code:
function onKill(cid, target)
if isPlayer(target) == FALSE then
if getPlayerStorageValue(cid, 9999)==1 and (getCreatureName(target) == "rat") and getPlayerStorageValue(cid, 9999)<=5 then
doPlayerSendTextMessage(cid,22,"Zostalo mi jeszcze 3 sztuki do zabicia")
setPlayerStorageValue(cid,9999,(getPlayerStorageValue(cid, 9999)+1))
elseif getPlayerStorageValue(cid, 9999)==2 and (getCreatureName(target) == "rat") then
doPlayerSendTextMessage(cid,22,"Zostalo mi jeszcze 2 sztuki do zabicia")
setPlayerStorageValue(cid,9999,(getPlayerStorageValue(cid, 9999)+1))
elseif getPlayerStorageValue(cid, 9999)==3 and (getCreatureName(target) == "rat") then
doPlayerSendTextMessage(cid,22,"Zostalo mi jeszcze 1 sztuki do zabicia")
setPlayerStorageValue(cid,9999,(getPlayerStorageValue(cid, 9999)+1))
elseif getPlayerStorageValue(cid, 9999)==4 and (getCreatureName(target) == "rat") then
doPlayerSendTextMessage(cid,22,"Dobra, juz moge wziasc nagrode!!")
setPlayerStorageValue(cid,9999,(getPlayerStorageValue(cid, 9999)+1))
end
end
return TRUE
end
login.lua
Code:
registerCreatureEvent(cid, "quest")

Oraz xml.
 
T

Tairens

Guest
Odp: tibia 8.2-8.5 Quest z zabiciem potwora

Aragorn nie wrzucaj ludziom tutaj syfu, tylko zoptymalizuj to. Funkcja onKill jest najcz??ciej wywo?ywan? funkcj? na serverze, wi?c musi by? jak najbardziej optymalna.
Code:
function onKill(cid, target)
	if (isPlayer(target) ~= FALSE and getCreatureName ~= "rat")then
		return true
	end
	local storage = getPlayerStorageValue(cid, 9999)
	if(storage >= 5)then
		return true
	end
	if storage < 4 then
		doPlayerSendTextMessage(cid,22,"Zostalo mi jeszcze "..(4 - storage).. " sztuki do zabicia")
		setPlayerStorageValue(cid, 9999, storage + 1)
	elseif getPlayerStorageValue(cid, 9999) == 4 then
		doPlayerSendTextMessage(cid,22,"Dobra, juz moge wziac nagrode!!")
		setPlayerStorageValue(cid,9999,storage+1)
	end
return true
end

Do tego pisz? si?
Code:
Wzi??
a nie
Code:
wziasc
 

Aragornkk

Senior User
Joined
Oct 11, 2008
Messages
705
Reaction score
44
Odp: tibia 8.2-8.5 Quest z zabiciem potwora

Faktycznie m?g?bym to skr?ci? jednak poprostu lenistwo wzie?o g?r?. Skrypt napisany zosta? ju? bardzo dawno temu(na tibie 8.21) teraz tylko przekszta?ci?em to do talkactions.

A co do b??du ortograficznego to musia?em go zrobi? poniewa? stare silniki potrafi?y nie w??czy? si? z powodu ?e nieznany jest jaki? znak b?d? kto? nacisn?? enter.


A co do tego ?e fukncja on kill jest najcz??ciej u?ywana.
Zgadza si?, co gorsza mo?e by? tylko 1 skrypt wykorzystuj?cy t? fukcje(przynajmniej u mnie silnik DT). Postaram si? optymalizowa? skrypty.
Pozdrawiam aragornkk​
 
Status
Not open for further replies.
Top