SK

[Creaturescript] Presentes (Igual Global Wars)

Por SkyDangerous, 13 de dez. de 2011 em Globalevents e Spells

script
11
2.1k
SkyDangerousS
13 de dezembro de 2011 às 23:32

Sem fazer nada, achei interessante essa coisa de presente lá no global wars, resolvi fazer um bem básico só para testar, fazia muito tempo que não postava nada mesmo.

 

Crie um arquivo na pasta creaturescript/scripts com nome de presentes.lua

function onAdvance(cid, skill, oldLevel, newLevel)
if getPlayerStorageValue(cid, 99963) < 1 and getPlayerLevel(cid) >= 19 then
doPlayerAddLevel(cid,30)
setPlayerStorageValue(cid, 99963, 1)
doPlayerSendTextMessage(cid,22,"Voce recebeu 30 leveis de presente")
return 1
end

if getPlayerStorageValue(cid, 99962) < 2 and getPlayerLevel(cid) >= 70 then
doPlayerAddItem(cid,2160,2)
setPlayerStorageValue(cid, 99962, 2)
doPlayerSendTextMessage(cid,22,"Voce recebeu 20k de dinheiro")
return 1
end

if getPlayerStorageValue(cid, 99961) < 3 and getPlayerLevel(cid) >= 125 then
doPlayerAddItem(cid,2160,10)
setPlayerStorageValue(cid, 99961,3)
doPlayerSendTextMessage(cid,22,"Voce recebeu 100k de dinheiro")
return 1
end

if getPlayerStorageValue(cid, 99960) < 4 and getPlayerLevel(cid) >= 200 then
doPlayerAddItem(cid,2160,20)
setPlayerStorageValue(cid, 99960,4)
doPlayerSendTextMessage(cid,22,"Voce recebeu 200k de dinheiro")
return 1
end
return TRUE
end

 

depois na creaturescript.xml coloque a tag.

<event type="advance" name="presente" event="script" value="presentes.lua"/>

 

logo em seguida registra o evento no login.lua

registerCreatureEvent(cid, "presente")

 

Depois, só rodar e seja feliz ;D

Altere do seu jeito ;D

Editado Dezembro 14 por SkyDangerous

MapperTibianoM
13 de dezembro de 2011 às 23:45

Muitoo Bomm !! REP +

13 de dezembro de 2011 às 23:54

muinto bom, tenho um feito aqui parecido

mias esse ai ta legal

Editado Dezembro 13 por PauloBriiito

SkyDangerousS
14 de dezembro de 2011 às 00:00

Existe alguns scripts parecido.

Porém esse eu fiz com ideia do servidor global wars.

hanskeredH
14 de dezembro de 2011 às 00:08

Bom pra quem não tem. Foi um bom script, mas eu já tenho aqui :X pra quem não tem no server, depende muito também dos XP's. se for global, poe item suave xD se não perde a graça :I

enfim, mais uma vez o SkyDangerous aí ajudando a galera. REP+

14 de dezembro de 2011 às 06:18

Ta errado o script. Digamos que ele vá para o level 125, fique com o storage 3 e morra ate voltar ao level 69. Ai ele chega ao 70 e ganha a recompensa de novo.

 

O certo seria:

 

 

function onAdvance(cid, skill, oldLevel, newLevel)
if getPlayerStorageValue(cid, 99963) < 1 and getPlayerLevel(cid) >= 19 then
doPlayerAddLevel(cid,30)
setPlayerStorageValue(cid, 99963, 1)
doPlayerSendTextMessage(cid,22,"Voce recebeu 30 leveis de presente")
return 1
end

if getPlayerStorageValue(cid, 99962) < 2 and getPlayerLevel(cid) >= 70 then
doPlayerAddItem(cid,2160,2)
setPlayerStorageValue(cid, 99962, 2)
doPlayerSendTextMessage(cid,22,"Voce recebeu 20k de dinheiro")
return 1
end

if getPlayerStorageValue(cid, 99961) < 3 and getPlayerLevel(cid) >= 125 then
doPlayerAddItem(cid,2160,10)
setPlayerStorageValue(cid, 99961,3)
doPlayerSendTextMessage(cid,22,"Voce recebeu 100k de dinheiro")
return 1
end

if getPlayerStorageValue(cid, 99960) < 4 and getPlayerLevel(cid) >= 200 then
doPlayerAddItem(cid,2160,20)
setPlayerStorageValue(cid, 99960,4)
doPlayerSendTextMessage(cid,22,"Voce recebeu 200k de dinheiro")
return 1
end
return TRUE
end

 

Trocar o sinal de ~= por <. Até.

SkyDangerousS
14 de dezembro de 2011 às 13:30

Opa ..

Malz , vou modificar lá. vlw !

VincV
15 de dezembro de 2011 às 13:55

@SkyDangerous

algumas dicas

1º n é nessesario 4 storages

2º ponha "if skill == SKILL__LEVEL then" pra,n fica checando toda ves que o player ganha um skill ou ml

3º nesse caso melhor usa "newlevel" do que usa getplayerlevel(obs: se for usa essa parte tenque usa o if acima)

Editado Dezembro 15 por lordbug99

15 de dezembro de 2011 às 15:01

nossa, eu achei que vc tivesse usado o mesmo storage, por isso eu corrigi o seu script, mas se for usar 4 storages, pode usar o sinal de ~= sim.

 

mas o mais aconselhável é usar só 1 storage.

SkyDangerousS
15 de dezembro de 2011 às 15:11

uauha.

beleza !

 

vou modificar-lo jaja quando tiver tempo .D

2 semanas depois...
ThalesGodoiT
27 de dezembro de 2011 às 13:11

quando o player atinge lvl 19 ele pula para lvl 629 e no console da um erro overflow algo assim

oque será?