Ola a todos, venho lhes trazer um script criado por mim recentemente.
Quem ja jogou Pokemon de GB,GBA etc sabe qual a função do Repel e o quanto ele é importante.
O Script é divido em 2 partes, O Repel ( Que é uma potion ) e um script de Movements que vou explicar a função logo abaixo.
Algumas informações sobre como ele funciona.
<~~ Se o Player não estiver sobre o efeito do Repel ~~>
A Parte do Movements é executada toda vez que um player passa por cima de um dos tiles registrado no script.
Isso executara uma função Random de 1, 80 e se der 80 invocara um Pokemon.
O elemento do Pokemon depende do tile em que pisou, alem do Pokemon a ser invocado tbm ser Random.
<~~ Se o Player estiver sobre o efeito do Repel ~~>
Nenhum Pokemon sera invocado ao passar em cima do tile.
O player recebera informações de quantos passos lhe resta para acabar o efeito do Repel.
<~~ O Repel ~~>
Basicamente soh serve para adicionar a storage.
Então vamos la :
.
<~~ Repel ~~>
Actions/Scripts/Repel.lua
function onUse(cid, item, frompos, item2, topos) if item2.uid ~= cid then return doPlayerSendCancel(cid, "You can use repel only on you!") end if getPlayerStorageValue(cid, 512110) >= 0 then return doPlayerSendCancel(cid, "You're still on the effect of repel!") end setPlayerStorageValue(cid, 512110, 0) doSendMagicEffect(frompos, 12) doSendAnimatedText(frompos, "REPEL!", 180) end
Actions.xml
<action itemid=" ID DA POTION QUE DESEJA " event="script" value="repel.lua"/>
<~~ Parte do Movements ~~>
Movements/Scripts/Respaw.lua
local GRAMS = { [1] = {"Victreebel s"}, [2] = {"Weepinbell s"}, [3] = {"Bulbasaur s"}, [4] = {"Ivysaur s"}, [5] = {"Venusaur s"}, [6] = {"Tangela s"}, [7] = {"Gloom s"}, [8] = {"Caterpie s"}, [9] = {"Metapod s"}, [10] = {"Butterfree s"}, [11] = {"Weedle s"}, [12] = {"Kakuna s"}, [13] = {"Beedrill s"} } local STONES = { [1] = {"Geodude s"}, [2] = {"Graveler s"}, [3] = {"Rhyhorn s"}, [4] = {"Onix s"}, [5] = {"Golem s"}, [6] = {"Rhydon s"} } local storage = 512110 local steps = 100 function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor) if not isPlayer(cid) then return true end stepleft = getPlayerStorageValue(cid,storage) left = steps - stepleft if stepleft <= steps and stepleft >= 0 then setPlayerStorageValue(cid,storage,stepleft+1) doPlayerSendTextMessage(cid,27, "You have " .. left .. " steps!." ) elseif stepleft >= steps then setPlayerStorageValue(cid,storage,-1) doPlayerSendTextMessage(cid,27, "The effect of elixir ended!." ) return true end if getPlayerStorageValue(cid, 512110) < 0 then Randow = math.random(1, 80) if Randow == 80 then -- GRAMS TILE if isInArray({'4536', '4534', '4531', '4530', '4553', '4526', '4532'}, getTileThingByPos(fromPosition).itemid) then doSendMagicEffect(fromPosition, 173) r = math.random(1, #GRAMS) doCreateMonster(GRAMS[r][1], fromPosition) doPlayerSendTextMessage(cid,27, "A "..GRAMS[r][1].." has just appeared!." ) -- STONES TILE elseif isInArray({'4575', '4570', '4578', '4576', '4572', '4573', '4577'}, getTileThingByPos(fromPosition).itemid) then doSendMagicEffect(fromPosition, 173) r = math.random(1, #STONES) doCreateMonster(STONES[r][1], fromPosition) doPlayerSendTextMessage(cid,27, "A "..STONES[r][1].." has just appeared!." ) end end end return true end
Movements.xml
<movevent type="StepOut" <movevent type="StepOut" itemid="103;4536;4534;4531;4530;4553;4526;4532;4575;4570;4578;4576;4572;4573;4577" event="script" value="respaw.lua"/>
Um Video para ficar + facil de entender a função dele...