CA
pedido

Script Acho Que É Dificil Mais Não Imposivel

Por cacaiu, 07 de set. de 2012 em Scripts

rota predestinada
otserv
script
29
4k
cacaiuC
16 de setembro de 2012 às 23:17

notle2012 ou brun123

 

 

tem como por pra o npc dar outifit, masculino ou feminino nesse script?

 

eu tentei aki mais n deu.

 

 

eu adicionei tbm uma tag assim:

 

 

 

 

local avoidLogout = createConditionObject(CONDITION_INFIGHT, -1 ,1660)

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

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

local config = {

ITEM_REMOVIDO = 2160, -- id do item a ser removido

ITEM_COUNT = 1, -- quantidade do item a ser removido

LOOKTYPE_DA_MOTO = 127, -- outfit da moto, apenas looktype

DELAY_ENTRE_ANDADAS = 200, -- intervalo (em ms) a cada passo que o player dá

VELOCIDADE_EXTRA = 1000, -- velocidade a mais que o player ganha na moto

EMPURRAR_CRIATURAS = true, -- true/false, se true, todos os monstros/players que estiverem no caminho serão empurrados pro lado

ATRAVESSAR_OBSTACULOS = true, -- true/false, se true, vai entrar e passar por dentro de paredes, árvores etc...

POS_INICIAL = {x = 1084, y = 1076, z = 7}, -- onde o player irá ser teleportado ao confirmar a msg do npc

POS_FINAL = {x = 856, y = 520, z = 7},

ROTA_AUTOMATICA = false, -- procura por direções automaticamente, sem precisar configurar as directions

-- porém há grandes chance de encontrar obstáculos/falhar

ROTA_POR_DIRECTION = {EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,SOUTH,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,EAST,} -- apenas se ROTA_AUTOMATICA for false

}

local function getNextDir(cid, playerpos, finalpos)

local result = {}

local xy = 999999

for newDir = 0, 3 do

local p = getPosByDir(playerpos, newDir)

if doTileQueryAdd(cid, p, config.EMPURRAR_CRIATURAS and 4 or 0) == 1 or config.ATRAVESSAR_OBSTACULOS then

local d = math.abs(p.x - finalpos.x) + math.abs(p.y - finalpos.y)

if d < xy then result = {newDir} xy = d

elseif d == xy then table.insert(result, newDir) end

end

end

if #result == 0 then

for newDir = 4, 7 do

local p = getPosByDir(playerpos, newDir)

if doTileQueryAdd(cid, p, config.EMPURRAR_CRIATURAS and 4 or 0) == 1 or config.ATRAVESSAR_OBSTACULOS then

local d = math.abs(p.x - finalpos.x) + math.abs(p.y - finalpos.y)

if d < xy then result = {newDir} xy = d

elseif d == xy then table.insert(result, newDir) end

end

end

return #result == 0 and false or result[math.random(#result)]

else

return result[math.random(#result)]

end

return false

end

 

local function doPlayerFollowRoute(cid, stepId)

if not isCreature(cid) then return true end

if not stepId then

doCreatureSetNoMove(cid, true)

doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)

doChangeSpeed(cid, config.VELOCIDADE_EXTRA)

doSetCreatureOutfit(cid, {lookType = config.LOOKTYPE_DA_MOTO}, -1)

doAddCondition(cid, avoidLogout)

addEvent(doPlayerFollowRoute, config.DELAY_ENTRE_ANDADAS, cid, 1)

return true

end

local begin, finish = getThingPos(cid), (config.ROTA_AUTOMATICA and config.POS_FINAL or {x = -1, y = -1})

if (begin.x == finish.x and begin.y == finish.y) or (not config.ROTA_AUTOMATICA and stepId == #config.ROTA_POR_DIRECTION + 1) then

doPlayerSendCancel(cid, "Destino alcançado!")

doCreatureSetNoMove(cid, false)

doChangeSpeed(cid, -getCreatureSpeed(cid) + getCreatureBaseSpeed(cid))

doRemoveCondition(cid, CONDITION_OUTFIT)

doRemoveCondition(cid, CONDITION_INFIGHT)

return true

end

if getCreatureOutfit(cid).lookType ~= config.LOOKTYPE_DA_MOTO then

doChangeSpeed(cid, -getCreatureSpeed(cid) + getCreatureBaseSpeed(cid))

doCreatureSetNoMove(cid, false)

doRemoveCondition(cid, CONDITION_OUTFIT)

doRemoveCondition(cid, CONDITION_INFIGHT)

return true end

local nextPos = {}

if config.ROTA_AUTOMATICA then

nextPos = getPosByDir(getThingPos(cid), getNextDir(cid, getThingPos(cid), config.POS_FINAL) or getDirectionTo(getThingPos(cid), config.POS_FINAL))

else

nextPos = getPosByDir(getThingPos(cid), config.ROTA_POR_DIRECTION[stepId or 1])

end

if not (doTileQueryAdd(cid, nextPos) == 1 or config.ATRAVESSAR_OBSTACULOS) then

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

doChangeSpeed(cid, -getCreatureSpeed(cid) + getCreatureBaseSpeed(cid))

doRemoveCondition(cid, CONDITION_OUTFIT)

doCreatureSetNoMove(cid, false)

doRemoveCondition(cid, CONDITION_INFIGHT)

return doPlayerSendCancel(cid, "Obstáculo encontrado!")

end

if config.EMPURRAR_CRIATURAS and config.ATRAVESSAR_OBSTACULOS and getTileInfo(nextPos).creatures > 0 then

for pushCreatures = 1, #getTileInfo(nextPos).creatures do

local creature = getTopCreature(nextPos).uid

addEvent(doTeleportThing, 50, creature, getClosestFreeTile(creature, getThingPos(creature)))

end

end

doTeleportThing(cid, nextPos)

addEvent(doPlayerFollowRoute, config.DELAY_ENTRE_ANDADAS, cid, (stepId or 1) + 1)

end

function creatureSayCallback(cid, type, msg)

if msgcontains(msg, 'yes') then

if not doPlayerRemoveItem(cid, config.ITEM_REMOVIDO, config.ITEM_COUNT) then

selfSay("Você não tem 100 Hundread Dollar!")

return true

end

if #getCreatureSummons(cid) > 0 then

selfSay("Você tem que puxa seu Pokemon para Pokebola!")

return false

end

selfSay("OK! você deve abrir o baú, que vai se encontra no topo da montanha.", cid)

doTeleportThing(cid, config.POS_INICIAL, false)

doPlayerFollowRoute(cid)

return true

end

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

 

mais ai ta acontecendo o seguinte: quando o poke ta fora da ball ele fala: Você tem que puxa seu Pokemon para Pokebola! mais ai ele tira a grana do cara sem ele viajar tem como arruma?

Editado Setembro 16 por cacaiu

brun123B
17 de setembro de 2012 às 01:08

essa parte que você mesmo escreveu sobre o summon do player, está certinho, só precisa colocar acima da outra checagem pra que ele não remova o dinheiro do player antes de ver se ele tem summon.

 

só procurar pela frase "destino alcançado" no script, lá você vai adicionando o que quiser que aconteça quando a viagem acabar

notle2012N
17 de setembro de 2012 às 02:01

testa esse

eu adicionei isso

LOOKTYPE_DA_MOTO2 = 504, -- outfit da moto se for female

 

 

local avoidLogout = createConditionObject(CONDITION_INFIGHT, -1 ,1660)
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
local config = {
ITEM_REMOVIDO = 2160, -- id do item a ser removido
ITEM_COUNT = 10, -- quantidade do item a ser removido
LOOKTYPE_DA_MOTO = 127, -- outfit da moto se for male
LOOKTYPE_DA_MOTO2 = 504, -- outfit da moto se for female
DELAY_ENTRE_ANDADAS = 450, -- intervalo (em ms) a cada passo que o player dá
VELOCIDADE_EXTRA = 1000, -- velocidade a mais que o player ganha na moto
EMPURRAR_CRIATURAS = true, -- true/false, se true, todos os monstros/players que estiverem no caminho serão empurrados pro lado
ATRAVESSAR_OBSTACULOS = true, -- true/false, se true, vai entrar e passar por dentro de paredes, árvores etc...
POS_INICIAL = {x = 1058, y = 1065, z = 7}, -- onde o player irá ser teleportado ao confirmar a msg do npc
POS_FINAL = {x = 1009, y = 1065, z = 7},
ROTA_AUTOMATICA = false, -- procura por direções automaticamente, sem precisar configurar as directions
-- porém há grandes chance de encontrar obstáculos/falhar
ROTA_POR_DIRECTION = {WEST,WEST,WEST,WEST,WEST,WEST,WEST,WEST,WEST,WEST,WEST,WEST,WEST,WEST,WEST,WEST,WEST} -- apenas se ROTA_AUTOMATICA for false
}
local function getNextDir(cid, playerpos, finalpos)
local result = {}
local xy = 999999
for newDir = 0, 3 do
local p = getPosByDir(playerpos, newDir)
if doTileQueryAdd(cid, p, config.EMPURRAR_CRIATURAS and 4 or 0) == 1 or config.ATRAVESSAR_OBSTACULOS then
local d = math.abs(p.x - finalpos.x) + math.abs(p.y - finalpos.y)
if d < xy then result = {newDir} xy = d
elseif d == xy then table.insert(result, newDir) end
end
end
if #result == 0 then
for newDir = 4, 7 do
local p = getPosByDir(playerpos, newDir)
if doTileQueryAdd(cid, p, config.EMPURRAR_CRIATURAS and 4 or 0) == 1 or config.ATRAVESSAR_OBSTACULOS then
local d = math.abs(p.x - finalpos.x) + math.abs(p.y - finalpos.y)
if d < xy then result = {newDir} xy = d
elseif d == xy then table.insert(result, newDir) end
end
end
return #result == 0 and false or result[math.random(#result)]
else
return result[math.random(#result)]
end
return false
end									

local function doPlayerFollowRoute(cid, stepId)
if not isCreature(cid) then return true end
if not stepId then
doCreatureSetNoMove(cid, true)
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
doChangeSpeed(cid, config.VELOCIDADE_EXTRA)
if getPlayerSex(cid) == 1 then
doSetCreatureOutfit(cid, {lookType = config.LOOKTYPE_DA_MOTO}, -1)
doAddCondition(cid, avoidLogout)
addEvent(doPlayerFollowRoute, config.DELAY_ENTRE_ANDADAS, cid, 1)
elseif getPlayerSex(cid) == 0 then
doSetCreatureOutfit(cid, {lookType = config.LOOKTYPE_DA_MOTO2}, -1)
doAddCondition(cid, avoidLogout)
addEvent(doPlayerFollowRoute, config.DELAY_ENTRE_ANDADAS, cid, 1)
return true
end
end
local begin, finish = getThingPos(cid), (config.ROTA_AUTOMATICA and config.POS_FINAL or {x = -1, y = -1})
if (begin.x == finish.x and begin.y == finish.y) or (not config.ROTA_AUTOMATICA and stepId == #config.ROTA_POR_DIRECTION + 1) then
doPlayerSendCancel(cid, "Destino alcançado!")
doCreatureSetNoMove(cid, false)
doChangeSpeed(cid, -getCreatureSpeed(cid) + getCreatureBaseSpeed(cid))
doRemoveCondition(cid, CONDITION_OUTFIT)
doRemoveCondition(cid, CONDITION_INFIGHT)
return true
end
if getCreatureOutfit(cid).lookType ~= config.LOOKTYPE_DA_MOTO and getCreatureOutfit(cid).lookType ~= config.LOOKTYPE_DA_MOTO2 then
doChangeSpeed(cid, -getCreatureSpeed(cid) + getCreatureBaseSpeed(cid))
doCreatureSetNoMove(cid, false)
doRemoveCondition(cid, CONDITION_OUTFIT)				 
doRemoveCondition(cid, CONDITION_INFIGHT)
return true end
local nextPos = {}
if config.ROTA_AUTOMATICA then
nextPos = getPosByDir(getThingPos(cid), getNextDir(cid, getThingPos(cid), config.POS_FINAL) or getDirectionTo(getThingPos(cid), config.POS_FINAL))
else
nextPos = getPosByDir(getThingPos(cid), config.ROTA_POR_DIRECTION[stepId or 1])
end
if not (doTileQueryAdd(cid, nextPos) == 1 or config.ATRAVESSAR_OBSTACULOS) then
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doChangeSpeed(cid, -getCreatureSpeed(cid) + getCreatureBaseSpeed(cid))
doRemoveCondition(cid, CONDITION_OUTFIT)
doCreatureSetNoMove(cid, false)
doRemoveCondition(cid, CONDITION_INFIGHT)
return doPlayerSendCancel(cid, "Obstáculo encontrado!")
end
if config.EMPURRAR_CRIATURAS and config.ATRAVESSAR_OBSTACULOS and getTileInfo(nextPos).creatures > 0 then
for pushCreatures = 1, #getTileInfo(nextPos).creatures do
local creature = getTopCreature(nextPos).uid
addEvent(doTeleportThing, 50, creature, getClosestFreeTile(creature, getThingPos(creature)))
end
end
doTeleportThing(cid, nextPos)
addEvent(doPlayerFollowRoute, config.DELAY_ENTRE_ANDADAS, cid, (stepId or 1) + 1)
end
function creatureSayCallback(cid, type, msg)
if #getCreatureSummons(cid) > 0 then
selfSay("Você tem que puxa seu Pokemon para Pokebola!")
return false
end
if msgcontains(msg, 'yes') then
if not doPlayerRemoveItem(cid, config.ITEM_REMOVIDO, config.ITEM_COUNT) then
selfSay("Você não tem o item necessário!")
return true
end
selfSay("OK! boa viajem.", cid)
doTeleportThing(cid, config.POS_INICIAL, false)
doPlayerFollowRoute(cid)
return true
end
end															
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

cacaiuC
18 de setembro de 2012 às 15:12

@ALL

 

testei ele agora.. tem um bug muito chato.

 

quando o player é famale ta normal a velocidade e o caminho q percorre mas...

 

quando é male ta a velociadade o dobro e ele ta andando mais doque eu boteipra ele andar.

 

tem como arruma isso?

 

 

estou usando esse do notle /\

Editado Setembro 18 por cacaiu

MatedM
18 de setembro de 2012 às 23:15

muito bom esse sistema, igual do pxg ne =]

 

mais esse bug do male corre mais e andar mais ta osso alguem arruma aew plix dou rep+

cacaiuC
19 de setembro de 2012 às 14:40

sim mated so precisa arruma esse bug pra fika show

SamueLGuedesS
19 de setembro de 2012 às 14:53

lol eu estava procurando um script desse tomara que arrume os bugs ;]

cacaiuC
19 de setembro de 2012 às 15:29

sim precisamos fala com o brun ou com o notle pra eles nos ajudar

brun123B
19 de setembro de 2012 às 17:52

leia os comments, eles ajudam e podem até resolver sua dúvida...

não testado

 

 

BPiPWuPE[/pastebin]

 

Editado Setembro 19 por brun123

19 de setembro de 2012 às 23:00

cara nada e impossivel para esse brun123 to falando vei esse cara tem poder usei o script no meu server fico certin obg brun123

MatedM
20 de setembro de 2012 às 12:10

brun tu é o cara vei rep+

cacaiuC
20 de setembro de 2012 às 12:12

brun.. vlw msm rep+ pra vc XD

notle2012N
20 de setembro de 2012 às 18:06

Pedido Atendido

Reportado Aqui :D

CriticalC
21 de setembro de 2012 às 17:05

Dúvida sanada, tópico movido.

 

Atenciosamente, Critical.