Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Eae Galera do Tk bom muito vem pedido pra postar fly System pra tfs 0.4, bom então vamos lá

Comandos: !fly, fly up, fly down

obs: nos scripts não alterei nada só fiz pegar o do meu tópico antigo e postar aqui

Testado em rev 3777

Spoiler

 

 

 

 

Vá em Data/lib e Crie um Arquivo Chamando 075-fly.lua e Cole Isso Dentro

Spoiler

FLY_STORAGE = getConfigValue("flyStorage")

flyBlackSQM = false
nonFlyableBorder = {7576, 7577}
changeSpeed = true
flySpeed = 800
waterSpeed = 150

ITEM_FLYTILE = 460
ITEM_WATERTILE = 4625
FLY_OUTFIT = {lookType = 239, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
WATER = {4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619}

RANGEX = 1
RANGEY = 1 

ret =
{
"You are now flying.",
"You are not flying anymore.",
"You cannot stop flying here.",
"You are not flying.",
"You cannot up here.",
"You cannot down here.",
"You cannot go to there."
}

storPos = {x = 1200, y = 1201, z = 1202}

function isWalkable(pos, creature, proj, pz)
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end

function getAreaToRemove(pos1, pos2)
local t = getDirectionTo(pos1, pos2)
local pos =
{
[0] =
{
{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z},
{x = pos1.x, y = pos1.y + 1, z = pos1.z},
{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z}
},
[2] =
{
{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z},
{x = pos1.x, y = pos1.y - 1, z = pos1.z},
{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z}
},
[1] =
{
{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z},
{x = pos1.x - 1, y = pos1.y, z = pos1.z},
{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z}
},
[3] =
{
{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z},
{x = pos1.x + 1, y = pos1.y, z = pos1.z},
{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z}
},
[7] =
{
{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z},
{x = pos1.x - 1, y = pos1.y, z = pos1.z},
{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z},
{x = pos1.x, y = pos1.y + 1, z = pos1.z},
{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z}
},
[6] = 
{
{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z},
{x = pos1.x + 1, y = pos1.y, z = pos1.z},
{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z},
{x = pos1.x, y = pos1.y + 1, z = pos1.z},
{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z}
},
[5] =
{
{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z},
{x = pos1.x - 1, y = pos1.y, z = pos1.z},
{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z},
{x = pos1.x, y = pos1.y - 1, z = pos1.z},
{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z}
},
[4] =
{
{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z},
{x = pos1.x, y = pos1.y - 1, z = pos1.z},
{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z},
{x = pos1.x + 1, y = pos1.y, z = pos1.z},
{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z}
}
}
return pos[t]
end

function doCreateTile(pos)
doAreaCombatHealth(0, 0, pos, 0, 0, 0, 255)
end

 

Agora Vá em Data/Talkactions e Crie Um Arquivo Chamado fly.lua e Cole Isso Dentro

 

Spoiler

function onSay(cid, words, param)

local pos = getCreaturePosition(cid)
pos.stackpos = 0

if(words == "!fly") then
if getCreatureStorage(cid, FLY_STORAGE) > 0 then
if not isWalkable(getCreaturePosition(cid)) or getThingFromPos(pos).itemid == ITEM_FLYTILE or getThingFromPos(pos).itemid == ITEM_WATERTILE then
doPlayerSendCancel(cid, ret[3])
return true
end
doChangeSpeed(cid, -getCreatureSpeed(cid) + getCreatureBaseSpeed(cid))
doCreatureSetStorage(cid, FLY_STORAGE, 0)
doRemoveCondition(cid, CONDITION_OUTFIT)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ret[2])
return true
else
doCreatureSetStorage(cid, FLY_STORAGE, 1)
doRemoveConditions(cid, true)
doSetCreatureOutfit(cid, FLY_OUTFIT, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ret[1])
if changeSpeed then
doChangeSpeed(cid, flySpeed)
end
return true
end
elseif(words == "fly") then
if param == "up" then

pos.z = pos.z - 1
doCreateTile(pos)
if getCreatureStorage(cid, FLY_STORAGE) < 1 then
doPlayerSendCancel(cid, ret[4])
return true
end
if(getCreaturePosition(cid).z == 0) or (getThingFromPos(pos).itemid ~= ITEM_FLYTILE and getThingFromPos(pos).itemid > 0) or (getTileInfo(pos).house) then
doPlayerSendCancel(cid, ret[5])
return true
end
local tpos = pos
tpos.stackpos = 253
if isCreature(getThingFromPos(tpos).uid) then
doPlayerSendCancel(cid, ret[5])
return true
end

local toCreate = {}
for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) do
doCreateTile(area)
local thing = getThingFromPos(area)
if thing.itemid < 1 then
table.insert(toCreate, area)
end
end
if getThingFromPos(pos).itemid < 1 then
for _, create in ipairs(toCreate) do
create.stackpos = 0
doCreateItem(ITEM_FLYTILE, 1, create)
end
doTeleportThing(cid, pos)
if changeSpeed then
doChangeSpeed(cid, flySpeed)
end
pos.z = pos.z + 1
doSendMagicEffect(pos, CONST_ME_BLOCKHIT)
for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) do
doCreateTile(area)
local thing = getThingFromPos(area)
if thing.itemid == ITEM_FLYTILE then
doRemoveItem(thing.uid)
elseif thing.itemid == ITEM_WATERTILE then
doTransformItem(thing.uid, WATER[1])
end
end
else
doPlayerSendCancel(cid, ret[7])
end

elseif param == "down" then

pos.z = pos.z + 1
doCreateTile(pos)
if getCreatureStorage(cid, FLY_STORAGE) < 1 then
doPlayerSendCancel(cid, ret[4])
return true
end
if getCreaturePosition(cid).z == 14 then
doPlayerSendCancel(cid, ret[6])
return true
end
if(getTileInfo(pos).house) then
doPlayerSendCancel(cid, ret[6])
return true
end
local cpos = getCreaturePosition(cid)
cpos.stackpos = 0
if getThingFromPos(cpos).itemid ~= ITEM_FLYTILE then
doPlayerSendCancel(cid, ret[6])
return true
end
local tpos = pos
tpos.stackpos = 253
if isCreature(getThingFromPos(tpos).uid) then
doPlayerSendCancel(cid, ret[6])
return true
end

local toCreate = {}
for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) do
doCreateTile(area) 
local thing = getThingFromPos(area)
if(thing.itemid < 1 or isInArray(WATER, thing.itemid)) then
table.insert(toCreate, area) 
end
end

local x = false
if isWalkable(pos) or getThingFromPos(pos).itemid < 1 or isInArray(WATER, getThingFromPos(pos).itemid) then
for _, create in ipairs(toCreate) do
if isInArray(WATER, getThingFromPos(create).itemid) then
doTransformItem(getThingFromPos(create).uid, ITEM_WATERTILE)
x = (create.z == pos.z and true or false)
else
doCreateItem(ITEM_FLYTILE, 1, create)
end
end
doTeleportThing(cid, pos)
doSendMagicEffect(pos, (x and CONST_ME_WATERSPLASH or getThingFromPos(pos).itemid == ITEM_WATERTILE and CONST_ME_WATERSPLASH or CONST_ME_NONE))
if changeSpeed then
doChangeSpeed(cid, (x and (-getCreatureSpeed(cid) + waterSpeed + getCreatureBaseSpeed(cid)) or (-getCreatureSpeed(cid) + flySpeed + getCreatureBaseSpeed(cid))))
end
pos.z = pos.z - 1
doSendMagicEffect(pos, CONST_ME_BLOCKHIT)
for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) do
local thing = getThingFromPos(area)
if thing.itemid == ITEM_FLYTILE then
doRemoveItem(thing.uid)
end
end
else
doPlayerSendCancel(cid, ret[7])
end
end
end
return true
end

 

Agora Vá em Data/Movements/Scripts e Crie um Arquivo Chamado fly.lua e Cole Isso Dentro

 

Spoiler

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)


if isInArray({ITEM_FLYTILE, ITEM_WATERTILE}, item.itemid) then

if not isPlayer(cid) then
doTeleportThing(cid, fromPosition)
return true
end
if getCreatureStorage(cid, FLY_STORAGE) < 1 then
doPlayerSendCancel(cid, ret[4])
doTeleportThing(cid, fromPosition)
return true
end 

local toPos = toPosition
toPos.stackpos = 0
if not flyBlackSQM then
toPos.z = 7
doCreateTile(toPos)
if getThingFromPos(toPos).itemid < 1 or getThingFromPos(toPos).itemid == ITEM_FLYTILE then
doTeleportThing(cid, fromPosition)
return true
end
toPos.z = toPosition.z
end

if(getTileInfo(toPos).house) then
doTeleportThing(cid, fromPosition)
return true
end

if nonFlyableBorder and type(nonFlyableBorder) == "table" then
for i = toPos.z, 14 do
toPos.z = i
toPos.stackpos = 1
doCreateTile(toPos)
if isInArray(nonFlyableBorder, getThingFromPos(toPos).itemid) then
doTeleportThing(cid, fromPosition)
return true
end
end
toPos.z = getCreaturePosition(cid).z
toPos.stackpos = 0
end
for _, area in ipairs(getArea(toPos, RANGEX, RANGEY)) do
doCreateTile(area)
local thing = getThingFromPos(area)
if thing.itemid < 1 or thing.itemid == ITEM_FLYTILE then
doCreateItem(ITEM_FLYTILE, 1, area)
elseif thing.itemid == ITEM_WATERTILE or isInArray(WATER, thing.itemid) then
doTransformItem(thing.uid, ITEM_WATERTILE)
end
end
end
return true
end

function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)

local area = getAreaToRemove(fromPosition, toPosition)
for _, arear in ipairs(area) do
doCreateTile(arear)
local thing = getThingFromPos(arear)
if thing.itemid == ITEM_FLYTILE then
doRemoveItem(thing.uid)
elseif thing.itemid == ITEM_WATERTILE then
doTransformItem(thing.uid, WATER[1])
end
end
return true
end 

 

feito Isso Vá em Data/creaturescripts/scripts/ e vá no login.lua e coloque essa Função

 

Spoiler

function onLogin(cid)

if getCreatureStorage(cid, FLY_STORAGE) > 0 then
local storpos = {x = getCreatureStorage(cid, storPos.x), y = getCreatureStorage(cid, storPos.y), z = getCreatureStorage(cid, storPos.z), stackpos = 0}
doCreateTile(storpos)
local thing = getThingFromPos(storpos)
if thing.itemid < 1 or isInArray(WATER, thing.itemid) then
for _, area in ipairs(getArea(storpos, RANGEX, RANGEY)) do
doCreateTile(area)
local thing = getThingFromPos(area)
if thing.itemid < 1 then
doCreateItem(ITEM_FLYTILE, 1, area)
elseif isInArray(WATER, getThingFromPos(area).itemid) then
doTransformItem(getThingFromPos(area).uid, ITEM_WATERTILE)
end
end
end
doRemoveConditions(cid, true)
doSetCreatureOutfit(cid, FLY_OUTFIT, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You are now flying.")
doTeleportThing(cid, storpos)
return true
end
end

 

e Essa Aqui Tambem

 

Spoiler

registerCreatureEvent(cid, "PlayerLogout")

 

Agora Crie Um Arquivo No CreatureScripts Com O Nome De logout.lua e Cole Isso Dentro

 

Spoiler

function onLogout(cid)

if getCreatureStorage(cid, FLY_STORAGE) > 0 then
local pos = getCreaturePosition(cid)
pos.stackpos = 0
for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) do
doCreateTile(area)
local thing = getThingFromPos(area)
if thing.itemid == ITEM_FLYTILE then
doRemoveItem(thing.uid)
elseif thing.itemid == ITEM_WATERTILE then
doTransformItem(thing.uid, WATER[1])
end
end
doCreatureSetStorage(cid, storPos.x, pos.x)
doCreatureSetStorage(cid, storPos.y, pos.y)
doCreatureSetStorage(cid, storPos.z, pos.z)
end
return true
end

 

Agora Vá no Talkactions.xml e Cole Isso Dentro

 

Spoiler

<talkaction words="!fly;fly" case-sensitive="no" event="script" value="fly.lua"/>

 

Em Seguida Vá no Movements.xml e Cole Isso Dentro

 

Spoiler

<movevent type="StepIn" itemid="460" event="script" value="fly.lua"/>
<movevent type="StepOut" itemid="460" event="script" value="fly.lua"/>
<movevent type="StepIn" itemid="4609-4619" event="script" value="fly.lua"/>
<movevent type="StepIn" itemid="4625" event="script" value="fly.lua"/>

 

Agora em creaturescripts.xml e Cole isso

 

Spoiler

<event type="logout" name="PlayerLogout" event="script" value="logout.lua"/>

 

vá em game.cpp e procure por essa função

Spoiler

bool Game::combatBlockHit(CombatType_t combatType, Creature* attacker, Creature* target,
    int32_t& healthChange, bool checkDefense, bool checkArmor)

 

e em baixo dessa 

Spoiler

default:
        {

 

adicione

Spoiler

            effect = MAGIC_EFFECT_POFF;
                std::string value;
if(target->getStorage(g_config.getNumber(ConfigManager::FLY_STORAGE), value) && atoi(value.c_str()) > 0)
effect = MAGIC_EFFECT_NONE;  
            break;

 

obs: em baixo do default pode haver outro effect, substitua por esse comando de cima.

 

ainda em game.cpp procure por essa função

Spoiler

bool Game::combatChangeHealth(CombatType_t combatType, Creature* attacker, Creature* target, int32_t healthChange,
    MagicEffect_t hitEffect/* = MAGIC_EFFECT_UNKNOWN*/, Color_t hitColor/* = COLOR_UNKNOWN*/, bool force/* = false*/)

 

e em baixo dessa

Spoiler

const SpectatorVec& list = getSpectators(targetPos);
        if(!target->isAttackable() || Combat::canDoCombat(attacker, target) != RET_NOERROR)
        {

Adicione

Spoiler

std::string value;
       MagicEffect_t eff = MAGIC_EFFECT_POFF;
       if(target->getStorage(g_config.getNumber(ConfigManager::FLY_STORAGE), value) && atoi(value.c_str()) > 0)
       eff = MAGIC_EFFECT_NONE;

 

Ainda em game.cpp procure por essa função

Spoiler

bool Game::combatChangeMana(Creature* attacker, Creature* target, int32_t manaChange)

 

e em baixo dessa

Spoiler

const SpectatorVec& list = getSpectators(targetPos);
        if(!target->isAttackable() || Combat::canDoCombat(attacker, target) != RET_NOERROR)
        {

 

Adicione

Spoiler

std::string value;
             MagicEffect_t eff = MAGIC_EFFECT_POFF;
 if(target->getStorage(g_config.getNumber(ConfigManager::FLY_STORAGE), value) && atoi(value.c_str()) > 0)
 eff = MAGIC_EFFECT_NONE;

 

 

agora vá em configmanager.cpp e procure por essa função

Spoiler

m_confBool[ADDONS_PREMIUM] = getGlobalBool("addonsOnlyPremium", true);

 

e abaixo adicione

Spoiler

m_confNumber[FLY_STORAGE] = getGlobalNumber("flyStorage", 0);

 

agora vá em configmanager.h e procure por essa função

Spoiler

HOUSE_CLEAN_OLD,

 

e abaixo adicione

Spoiler

FLY_STORAGE,

 

agora adicione essa storage no config.lua

Spoiler

flyStorage = 65535

 

Creditos:

Otland.net

Darkhaos

 

Gift pra ver o system só clicar

ezgif.com-gif-maker.gif

Editado por Jpn (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Parabéns, seu tópico de conteúdo foi aprovado!
Muito obrigado pela sua contribuição, nós do Tibia King agradecemos.
Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP.

Spoiler

Congratulations, your content has been approved!
Thank you for your contribution, we of Tibia King we are grateful.
Your content will help many other users, you received +1 REP.

 

Bruno de Carvalho Câmara / Administrador TibiaKing

[email protected]


 

btn_donateCC_LG.gif

 

Em 26/12/2016 em 03:47, Spraypaint disse:

A força da alienação vem dessa fragilidade dos indivíduos, quando apenas conseguem identificar o que os separa e não o que os une.

-miltinho

 

wMwSJFE.png?1

 

Link para o post
Compartilhar em outros sites
  • 8 months later...

desculpa reviver o tópico, funcionou corretamente, mas como eu adiciono para cada vocation ter uma outfit:
exemplo: 

Goku - FLY_OUTFIT = {lookType = 239, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}

Vegeta - FLY_OUTFIT = {lookType = 250, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}

Gohan - FLY_OUTFIT = {lookType = 280, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por Muvuka
      Alguem tem anti-nuker igual a esse 
       

       
    • Por Muvuka
      [SQLite] -=[TFS]=- 0.4 8.60 Alguem faz apk mobile pra mim ip: dexsoft.ddns.net
       
      pra mim
       
      https://www.mediafire.com/file/5klqnyy6k7jda0u/OTClientV8.rar/file
       
      TA TUDO AI
    • Por yuriowns
      Salve rapazes, estou precisando de um client próprio para o meu servidor 7.4, preciso que algum programador experiente e com referências faça um client do jeito que eu procuro. Responda aqui para fazermos um orçamento, obrigado!

      Não sei se estou no lugar certo, se não me desculpem e peço que movam por gentileza!
    • Por paulo thush
      Pessoal to com um grande problema, estou com um servidor TFS 1.4x 10.98, recentemente começou dar um problema, sempre quando falava "trade" com o npc dava um erros, com qual quer npc, o erro e o seguinte.
       
       
      me falaram que o problema e nas sourcer que precisava mudar umas coisas me passaram um link no github esse aqui 
      https://github.com/otland/forgottenserver/pull/3996/files
       
      porem eu vi vídeos no youtube ensinando a compilar, já vi muitos tópicos como compilar a sourcer, ai quando vou compilar da esse erro
      já tentei instalar, desinstala muitas coisas, alterar também não vai, minha sourcer e essa 
      https://github.com/otland/forgottenserver
       
       
      Alguém poderia me ajuda com esse erro, ou ate compilar 100% as sourcer. os Tópicos que eu tentei para compilar e esse daqui, se não poder o link me desculpe.
      https://forums.otserv.com.br/index.php?/forums/topic/169234-windowsvc2019-compilando-sources-tfs-14-vcpkg/
       
      alguém me da uma luz por favor kkk
    • Por Ryzek
      Uso tfs 0.4 trunk3884 bem simples.
      Queria acrescentar magic effects para 255 pois o meu só vai até 69. Encontrei um tópico que falava sobre porém parece ter sido removido, não consigo acessar!
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo