Ajuda / Pedido Globalevents ! Double Exp

madmagebr
em Scripts

madmagebr

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 19/03/10Posts: 6Char no Tibia: Kurrio

Boa tarde pessoal.

Andei procurando mas não achei em lugar nenhum !

Queria um globalevent que desse double exp por 24h por exemplo.

 

Alguem sabe como fazer ??

 

(Deragon 9.1 TFS 4.0 )

 

VLW ^^

Makelin1

Absoft User =D
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 21/03/12Posts: 651Char no Tibia: Pussycat !

olha ver esse script e o tutorial do matheusmkalo aki \/ abaixo

 

Item ou potion de double exp.

 

By: MatheusMkalo

 

 

Primeiramente vamos ver oque o script tem de diferente dos outros:

  • Se voce sair com o efeito da exp potion o tempo da potion continuara passando, se voce logar antes que ele acabe voce ainda vai poder aproveitar umpouco da double exp.
  • Voce pode escolher varias opçoes, como escolher se so premium accounts podem usar o item, quanta mana vai gasta, se vai remover quando usar e outros

AGORA O SCRIPT SOH ESTA DISPONIVEL EM MOD:

 

Vá na pasta mods e adicione um arquivo.xml com o nome de ExpPotion.xml e bote isso:

 

<?xml version="1.0" encoding="UTF-8"?>

<mod name="AdvancedExpPotionSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com">

 

<!-- Configs and Functions -->

<config name="PotionExpConfigs"><![CDATA[

 

------ CONFIGURE SEU SCRIPT ------ TRUE ou FALSE

configs = {

time = 1, ---- TIME IN MINUTES

needpa = TRUE,

needlvl = {TRUE, level = 50},

costmana = {TRUE, mana = 300},

addrate = 20, -- Exp que vai adicionar em %

removeonuse = TRUE

}

 

function getTime(s)

local n = math.floor(s / 60)

s = s - (60 * n)

return n, s

end

 

CreatureEventChecker = function(event, ...) -- Colex

if isCreature(arg[1]) then

event(unpack(arg))

end

end

 

creatureEvent = function(event, delay, ...) -- Colex

addEvent(CreatureEventChecker, delay, event, unpack(arg))

end

 

function getPlayerExtraExpRate(cid) -- By MatheusMkalo

return (getPlayerRates(cid)[8]-1)*100

end

]]></config>

 

<!-- exppotion.lua -->

<action itemid="7440" event="script"><![CDATA[

domodlib('PotionExpConfigs')

if getPlayerStorageValue(cid, 62164) >= 1 then

return doPlayerSendCancel(cid, "You are already taking effect from this item.")

end

 

if configs.needpa and not isPremium(cid) then

return doPlayerSendCancel(cid, "You need to be a premmium account to use this item.")

end

 

if configs.needlvl[1] and getPlayerLevel(cid) < configs.needlvl.level then

return doPlayerSendCancel(cid, "You need to be level " .. configs.needlvl.level .. " to use this item.")

end

 

if configs.costmana[1] then

if getCreatureMana(cid) < configs.costmana.mana then

return doPlayerSendCancel(cid, "You need " .. configs.costmana.mana .. " mana to use this item.")

else

doCreatureAddMana(cid, -configs.costmana.mana)

end

end

 

if configs.removeonuse then

doRemoveItem(item.uid, 1)

end

 

for i = configs.time*60, 1, -1 do

local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))

if #a < 4 then

a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)

end

if i == configs.time*60 then

creatureEvent(doPlayerSendCancel, configs.time*60*1000, cid, "The effect of the exp potion end.")

end

creatureEvent(doPlayerSendCancel, (configs.time*60-i)*1000, cid, "The effect of the exp potion will end in "..a..".")

end

 

doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))

creatureEvent(doPlayerSetExperienceRate, configs.time *60*1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))

doPlayerSendTextMessage(cid, 22, "Agora voce ira receber mais exp por matar os mosntros.")

setPlayerStorageValue(cid, 62164, os.time())

creatureEvent(setPlayerStorageValue, configs.time *60*1000, cid, 62164, 0)

return TRUE

]]></action>

 

<creaturescript type="login" name="ExpPotion" event="script"><![CDATA[

domodlib('PotionExpConfigs')

local time = configs.time

if os.time()-getPlayerStorageValue(cid, 62164) < time *60 then

doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))

creatureEvent(doPlayerSetExperienceRate, (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) * 1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))

creatureEvent(setPlayerStorageValue, (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) * 1000 , cid, 62164, 0)

 

for i = (time*60-(os.time()-getPlayerStorageValue(cid, 62164))), 1, -1 do

local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))

if #a < 4 then

a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)

end

if i == (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) then

creatureEvent(doPlayerSendCancel, (time*60-(os.time()-getPlayerStorageValue(cid, 62164)))*1000, cid, "The effect of the exp potion end.")

end

creatureEvent(doPlayerSendCancel, ((time*60-(os.time()-getPlayerStorageValue(cid, 62164)))-i)*1000, cid, "The effect of the exp potion will end in "..a..".")

end

end

return TRUE

]]></creaturescript>

</mod>

 

Tudo pronto, exp potion funcionando!

 

O ID da potion usada no script foi o: 7440 (Mastermind Potion)

Para usa-lo voce precisa tirar a linha no actions.xml da potion porque se nao vai bugar.

 

Para trocar o id da potion eh so mudar essa linha:

<action itemid="7440" event="script"><![CDATA[

Att

Smartbox

 

 

Ajudei ? + REP

 

Absoft Map

http://www.xtibia.co...__fromsearch__1

 

2575910.gif

Beeki

Ex-Coordenador XDev
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 12/03/11Posts: 1900Gênero: MasculinoChar no Tibia: Nokte

@Smartbox

 

ele não quer uma action e sim um globalevent que adicione double exp durante 24 Horas e depois retire.

Fabio Augustus - Infraestrutura

Skype: guhsvasc

Makelin1

Absoft User =D
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 21/03/12Posts: 651Char no Tibia: Pussycat !

ata nem sabia vlw ai pela dica + rep vlw !

Att

Smartbox

 

 

Ajudei ? + REP

 

Absoft Map

http://www.xtibia.co...__fromsearch__1

 

2575910.gif

Vodkart

Sumus Validus
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 21/05/10Posts: 3406Gênero: Masculino

global events/script

 

script.lua

function onThink(interval, lastExecution)
local config = {
days = {"Sunday", "Tuesday", "Friday"},
storage = 102590,
hours = 24
}
if isInArray(config.days, os.date("%A")) and getGlobalStorageValue(config.storage) - os.time() <= 0 then
setGlobalStorageValue(config.storage, os.time()+config.hours*60*60)
doBroadcastMessage("sua exp rate agr foi aumentada em 50% por "..config.hours.." horas! Aproveite.")
end
return true
end

 

globalevents.xml

<globalevent name="ExpBonus" interval="60" event="script" value="script.lua"/>

 

creaturescript/script

 

script.lua

function onKill(cid, target)
if isPlayer(cid) and isMonster(target) then
if getGlobalStorageValue(102590) - os.time() >= 1 then
local exp = getExperienceStage(getPlayerLevel(cid), getVocationInfo(getPlayerVocation(cid)).experienceMultiplier)
local count = ((getMonsterInfo(string.lower(getCreatureName(target))).experience*1.5*exp)/2)
doPlayerAddExperience(cid, count)
addEvent(doSendAnimatedText, 500, getCreaturePosition(cid), '+'..count, math.random(50,60))
end
else
return TRUE
end
return TRUE
end

 

creaturescript.xml

<event type="kill" name="ExpBonus" event="script" value="script.lua"/>

 

creaturescript/script/login.lua adc

registerCreatureEvent(cid, "ExpBonus")

 

 

Ai você pode melhorar o script com textos de mensagens com tempo de quanto falta para acabar o bônus pq to sem saco pra faze, etc...

Obs: já está configurado para dar 50% de extra exp para os jogadores, e sim, é com stages (:

flw

bossisg.png

Beeki

Ex-Coordenador XDev
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 12/03/11Posts: 1900Gênero: MasculinoChar no Tibia: Nokte

@Vodkart

 

Pode entrar no msn por favor ? preciso me relacionar com você, até

Fabio Augustus - Infraestrutura

Skype: guhsvasc

jhon992

Dono JhonBot
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/06/11Posts: 631Char no Tibia: Warrior of Mort

Fiz um script tbm, vou postar pq começei a fazer antes do vod postar o dele. O meu script vai funcionar como um evento. O Gm ordena quando começa e acaba esse evento.

 

Vai em data/creaturescripts/scripts, duplica um arquivo e nomeia para "login_exp" sem as aspas e nele cole:

 

function onLogin(cid)

local rate = 2 -- 100%
local msg = "Aproveite o evento Doble Exp!"
local stor = 13545 -- storage vip

if (getGlobalStorageValue(stor) > 0) then
doPlayerSetExperienceRate(cid, rate)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, msg)
end

return TRUE
end

 

Em creaturescripts.xml cole a tag:

<event type="login" name="Login_Exp" event="script" value="login_exp.lua"/>

 

 

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

 

 

Vai em data/talkactions/scritps e duplica um arquivos, e nomeia para "eventexp" sem as aspas e nele cole:

 

function onSay(cid, words, param, channel)

if(param == '') then
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
	return true
end

if (param == "open") then
	if (getGlobalStorageValue(13545) > 0) then
		doPlayerSendTextMessage(cid, 22, "O evento ja esta aberto.")
		return true
	end	
	setGlobalStorageValue(13545, 1)
	doBroadcastMessage("O evento Double Exp esta aberto, todos os player serão kikados após 10 segundos!")
	addEvent(RemoveAll, 10000, cid)		
elseif (param == "close") then
	if (getGlobalStorageValue(13545) <= 0) then
		doPlayerSendTextMessage(cid, 22, "O evento ja esta feixado.")
		return true
	end
	setGlobalStorageValue(13545, 0)
	doBroadcastMessage("O evento Double Exp esta feixado, todos os player serão kikados após 10 segundos!")
	addEvent(RemoveAll, 10000, cid)
end
return true
end

function RemoveAll(cid)
local online = getOnlinePlayers()
for i=1, #online do
if (isPlayer(getPlayerByName(online[i]))) then
	doRemoveCreature(getPlayerByName(online[i]))
end
end
end

 

Em talkaction.xml cole a tag:

<talkaction log="yes" access="5" words="eventxp" event="script" value="eventexp.lua"/>

 

Para abrir o evento basta com o gm usar o comando "eventxp open" e para feixar "eventxp close".

Vodkart

Sumus Validus
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 21/05/10Posts: 3406Gênero: Masculino

essa cid na função RemoveAll é totalmente desnecessária :

 

function RemoveAll()
for _, pid in pairs(getPlayersOnline()) do
doRemoveCreature(pid, true)
end
end

 

addEvent(RemoveAll, 10000)

bossisg.png

jhon992

Dono JhonBot
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/06/11Posts: 631Char no Tibia: Warrior of Mort

madmagebr

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 19/03/10Posts: 6Char no Tibia: Kurrio

Muito Obrigado Jhon992 e Vodkart !!! Os dois scripts funcionaram perfeitamente !!

 

Vodkart já reputado ^^

 

Jhon992, amanhã te dou rep+ tbm ok !!!

 

Vlw pessoal ^^

HisashiitYamaguti

O Cortiço - Aluísio Azevedo.
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 17/07/11Posts: 705

Tópico movido para a sessão de Dúvidas Respondidas.

hisashi.png

 

douglix

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 31/07/10Posts: 14

@Vodkart, como faço para colocar apenas 20% e nao o dobro ? Obrigado