• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Liczydlo potworow

Slepy

New Member
Joined
May 14, 2009
Messages
111
Reaction score
1
Chodzi mi o script ktory bedzie liczyl ile juz jest zabitych potworow ale nie zawsze tylko jak bedziesz miec misje...
czy dalo by sie cos takiego napisac?
zeby mozna bylo wpisac mase storage tych questow.
 
Chce tylko tyle zeby mi liczylo nie chce zeby dawal za to nagrode czy cos tylko ma liczyc nagrode bedzie dawal mu npc ktory dal misje
 
i to wystarczy?
A kto mi do tego scripta dorobi Ze bedzie Pisalo
Zabiles 1 Rat
Zabiles 2 Rat
I tak Dalej
local quests =
{
{ 1111, "Rat", 30, "Congratulations! You finished a first quest of Rats!" }, -- storage of starts quest, monster, count to kill, gift id, gift count, message on finish
{ 1112, "Demon", 100, "Congratulations!" },
{ 1113, "Rat", 5, "Congratulations! You finished a second quest of Rats!" }
}

function onKill(cid, target, lastHit)
if (not isMonster(target)) then
return false
end

for i=1, #quests do
if (getCreatureName(target) == quests[2] and not (getPlayerStorageValue(cid, quests[1]) > quests[3])) then
if (getPlayerStorageValue(cid, quests[1]) == -1) then
doPlayerSetStorageValue(cid, quests[1], 0)
end
doPlayerSetStorageValue(cid, quests[1], (getPlayerStorageValue(cid, quests[1])+1))
if (getPlayerStorageValue(cid, quests[1]) == quests[3]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, quests[4])
end
return true
end
end
return true
end

To moze jakby przerobic i dodac zeby tak pisalo:
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Zabiles " .. killedMonsters .. " ")
a w tym local
.. killedMonsters ..
zeby liczylo ile i jakiego monstera
 
Last edited:
LUA:
local quests =
{
        { 1111, "Rat", 30 },  -- storage of starts quest, monster, count to kill
        { 1112, "Demon", 100 },
        { 1113, "Rat", 5 }
}

function onKill(cid, target, lastHit)
        if (not isMonster(target)) then
                return false
        end
        
        for i=1, #quests do
                if (getCreatureName(target) == quests[i][2] and getPlayerStorageValue(cid, quests[i][1]) ~= -1 and not (getPlayerStorageValue(cid, quests[i][1]) > quests[i][3])) then
                        if (getPlayerStorageValue(cid, quests[i][1]) == quests[i][3]) then
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Ukonczyles misje, biegnij do NPC po nagrode")
                        end
                        doPlayerSetStorageValue(cid, quests[i][1], (getPlayerStorageValue(cid, quests[i][1])+1)) 
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Zabiles " .. getPlayerStorageValue(cid, quests[i][1]) .. " " .. getPlayerStorageValue(cid, quests[i][2]) .."") 
                        return true
                end
        end
        return true
end
npc:
LUA:
local tasks =
{
    { name = "Rats First", questStorage = 1111, killsRequired = 30, raceName = "Rats", rewards = {type = "exp", values = 200}},
    { name = "Demons Mission", questStorage = 1112, killsRequired = 100, raceName = "Demons", rewards = {type = "item", values = 2160, count = 10}},
    { name = "Rats Second", questStorage = 1111, killsRequired = 5, raceName = "Rats", rewards = {type = "exp", values = 600}}
}

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid)                          npcHandler:onCreatureAppear(cid)                        end
function onCreatureDisappear(cid)                       npcHandler:onCreatureDisappear(cid)                     end
function onCreatureSay(cid, type, msg)                  npcHandler:onCreatureSay(cid, type, msg)                end
function onThink()                                      npcHandler:onThink()                                    end

function creatureSayCallback(cid, type, msg)

	if(not npcHandler:isFocused(cid)) then
		return false
	end

	if msgcontains(msg, 'start') then
		selfSay('What mission?', cid)
		talkState[cid] = 1
	elseif msgcontains(msg, 'reward') then
		talkState[cid] = 2
	elseif talkState[cid] == 1 then
		for i=1, #tasks do
			if (msg == tasks[i].name) then
				doPlayerSetStorageValue(cid, tasks[i].questStorage, 0)
				selfSay('Started! Let\'s Go!', cid)
				talkState[cid] = 0
				break
			end
		end
	elseif talkState[cid] == 2 then
		for i=1, #tasks do
			if (msg == tasks[i].name) then
				if (getPlayerStorageValue(cid, tasks[i].questStorage) == tasks[i].killsRequired) then
					if(tasks[i].rewards.type == "exp") then
						doPlayerAddExperience(cid, tasks[i].rewards.values)
					elseif(tasks[i].rewards.first.type == "item") then
						doPlayerAddItem(cid, tasks[i].rewards.values[1], tasks[i].rewards.values[2])
					end
					doPlayerSetStorageValue(cid, tasks[i].questStorage, 65000)
					selfSay('Congratulations!', cid)
					break
				end
			end
		end
	end

	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Jak zaczac zadanie?
hi->start->Rats First
Jak odebrac nagrode?
hi->reward->Rats First
 
Last edited:
Jestes boski tylko powiedz mi czy masz jeszcze tamtego scripta co sie pytalem na priv


Potrzebuje takego prostrzego w obsludze

i oczywiscie rep ++
 
Back
Top