LU
pedido

Fábrica de Scripts

Por LuckOake, 28 de set. de 2013 em Scripts

resolvido
script
166
20.7k
LuckOakeL
28 de setembro de 2013 às 21:34

tentei assim, do jeito que tu disse acima /\, e tentei assim:

 

 

function onUse(cid, item)
    local door_pos = {x = 677, y = 1079, z = 7, stackpos = 1} -- Posição da porta
    local global_storage = 13895 -- Global Storage da lever que remove a porta
    local lever_istorage = 13896 -- Global Storage das levers erradas
    local lever_cstorage = 13897 -- Global Storage das levers corretas
    local door_id = 9118 -- ID da porta
    local back_time = 15 -- Tempo, em segundos, para a porta reaparecer
    local lever_pulled = 1945 -- ID da lever não puxada
    local lever_normal = 1946 -- ID da lever puxada
    local levers = {
        [19010] = {gstorage = lever_istorage, add = 1, n_aid = 19011},
        [19011] = {gstorage = lever_istorage, add = -1, n_aid = 19010},
        [19012] = {gstorage = lever_cstorage, add = 1, n_aid = 19013},
        [19013] = {gstorage = lever_cstorage, add = -1, n_aid = 19012},
        [19014] = door_pos,
    }
    
    if not levers[item.actionid].gstorage then
        if getGlobalStorageValue(global_storage) == 1 or getGlobalStorageValue(lever_istorage) ~= -1 or getGlobalStorageValue(lever_cstorage) < 1 then return true end
        
        doRemoveItem(getTileItemById(door_pos, door_id).uid, 1)
        setGlobalStorageValue(global_storage, 1)
        addEvent(function()
                    setGlobalStorageValue(global_storage, -1)
                    doCreateItem(door_id, 1, door_pos)
                end, back_time*1000)
    else
        setGlobalStorageValue(levers[item.actionid].gstorage, getGlobalStorageValue(levers[item.actionid].gstorage)+levers[item.actionid].add)
        doItemSetAttribute(item.uid, "aid", levers[item.actionid].n_aid)
    end
    doTransformItem(item.uid, item.itemid == lever_pulled and lever_normal or lever_pulled)
return true
end

 

 

 

Ambas as opções, não mechem a ultima alavanca, na qual tu mandou eu por ActionID: 19014

 

 

Rapaz, seu server deve estar com algum problema, pois aqui funcionou normalmente. Tente trocar as global storages de novo:

local global_storage = 13895 -- Global Storage da lever que remove a porta
local lever_istorage = 13896 -- Global Storage das levers erradas
local lever_cstorage = 13897 -- Global Storage das levers corretas

---------------------------------------------------------------------------------------------------------

 

Luck, sobre o sistema, seria possível adicionar experiencia como premio também na tabela? Obs: tentei adicionar expgain =

No aguardo, obrigado denovo.

 

Tá aqui:

 

local monsters = { -- [Nome] = {storage, quantia, recompensa {id, quantia}, experiência ganha},
    ["Troll"] = {storage = 18011, count = 1000, reward = {2160, 10}, exp_gain = 100},
    ["Orc"] = {storage = 18012, count = 700, reward = {2160, 10}, exp_gain = 100},
}
 
function onKill(cid, target)
    if monsters[getCreatureName(target)] then
        setPlayerStorageValue(cid, monsters[getCreatureName(target)].storage, getPlayerStorageValue(cid, monsters[getCreatureName(target)].storage) == -1 and 1 or getPlayerStorageValue(cid, monsters[getCreatureName(target)].storage)+1)
        local stor = getPlayerStorageValue(cid, monsters[getCreatureName(target)].storage)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(target).." killed: "..stor.."/"..monsters[getCreatureName(target)].count)
        if stor == monsters[getCreatureName(target)].count then
            doPlayerAddItem(cid, monsters[getCreatureName(target)].reward[1], monsters[getCreatureName(target)].reward[2])
            doPlayerAddExp(cid, monsters[getCreatureName(target)].exp_gain)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed "..getCreatureName(target).." "..(monsters[getCreatureName(target)].count)..". You got "..(monsters[getCreatureName(target)].reward[2]).."x "..(getItemNameById(monsters[getCreatureName(target)].reward[1])).." as a reward.")
            setPlayerStorageValue(cid, monsters[getCreatureName(target)].storage, 0)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Task reseted.")
        end
    end
return true
end

 

 

Editado Setembro 28 por LuckOake

28 de setembro de 2013 às 21:37

Luck eu tenho as sources aki,

AlphaLoveA
28 de setembro de 2013 às 21:39

 

tentei assim, do jeito que tu disse acima /\, e tentei assim:

 

 

function onUse(cid, item)
    local door_pos = {x = 677, y = 1079, z = 7, stackpos = 1} -- Posição da porta
    local global_storage = 13895 -- Global Storage da lever que remove a porta
    local lever_istorage = 13896 -- Global Storage das levers erradas
    local lever_cstorage = 13897 -- Global Storage das levers corretas
    local door_id = 9118 -- ID da porta
    local back_time = 15 -- Tempo, em segundos, para a porta reaparecer
    local lever_pulled = 1945 -- ID da lever não puxada
    local lever_normal = 1946 -- ID da lever puxada
    local levers = {
        [19010] = {gstorage = lever_istorage, add = 1, n_aid = 19011},
        [19011] = {gstorage = lever_istorage, add = -1, n_aid = 19010},
        [19012] = {gstorage = lever_cstorage, add = 1, n_aid = 19013},
        [19013] = {gstorage = lever_cstorage, add = -1, n_aid = 19012},
        [19014] = door_pos,
    }
    
    if not levers[item.actionid].gstorage then
        if getGlobalStorageValue(global_storage) == 1 or getGlobalStorageValue(lever_istorage) ~= -1 or getGlobalStorageValue(lever_cstorage) < 1 then return true end
        
        doRemoveItem(getTileItemById(door_pos, door_id).uid, 1)
        setGlobalStorageValue(global_storage, 1)
        addEvent(function()
                    setGlobalStorageValue(global_storage, -1)
                    doCreateItem(door_id, 1, door_pos)
                end, back_time*1000)
    else
        setGlobalStorageValue(levers[item.actionid].gstorage, getGlobalStorageValue(levers[item.actionid].gstorage)+levers[item.actionid].add)
        doItemSetAttribute(item.uid, "aid", levers[item.actionid].n_aid)
    end
    doTransformItem(item.uid, item.itemid == lever_pulled and lever_normal or lever_pulled)
return true
end

 

 

 

Ambas as opções, não mechem a ultima alavanca, na qual tu mandou eu por ActionID: 19014

 

 

Rapaz, seu server deve estar com algum problema, pois aqui funcionou normalmente. Tente trocar as global storages de novo:

local global_storage = 13895 -- Global Storage da lever que remove a porta
local lever_istorage = 13896 -- Global Storage das levers erradas
local lever_cstorage = 13897 -- Global Storage das levers corretas

---------------------------------------------------------------------------------------------------------

 

Luck, sobre o sistema, seria possível adicionar experiencia como premio também na tabela? Obs: tentei adicionar expgain =

No aguardo, obrigado denovo.

 

Tá aqui:

 

local monsters = { -- [Nome] = {storage, quantia, recompensa {id, quantia}, experiência ganha},
    ["Troll"] = {storage = 18011, count = 1000, reward = {2160, 10}, exp_gain = 100},
    ["Orc"] = {storage = 18012, count = 700, reward = {2160, 10}, exp_gain = 100},
}
 
function onKill(cid, target)
    if monsters[getCreatureName(target)] then
        setPlayerStorageValue(cid, monsters[getCreatureName(target)].storage, getPlayerStorageValue(cid, monsters[getCreatureName(target)].storage) == -1 and 1 or getPlayerStorageValue(cid, monsters[getCreatureName(target)].storage)+1)
        local stor = getPlayerStorageValue(cid, monsters[getCreatureName(target)].storage)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(target).." killed: "..stor.."/"..monsters[getCreatureName(target)].count)
        if stor == monsters[getCreatureName(target)].count then
            doPlayerAddItem(cid, monsters[getCreatureName(target)].reward[1], monsters[getCreatureName(target)].reward[2])
            doPlayerAddExp(cid, monsters[getCreatureName(target)].exp_gain)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed "..getCreatureName(target).." "..(monsters[getCreatureName(target)].count)..". You got "..(monsters[getCreatureName(target)].reward[2]).."x "..(getItemNameById(monsters[getCreatureName(target)].reward[1])).." as a reward.")
            setPlayerStorageValue(cid, monsters[getCreatureName(target)].storage, 0)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Task reseted.")
        end
    end
return true
end

 

 

 

 

me adiciona no skype que eu te mostro por compartilhamento de tela, aí depois tu exclui, ta tudo certinho.

 

Skype: jonaathaan.rox

 

Desculpa não responder, eu não ví, meu server é 8.6.

LuckOakeL
28 de setembro de 2013 às 21:42

Luck eu tenho as sources aki,

 

Leia a regra número 8.

 

---------------------------------------------------------------------------------------------

 

me adiciona no skype que eu te mostro por compartilhamento de tela, aí depois tu exclui, ta tudo certinho.

 

Skype: jonaathaan.rox

 

Desculpa não responder, eu não ví, meu server é 8.6.

 

Qual rev é o server?

AlphaLoveA
28 de setembro de 2013 às 21:44

 

Luck eu tenho as sources aki,

 

Leia a regra número 8.

 

---------------------------------------------------------------------------------------------

 

me adiciona no skype que eu te mostro por compartilhamento de tela, aí depois tu exclui, ta tudo certinho.

 

Skype: jonaathaan.rox

 

Desculpa não responder, eu não ví, meu server é 8.6.

 

Qual rev é o server?

 

 

TFS+0.3.7-r5969

LuckOakeL
28 de setembro de 2013 às 21:45

 

 

Luck eu tenho as sources aki,

 

Leia a regra número 8.

 

---------------------------------------------------------------------------------------------

 

me adiciona no skype que eu te mostro por compartilhamento de tela, aí depois tu exclui, ta tudo certinho.

 

Skype: jonaathaan.rox

 

Desculpa não responder, eu não ví, meu server é 8.6.

 

Qual rev é o server?

 

 

TFS+0.3.7-r5969

 

 

Não sei se você vai concordar, mas sugiro que você use a 0.4 rev3884. Essas versões 0.3.x não são muito legais, na minha opinião.

AlphaLoveA
28 de setembro de 2013 às 21:48

 

 

 

Luck eu tenho as sources aki,

 

Leia a regra número 8.

 

---------------------------------------------------------------------------------------------

 

me adiciona no skype que eu te mostro por compartilhamento de tela, aí depois tu exclui, ta tudo certinho.

 

Skype: jonaathaan.rox

 

Desculpa não responder, eu não ví, meu server é 8.6.

 

Qual rev é o server?

 

 

TFS+0.3.7-r5969

 

 

Não sei se você vai concordar, mas sugiro que você use a 0.4 rev3884. Essas versões 0.3.x não são muito legais, na minha opinião.

 

 

Tem alguma base com source para me indicar ? De preferencia alguma que de pra compilar, sem erros :/

Editado Setembro 28 por N4K4MUR4

LuckOakeL
28 de setembro de 2013 às 21:53

Segue em anexo uma rev3884 pura (sem modificações).

 

Uso essa aí pra maioria dos meus servidores.

forgottenserver-trunk.r3884.tar.gz

2121212
28 de setembro de 2013 às 21:55

Deu certo o exp, só que agora que percebi, após matar o ultimo monstro é possível fazer novamente a task.. entao poderia colocar um storage para cada monstro que fosse concluida a task e nao repetir?

 

E outra cosinha, fazer aparecer a quantia de exp recebi em um animmatedtext, 215.

 

Muito obrigado novamento, no aguardo.

Editado Setembro 28 por 0BoM

LuckOakeL
28 de setembro de 2013 às 21:57

Deu certo o exp, só que agora que percebi, após matar o ultimo monstro é possível fazer novamente a task.. entao poderia colocar um storage para cada monstro que fosse concluida a task e nao repetir?

 

E outra cosinha, fazer aparecer a quantia de exp recebi em um animmatedtext, 215.

 

Muito obrigado novamento, no aguardo.

 

Tó:

 

local monsters = { -- [Nome] = {storage, quantia, recompensa {id, quantia}, experiência ganha, storage após completar},
    ["Troll"] = {storage = 18011, count = 1000, reward = {2160, 10}, exp_gain = 100, completion_stor = 19011},
    ["Orc"] = {storage = 18012, count = 700, reward = {2160, 10}, exp_gain = 100, completion_stor = 19012},
}
 
function onKill(cid, target)
    if monsters[getCreatureName(target)] then
        setPlayerStorageValue(cid, monsters[getCreatureName(target)].storage, getPlayerStorageValue(cid, monsters[getCreatureName(target)].storage) == -1 and 1 or getPlayerStorageValue(cid, monsters[getCreatureName(target)].storage)+1)
        local stor = getPlayerStorageValue(cid, monsters[getCreatureName(target)].storage)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(target).." killed: "..stor.."/"..monsters[getCreatureName(target)].count)
        if stor == monsters[getCreatureName(target)].count then
            doPlayerAddItem(cid, monsters[getCreatureName(target)].reward[1], monsters[getCreatureName(target)].reward[2])
            doPlayerAddExp(cid, monsters[getCreatureName(target)].exp_gain)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed "..getCreatureName(target).." "..(monsters[getCreatureName(target)].count)..". You got "..(monsters[getCreatureName(target)].reward[2]).."x "..(getItemNameById(monsters[getCreatureName(target)].reward[1])).." as a reward.")
            setPlayerStorageValue(cid, monsters[getCreatureName(target)].storage, 0)
            setPlayerStorageValue(cid, monsters[getCreatureName(target)].completion_stor, 1)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Task reseted.")
        end
    end
return true
end

AlphaLoveA
28 de setembro de 2013 às 22:00

Luck, pode adicionar no skype pra tu me ajudar com o problema do pedido ?

 

:/

 

Depois tu exclui..

 

 

@edit

 

Esta dando erro pra compilar. Eu estou usando Dev C++ e CodeBlocks, nenhum dos dois compila ;s

Editado Setembro 28 por N4K4MUR4

2121212
28 de setembro de 2013 às 22:06

Ainda persistindo em fazer a task denovo!

E também não consigo fazer aparecer a quantia de exp recebida em animmationtext branco (215).

Muito obrigado, no aguardo.

LuckOakeL
28 de setembro de 2013 às 22:13

Ainda persistindo em fazer a task denovo!

E também não consigo fazer aparecer a quantia de exp recebida em animmationtext branco (215).

Muito obrigado, no aguardo.

 

Opa, é que não tinha entendido que não era pra resetar. Coloquei uma config para caso você queira ativar o desativar isso. Tó:

 

local monsters = { -- [Nome] = {storage, quantia, recompensa {id, quantia}, experiência ganha, storage após completar},
    ["Troll"] = {storage = 18011, count = 1000, reward = {2160, 10}, exp_gain = 100, completion_stor = 19011},
    ["Orc"] = {storage = 18012, count = 700, reward = {2160, 10}, exp_gain = 100, completion_stor = 19012},
}
local reset_on_complete = false -- Resetar a task ao completar? (true / false)
 
function onKill(cid, target)
    if monsters[getCreatureName(target)] then
        if getPlayerStorageValue(cid, monsters[getCreatureName(target)].storage) < monsters[getCreatureName(target)].count then
            setPlayerStorageValue(cid, monsters[getCreatureName(target)].storage, getPlayerStorageValue(cid, monsters[getCreatureName(target)].storage) == -1 and 1 or getPlayerStorageValue(cid, monsters[getCreatureName(target)].storage)+1)
            local stor = getPlayerStorageValue(cid, monsters[getCreatureName(target)].storage)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(target).." killed: "..stor.."/"..monsters[getCreatureName(target)].count)
            if stor == monsters[getCreatureName(target)].count then
                doPlayerAddItem(cid, monsters[getCreatureName(target)].reward[1], monsters[getCreatureName(target)].reward[2])
                doPlayerAddExp(cid, monsters[getCreatureName(target)].exp_gain)
                doSendAnimatedText(getCreaturePosition(cid), tostring(monsters[getCreatureName(target)].exp_gain), 215)
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed "..getCreatureName(target).." "..(monsters[getCreatureName(target)].count)..". You got "..(monsters[getCreatureName(target)].reward[2]).."x "..(getItemNameById(monsters[getCreatureName(target)].reward[1])).." as a reward.")
                setPlayerStorageValue(cid, monsters[getCreatureName(target)].completion_stor, 1)
                if reset_on_complete then
                    setPlayerStorageValue(cid, monsters[getCreatureName(target)].storage, 0)
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Task reseted.")
                end
            end
        end
    end
return true
end

 

 

----------------------------------------------------------------------

Luck, pode adicionar no skype pra tu me ajudar com o problema do pedido ?

 

:/

 

Depois tu exclui..

 

 

@edit

 

Esta dando erro pra compilar. Eu estou usando Dev C++ e CodeBlocks, nenhum dos dois compila ;s

 

Seu Dev-C++ deve estar com problemas ou está desconfigurado, pois a source não possui erros.

Editado Setembro 28 por LuckOake

28 de setembro de 2013 às 22:42

Luck,como ninguem está pedindo nada,pode tentar fazer aquele NPC de task la?

OneshotO
28 de setembro de 2013 às 23:10

Bom, o LuckOake deixou o pupilo dele, no caso, eu, atender pedidos aqui na fábrica, para ganhar experiência. Eu tomei a liberdade de refazer o script de task automático, pedido por @0BoM.

MONSTER_TASKS = {
--	["NOME"] = {count = QUANTIDADE, reward = {{ITEM1, QUANTIDADE1}, {ITEM2, QUANTIDADE2}}},
--	Para dar experiência de prêmio, coloque "experience"
	["Troll"] = {count = 10, reward = {{2160, 10}, {"experience", 10}}},
}

function onKill(cid, target)
	local tmp = MONSTER_TASKS[getCreatureName(target)]
	if tmp then
		local name = getCreatureName(target):lower()
		local status_storage = name .."_status"
		if getCreatureStorage(cid, status_storage) == -1 then
			local count_storage = name .."_count"
			doCreatureSetStorage(cid, count_storage, math.max(getCreatureStorage(cid, count_storage), 0) + 1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(target) .." killed: ".. getCreatureStorage(cid, count_storage) .."/".. tmp.count ..".")
			if getCreatureStorage(cid, count_storage) >= tmp.count then
				for i=1,#tmp.reward do
					if tmp.reward[i][1] == "experience" then
						doPlayerAddExperience(cid, tmp.reward[i][2])
						doSendAnimatedText(getCreaturePosition(cid), tmp.reward[i][2], COLOR_WHITE)
					else
						doPlayerAddItem(cid, tmp.reward[i][1], tmp.reward[i][2])
					end
				end
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have killed ".. tmp.count .." of ".. getCreatureName(target) ..". You have completed the task.")
				doCreatureSetStorage(cid, status_storage, 1)
			end
		end
	end
	return true
end 

Ficou bem legal, permite múltiplas recompensas, você não precisa configurar storages.

 

Abraços.