LU
pedido

Stamina tile

Por luccagomes, 25 de set. de 2013 em Scripts

resolvido
10
3k
luccagomesL
25 de setembro de 2013 às 15:33

Eu queria um tile que se vc fica-se parado nele de 30 em 30 mim da hora q vc chegou subi-se uma MSG no seu char +STAMINA e subi-se 30 minutos de stamina (ou sei lá 20,10,60 como vcs preferirem)

RoksasR
25 de setembro de 2013 às 15:38

Mas não seria a mesma coisa de ficar off?

luccagomesL
25 de setembro de 2013 às 18:39

Exatamente em vez do player ficar off ele ficaria lá treinando (+ player online pro sv, ot mais acima na otservlist), as vezes o cara quer até jogar, mas ta sem stamina dai n adianta

LekoDSL
26 de setembro de 2013 às 00:10

Estou aprendendo lua ... e fiz pra você xD

Em movements.xml adicione:

<movevent type="StepIn" actionid="ACTION-MAPA" event="script" value="stamina.lua"/>
<movevent type="StepOut" actionid="ACTION-MAPA" event="script" value="stamina.lua"/>

Nos arquivos do movements crie um novo arquivo lua com o nome de stamina.lua e coloque:

-- Script by LekoDS
local configuration = {
storage = 263696, -- storage
loltime = 3 * 1000, -- tempo
stamina = 60, -- minutos ganhos de Stamina
}

function onStepIn(cid, item, position, fromPosition)
	if (isPlayer(cid)) == false then
		elseif getPlayerStorageValue(cid, configuration.storage) >= 0 then
		doPlayerSendTextMessage(cid, 27, "You entered an area of regeneration of Stamina. In 10 seconds you regenerate 60 minutes of Stamina.")
		addEvent(doPlayerAddExp, configuration.time, cid, 10)
		addEvent(doSendMagicEffect, configuration.time, getThingPos(cid),21)
		return false
		
		elseif getPlayerStorageValue(cid, configuration.storage) == -1 then
		doPlayerSendTextMessage(cid, 27, "You entered an area of regeneration of Stamina. In 10 seconds you regenerate 60 minutes of Stamina.")
		setPlayerStorageValue(cid,configuration.storage,0)
		stam = addEvent(doPlayerAddStamina, configuration.time, cid, configuration.stamina)
		effect = addEvent(doSendMagicEffect, configuration.time, getThingPos(cid),12)
		return false
	end
end

function onStepOut(cid, item, position, fromPosition)
	doPlayerSendTextMessage(cid, 27, "You failed to regenerate stamina.")
	setPlayerStorageValue(cid,configuration.storage,-1)
	stopEvent(stam)
	stopEvent(effect)
end

  • Não esqueça de colocar os ids no mapa.
  • Para regenerar mana novamente é necessário sair e entrar novamente no piso.

Não sei se esta funcionando 100%! Mais acho que isso deve funcionar, apesar de ser umas das minhas primeiras funções em lua. Qualquer erro só avisar ;)

Editado Setembro 26 por LekoDS

Nu77N
26 de setembro de 2013 às 00:34

LekoDS dei uma resumida no seu script, obs: não testei ele!!

 

STAMINA_MESSAGE = "TEXTO AQUI"
STAMINA_TIME = 3 * 1000
STAMINA_EFFECT = 12
STAMINA_ADD = 60

function event(cid, time, loop)
doPlayerSendTextMessage(cid, 27, STAMINA_MESSAGE)
doPlayerAddStamina(cid, STAMINA_TIME, STAMINA_ADD)
doSendMagicEffect(cid, getThingPos(cid), STAMINA_EFFECT)
     if loop == true then
          event_x = addEvent(event, STAMINA_TIME, cid, true)
     end
end

function onStepIn(cid, item, position, fromPosition)
     if not isPlayer(cid) then
          return false
     end
     event_x = addEvent(event, STAMINA_TIME, cid, true)
     return true
end

function onStepOut(cid, item, position, fromPosition)
     doPlayerSendTextMessage(cid, 27, "You failed to regenerate stamina.")
     stopEvent(event_x)
     return true
end

Editado Setembro 26 por SUJA

luccagomesL
26 de setembro de 2013 às 01:18

Dei +rep pros dois, mas ali é o lugar de treino se a mana n subir n adianta =\

LekoDSL
26 de setembro de 2013 às 10:50

Eu refiz aqui o Script, tentei colocar algumas coisas novas:

  • Adicionado a Regeneração de Mana.
  • Adicionado edição do tempo no configuration.
  • Adicionei o teleport novamente para o tile, pela logica isso faria o tempo 'resetar' sem sair do local, porem isso não funcionou por getThingPos(cid), então se não funcionar ai você troca onde esta tp no tele = por tp2 com a posição do tile. Lembrando que isso da uma prejudicada de apenas usar 1 script por tile.
-- Script by LekoDS
local configuration = {
storage = 263696, -- storage
loltime = 1 * 1000, -- tempo
timedisplay = "10 seconds", -- tempo em texto
stamina = 60, -- minutos ganhos de Stamina
mana = 1, -- mana dada
tp = {x =32335, y = 32428, z = 7}, -- pos
tp2 = getThingPos(cid), -- pos atual
}

function onStepIn(cid, item, position, fromPosition)
	if (isPlayer(cid)) == false then
		elseif getPlayerStorageValue(cid, configuration.storage) == -1 then
		doPlayerSendTextMessage(cid, 27, "You entered an area of regeneration of Stamina. In ".. configuration.timedisplay .." seconds you regenerate 60 minutes of Stamina.")
		setPlayerStorageValue(cid,configuration.storage,0)
		stam = addEvent(doPlayerAddStamina, configuration.time, cid, configuration.stamina)
		effect = addEvent(doSendMagicEffect, configuration.time, getThingPos(cid),12)
		manaef = addEvent(doCreatureAddMana, configuration.time, cid, configuration.mana)
		tele = addEvent(doTeleportThing, configuration.time, cid, configuration.tp2)
		return false
		
		elseif getPlayerStorageValue(cid, configuration.storage) >= 0 then
		stam = doPlayerSendTextMessage(cid, 27, "You're regenerating mana and stamina again! At ".. configuration.timedisplay .." you received a new load.")
		effect = addEvent(doPlayerAddExp, configuration.time, cid, 10)
		addEvent(doSendMagicEffect, configuration.time, getThingPos(cid),21)
		manaef = addEvent(doCreatureAddMana, configuration.time, cid, configuration.mana)
		tele = addEvent(doTeleportThing, configuration.time, cid, configuration.tp2)
		return false		
	end
end

function onStepOut(cid, item, position, fromPosition)
	doPlayerSendTextMessage(cid, 27, "You failed to regenerate stamina.")
	setPlayerStorageValue(cid,configuration.storage,-1)
	stopEvent(stam)
	stopEvent(effect)
	stopEvent(manaef)
	stopEvent(tele)
end

luccagomesL
26 de setembro de 2013 às 12:30

To no limite dos +reps, qnd puder te dou +, pag adicionada aos favoritos, mas ai deixa a msm storage, n vai bugar né, só muda ali onde ta tp os lugares as poisções de treino né?

 

Pra simplificar n tinha um jeito de eu colocar de uma ponta do mapa a outra ponta ou tipo um script com varias pos?

 

Por enquanto eu vou botar assim, mas dizem q qnd tem mt script n é bom

Editado Setembro 26 por luccagomes

luccagomesL
30 de setembro de 2013 às 22:21

Saiu meu limite, te dei os reps, n tem como fazer um script pra eu colocar varios ou simplificar, pq são 150 tiles de treinamento, 150 scripts vai ficar mt puxado pro sv

3 meses depois...
OmegaO
05 de dezembro de 2013 às 22:45

Tópico movido para a seção de dúvidas e pedidos resolvidos.

O tópico foi fechado e movido para lixeira por estar inativo a mais de 30 dias. Caso seja preciso reabrir o mesmo, favor entrar em contato com a equipe.