BE

[Pedido] Scrip - Muito Complexo!

Por beddy, 11 de abr. de 2012 em Scripts

scrip complexo
tibia
script
otserv
31
3.5k
beddyB
12 de abril de 2012 às 00:18

Sim, por isso o vodkart ja me passou a DP... só estou a espera do resto do script.. ;D

VodkartV
12 de abril de 2012 às 08:45

@max

dá sim, mas como eu já tinha essas funções e vi que dava para ser usado resolvi usar elas

 

@beddy

sai ontem cedo,quero saber o seguinte

todo level que ele upar ele vai ganhar 5 points? ou são determinados leveis, por exemplo: level 30,50,70 etc...

beddyB
12 de abril de 2012 às 09:08

Todo level ele vai ganhar 5 POINTS..

VodkartV
12 de abril de 2012 às 09:43

creaturescript/script

 

advpoints.lua

			 function onAdvance(cid, skill, oldlevel, newlevel)
		 local config = {
		  repeatAfterDeath = false,
		  points = 5,
		  storage = 14005
		  }  
		 if skill ~= SKILL__LEVEL or (not config.repeatAfterDeath and getPlayerStorageValue(cid, config.storage) >= newlevel) then
		 return true
		 end
		 doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You have just advanced to level '..newlevel..' and recivied '..config.points..' points!')
		 addPoints(cid, config.points)
		 setPlayerStorageValue(cid, config.storage, newlevel)
		 return true
		 end

 

creaturescript.xml

<event type="advance" name="AdvPoints" event="script" value="advpoints.lua"/>

 

creaturescript/script/login.lua adc

registerCreatureEvent(cid, "AdvPoints")

 

 

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

 

talkactions/script

 

systempoints.lua

function onSay(cid, words, param)
if(words == "!points") then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você tem "..getPoints(cid).." Points.")
elseif(words == "/addpoints") then  
if getPlayerAccess(cid) == 5 then
local t = string.explode(param, ",")  
if not t[1] or not t[2] then  return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")  end  
local player = getPlayerByName(t[1])  
local points = t[2]  
local pid = getPlayerByNameWildcard(t[1])  
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then  
return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")  end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "você adicionou "..points.." Points do jogador "..t[1])  
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Foram adicionados "..points.." Points no seu character.")  
addPoints(player,points)
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Você agora tem "..getPoints(player).." Points.")  
end
elseif(words == "/delpoints") then
if getPlayerAccess(cid) == 5 then
local t = string.explode(param, ",")  
if not t[1] or not t[2] then  return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")  end  
local player = getPlayerByName(t[1])  
local points = t[2]  
local pid = getPlayerByNameWildcard(t[1])  
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then  
return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")  end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "você removeu "..points.." Points do jogador "..t[1])  
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Foram removidos "..points.." Points do seu character.")  
removePoints(player,points)
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Você agora tem "..getPoints(player).." Points.")  
end
elseif(words == "/setpoints") then
if getPlayerAccess(cid) == 5 then
local t = string.explode(param, ",")  
if not t[1] or not t[2] then  return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")  end  
local player = getPlayerByName(t[1])  
local points = t[2]  
local pid = getPlayerByNameWildcard(t[1])  
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then  
return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")  end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Agora o jogador "..t[1].." tem "..points.." Points no seu character.")  
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "agora você tem "..points.." Points do seu character.")  
setPoints(player,points)
end
end
return TRUE
end

 

tag

<talkaction words="!points;/addpoints;/delpoints;/setpoints" script="systempoints.lua"/>

 

comando player:

 

!points

 

comando god:

 

/addpoints NOME,POINTS

/delpoints NOME,POINTS

/setpoints NOME,POINTS

Editado Abril 12 por Vodkart

beddyB
12 de abril de 2012 às 10:00

EU TE AMO! *_* , posso te abusar só + um poquinho?

 

Como faz o npc qe vende Life e Mana por estes points?

 

 

 

ESTAREI TE DANDO REPS QUANDO LOGAR SEMPRE QUE DER. OBRIGADO!

Editado Abril 12 por beddy

VodkartV
12 de abril de 2012 às 10:07

ah é, esqueci.

estou meio ocupado agora porque to no trampo, mas vou te ensinar:

 

local cost = 10
if  getPoints(cid) >= cost then
function que add hp
removePoints(cid,cost)
msg que diz q compro o hp
else
msg q vai dizer se ele n tiver points
end

beddyB
12 de abril de 2012 às 10:47

Tentei isso, só que nao deu.. tem como consertar?

 

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
local cost = 3
local health = 10 --- QNT DE LIFE
local mana = 10 -- QNT DE MANA
if msgcontains(msg, "Life") - 1 then
if  getPoints(cid) >= cost then
doCreatureAddHealth(cid, health)
removePoints(cid,cost)
msg Voce comprou 10 de LIFE.
 else
msg Você não tem POINTS o suficiente.
end
if msgcontains(msg, "Life") - 1 then
if  getPoints(cid) >= cost then
doCreatureAddMana(cid, mana)
removePoints(cid,cost)
msg Voce comprou 10 de MANA.
 else
msg Você não tem POINTS o suficiente.
end

VodkartV
12 de abril de 2012 às 12:42

Vamos fazer a coisa certa, no npc ele vai comprar HP certo?

se ele tem 1000 de hp e compra 500 ele vai ficar com 1500, é isso? (o 500 é um exemplo)

Vai poder comprar quantas vezes?

MaXwEllDeNM
12 de abril de 2012 às 14:38

Olha como ficou o que eu fiz:

1fg3dg.png

 

Se eu morrer, e upar denovo não ganherei os points denovo, só ganho os points uma vez quando upo...

Editado Abril 12 por MaXwEllDeN

SkyDangerousS
12 de abril de 2012 às 14:41

max você vai disponibilizar.

 

se não vou, irei fazer um e disponibilizar :p

MaXwEllDeNM
12 de abril de 2012 às 14:51

Acho que esse eu vou Sky.

VodkartV
12 de abril de 2012 às 15:00

Olha como ficou o que eu fiz:

1fg3dg.png

 

Se eu morrer, e upar denovo não ganherei os points denovo, só ganho os points uma vez quando upo...

 

Ficou show de bola man!

Mas o meu tbm se ele morrer ele não ganha de novo '-'

beddyB
12 de abril de 2012 às 18:53

VODKART, eu vou poder comprar quantas vezes eu quiser...

pelo amor de deus, me ajuda again!

VodkartV
12 de abril de 2012 às 19:23
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
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local life,mana = {points = 5,Hp = 10},{points = 5,mn = 15}
if (msgcontains(msg, 'life') or msgcontains(msg, 'life'))then
npcHandler:say("Você quer comprar "..life.Hp.." Ponts de Hp por "..life.points.." points? {yes}", cid)
talkState[talkUser] = 1
elseif (msgcontains(msg, 'mana') or msgcontains(msg, 'MANA'))then
npcHandler:say("Você quer comprar "..mana.mn.." Pontos de mana por "..mana.points.." points ? {yes}", cid)
talkState[talkUser] = 2
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
if getPoints(cid) >= life.points then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+life.Hp)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
removePoints(cid, life.points)
npcHandler:say("Parabéns, você recebeu "..life.Hp.." Ponts de Hp!", cid)
talkState[talkUser] = 0
else
npcHandler:say("Desculpe, mas você você não tem "..life.points.." points!", cid)
talkState[talkUser] = 0
end
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
if getPoints(cid) >= mana.points then
setCreatureMaxMana(cid, getCreatureMaxMana(cid)+mana.mn)
doCreatureAddMana(cid, getCreatureMaxMana(cid))
removePoints(cid, mana.points)
npcHandler:say("Parabéns, você recebeu "..mana.mn.." Pontos de Mana!", cid)
talkState[talkUser] = 0
else
npcHandler:say("Desculpe, mas você você não tem "..mana.points.." points!", cid)
talkState[talkUser] = 0
end
elseif msg == "no" then  
selfSay("Then not", cid)  
talkState[talkUser] = 0  
npcHandler:releaseFocus(cid)  
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

beddyB
12 de abril de 2012 às 19:27

RESOLVIDO - REPORTADO

Editado Abril 12 por beddy