Dificil alguem ajudar sem ao menos disponibilizar o código e falar com erro que está apresentando.
5
1.9k
26 de novembro de 2019 às 11:52
info
Grupo: Campones
Registrado: 03/01/19
Posts: 10
Reputação: 0
Gênero: Masculino
Char no Tibia: [FS] Ayslan

26 de novembro de 2019 às 20:38
nao da para interagir com o npc nao da erro nem nada apenas não acontece nada
gym.lua
function onDeath(cid, corpse)
doSendMagicEffect(getThingPos(cid), 10)
local npc = ""..getPlayerStorageValue(cid, 201)..""
local turn = getPlayerStorageValue(cid, 202)
local nturn = ((turn) + 1)
local nxt = ginasios[npc][turn].nextp
doCreatureSay(getCreatureByName(npc), ginasios[npc][turn].msgba, 1)
if nxt == "finish" then
local killer = getItemAttribute(corpse.uid, "corpseowner")
addEvent(doCreatureSay, 1200, getCreatureByName(npc), ginasios[npc].msgwin, 1)
setPlayerStorageValue(getCreatureMaster(killer), ginasios[npc].storage, 2)
--local item = getPlayerItemById(killer, true, 2307)
--doTransformItem(item.uid, 2294)
doRemoveCreature(cid)
return false
end
local function summonNext(poke, pos, gym, msg, cid)
local x = doSummonCreature(poke, pos)
addEvent(gymChecker, 1000, x, cid, 0)
doSendMagicEffect(getThingPos(x), 10)
doCreatureSay(getCreatureByName(gym), msg, 1)
end
local killer = getItemAttribute(corpse.uid, "corpseowner")
addEvent(doGymBattle, 1200, npc, ginasios[npc][turn].nextp, killer, nturn)
doRemoveCreature(cid)
return false
end
local fightconditionnn = createConditionObject(CONDITION_INFIGHT)
setConditionParam(fightconditionnn, CONDITION_PARAM_TICKS, 18 * 1000)
function onAttack(cid, target)
if getPlayerStorageValue(getCreatureMaster(target), ginasios[getPlayerStorageValue(cid, 201)].storage) ~= 1 then
doMonsterChangeTarget(cid)
doChangeSpeed(cid, -getCreatureSpeed(cid))
return true
end
if isPlayer(target) then
if #getCreatureSummons(target) == 0 then
doMonsterChangeTarget(cid)
doChangeSpeed(cid, -getCreatureSpeed(cid))
return true
end
if #getCreatureSummons(target) >= 1 then
doMonsterSetTarget(cid, getCreatureSummons(target)[1])
end
end
if getCreatureSpeed(cid) == 0 then
doChangeSpeed(cid, -getCreatureSpeed(cid))
doChangeSpeed(cid, 200)
end
doAddCondition(getCreatureMaster(target), fightconditionnn)
return true
end
function onCast(cid, target)
if isPlayer(target) then
return false
end
local targete = getCreatureTarget(cid)
if isPlayer(getCreatureMaster(targete)) and getPlayerStorageValue(getCreatureMaster(targete), ginasios[getPlayerStorageValue
(cid, 201)].storage) ~= 1 then
return false
end
return true
end
function onDirection(cid, old, current)
if isCreature(getCreatureTarget(cid)) and not isPlayer(getCreatureTarget(cid)) and getPlayerStorageValue(getCreatureMaster
(getCreatureTarget(cid)), ginasios[getPlayerStorageValue(cid, 201)].storage) == 1 then
return true
end
return false
end
gymlib.lua
funcpokemon = {2531, 2652, 2653, 2654, 2195} -- ID das pokebolas (o pokemon tem que estar vivo nessas IDs)
bpslot = CONST_SLOT_BACKPACK --em outros servers, pode ser que seja CONST_SLOT_AMMO o lugar onde fica a backpack no inventory
ginasios = {
["Brock"] = { storage = 990,
msgdefeat = "You lost! You aren't strong enough yet, don't come back until you get stronger!",
msgafk = "Go away if you don't have any pokemons!",
msgwin = "Congratulations, you were strong enough to win this battle fairly! Take this Earth Badge as reward.",
[1] = { msggo = "Lets fight then! I choose you, Golem!",
msgba = "That's enough, Golem!",
pokem = "Brock Golem",
nextp = "Brock Steelix"},
[2] = { msggo = "It's your turn, Steelix!",
msgba = "Come back, Steelix!",
pokem = "Brock Steelix",
nextp = "Brock Sandslash"},
[3] = { msggo = "Crush'em, Sandslash!",
msgba = "You did well, Sandslash!",
pokem = "Brock Sandslash",
nextp = "Brock Rhydon"},
[4] = { msggo = "Crush'em, Rhydon!",
msgba = "You did well, Rhydon!",
pokem = "Brock Rhydon",
nextp = "Brock Cubone"},
[5] = { msggo = "Crush'em, Cubone!",
msgba = "You did well, Cubone!",
pokem = "Brock Cubone",
nextp = "Brock Tyranitar"},
[6] = { msggo = "Crush'em, Tyranitar!",
msgba = "You did well, Tyranitar!",
pokem = "Brock Tyranitar",
nextp = "finish"}
}
}
function noPokeAtAll(cid, gympoke, npcname, msgafk)
if not isCreature(cid) then
return false
end
if not isCreature(gympoke) then
return false
end
if #getCreatureSummons(cid) == 0 and getPlayerStorageValue(cid, 991) == 0 and getPlayerStorageValue(cid, ginasios
[npcname].storage) ~= 2 then
setPlayerStorageValue(cid, 991, -1)
doCreatureSay(getCreatureByName(npcname), msgafk, 1)
doSendMagicEffect(getThingPos(gympoke), 10)
setPlayerStorageValue(cid, ginasios[npcname].storage, 0)
doRemoveCreature(gympoke)
return true
end
end
function gymChecker(cid, duel, nb, npcname)
if not isCreature(cid) then
return true
end
if not isCreature(duel) then
doSendMagicEffect(getThingPos(cid), 10)
doRemoveCreature(cid)
return true
end
if getDistanceBetween(getThingPos(getCreatureByName(npcname)), getThingPos(duel)) >= 8 then
doSendMagicEffect(getThingPos(cid), 10)
doRemoveCreature(cid)
setPlayerStorageValue(duel, ginasios[npcname].storage, 0)
return true
end
if isCreature(duel) and getPlayerStorageValue(duel, 991) == 0 then
addEvent(noPokeAtAll, 6000, duel, cid, npcname, ginasios[npcname].msgafk)
end
if isCreature(duel) and getPlayerStorageValue(duel, 991) == -1 then
doSendMagicEffect(getThingPos(cid), 10)
doRemoveCreature(cid)
setPlayerStorageValue(duel, ginasios[npcname].storage, 0)
doCreatureSay(getCreatureByName(npcname), ginasios[npcname].msgdefeat, 1)
return true
end
if isCreature(duel) and not hasPokemon(duel) then
setPlayerStorageValue(duel, 991, -1)
end
if not isCreature(getCreatureTarget(cid)) then
if nb == 0 then
addEvent(gymChecker, 200, cid, duel, 1, npcname)
else
doSendMagicEffect(getThingPos(cid), 10)
doRemoveCreature(cid)
if isCreature(duel) then
setPlayerStorageValue(duel, ginasios[npcname].storage, 0)
end
end
return true
end
addEvent(gymChecker, 1000, cid, duel, 0, npcname)
end
function hasPokemon(cid)
if #getCreatureSummons(cid) >= 1 then
return true
end
if isInArray(funcpokemon, getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid) then
return true
end
local bp = getPlayerSlotItem(cid, bpslot)
for cc = 1, #funcpokemon do
if #getItemsInContainerById(bp.uid, funcpokemon[cc]) >= 1 then
return true
end
end
return false
end
function doGymBattle(npcname, gympoke, cid, turn)
doCreatureSay(getCreatureByName(npcname), ginasios[npcname][turn].msggo, 1)
local x = doSummonCreature(gympoke, getThingPos(getCreatureByName(npcname)))
registerCreatureEvent(x, "Gym1")
registerCreatureEvent(x, "Gym2")
registerCreatureEvent(x, "Gym3")
registerCreatureEvent(x, "Gym4")
setPlayerStorageValue(x, 201, ".")
setPlayerStorageValue(x, 201, npcname)
setPlayerStorageValue(x, 202, turn)
doSendMagicEffect(getThingPos(x), 10)
setPlayerStorageValue(x, ginasios[npcname].storage, 1)
addEvent(gymChecker, 1000, x, cid, 0, npcname)
end
--ex: doGymBattle("Brock", "Brock Geodude", cid, 1)
em Login.lua adicionei
registerCreatureEvent(cid, "PlayerAttack")
em goback.lua adicionei
local owner = getCreatureMaster(cid)
for x, y in pairs(ginasios) do
if getPlayerStorageValue(owner, y.storage) == 1 then
if getPlayerStorageValue(owner, 991) == 5 or not hasPokemon(owner) then
setPlayerStorageValue(owner, 991, -1)
else
local number = tonumber(getPlayerStorageValue(owner, 991))
setPlayerStorageValue(owner, 991, number + 1)
end
end
end
Brock.lua
local focus = 0
local max_distance = 8
local talk_start = 0
local conv = 0
local fighting = false
local challenger = 0
local afk_limit_time = 300 -- seconds
local afk_time = 0 -- don't change
local battle_turn = 1 -- don't change
local challenger_turn = 0 -- don't change
local pokemons = {
{name = "Brock Golem", optionalLevel = 50, sex = SEX_MALE, nick = "", ball = "great"},
{name = "Brock Steelix", optionalLevel = 50, sex = SEX_MALE, nick = "", ball = "great"},
{name = "Brock Rhydon", optionalLevel = 50, sex = SEX_MALE, nick = "", ball = "great"},
{name = "Brock Sandslash", optionalLevel = 50, sex = SEX_MALE, nick = "", ball = "great"},
{name = "Brock Marowak", optionalLevel = 50, sex = SEX_MALE, nick = "", ball = "great"},
{name = "Brock Tyranitar", optionalLevel = 50, sex = SEX_MALE, nick = "", ball = "great"},
}
local function doSummonGymPokemon(npc)
local this = npc
if not isCreature(this) then return true end
if #getCreatureSummons(this) >= 1 or focus == 0 then return true end
local it = pokemons[battle_turn]
doSummonMonster(this, it.name)
local summon = getCreatureSummons(this)[1]
local balleffect = pokeballs["great"].effect
if it.ball and pokeballs[it.ball] then
balleffect = pokeballs[it.ball].effect
end
doSendMagicEffect(getThingPos(summon), balleffect)
setPlayerStorageValue(summon, 10000, balleffect)
setPlayerStorageValue(summon, 10001, gobackmsgs[math.random(#gobackmsgs)].back:gsub("doka", it.nick ~= "" and it.nick or
it.name))
setPlayerStorageValue(summon, 1007, it.nick ~= "" and it.nick or it.name)
-- doSetMonsterGym(summon, focus)
local name = it.nick ~= "" and it.nick or getCreatureName(this).."s "..it.name
-- setWildPokemonLevel(summon, it.level, getPokemonStatus(it.name, (it.extralevel + it.level)), name, 1.5)
doCreatureSay(this, gobackmsgs[math.random(#gobackmsgs)].go:gsub("doka", getPlayerStorageValue(summon, 1007)), 1)
fighting = true
battle_turn = battle_turn + 1
end
local function doWinDuel(cid, npc)
if not isCreature(cid) then return true end
local this = npc
local a = gymbadges[getCreatureName(this)] + 8
doCreatureSay(npc, "You won the duel! Congratulations, take this "..getItemNameById(a - 8).." as a prize.", 1)
local b = getPlayerItemById(cid, true, a)
if b.uid > 0 then doTransformItem(b.uid, b.itemid - ? end
doPlayerSendCancel(cid, "#getBadges# "..getCreatureName(this).." "..getPlayerItemCount(cid, gymbadges[getCreatureName(this)]))
end
function onCreatureSay(cid, type, msg)
local msg = string.lower(msg)
if focus == cid then
talk_start = os.clock()
end
if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) <= 4 then
focus = cid
talk_start = os.clock()
conv = 1
selfSay("Hello "..getCreatureName(cid)..", my name is Brock and I'm Pewter's Gym Leader. How may I help you?")
return true
end
if isDuelMsg(msg) and conv == 1 and focus == cid then
--if getPlayerItemCount(cid, gymbadges[getCreatureName(getThis())]) >= 1 then
-- selfSay("You have already won my Boulder Badge, maybe some other day we can fight.")
-- focus = 0
--return true
--end
--if not hasPokemon(cid) then
--selfSay("To battle agains't a gym leader you need pokemons.")
--return true
--end
--selfSay("You are challenging me to a battle. It will be a "..#pokemons.." pokemon limit battle, let's start?")
--conv = 2
if getPlayerStorageValue(cid, 991) == 1 then
focus = 0
selfSay("already battled with you , find another leader of gym!")
return true
end
selfSay("You are challenging me to a battle. It will be a "..#pokemons.." pokemon limit battle, let's start?")
conv = 2
return true
end
if isConfirmMsg(msg) and conv == 2 and focus == cid then
challenger = focus
setPlayerStorageValue(cid, 991, 1)
selfSay("Yea, let's fight!")
talk_start = os.clock()
addEvent(doSummonGymPokemon, 850, getThis())
conv = 3
return true
end
if isNegMsg(msg) and conv == 2 and focus == cid then
focus = 0
selfSay("It is better for you to refuse a battle against me!")
return true
end
if msgcontains(msg, 'bye') and focus == cid then
selfSay('Bye and do your best trainer!')
setPlayerStorageValue(focus, 991, -1)
focus = 0
return true
end
end
local afk_warning = false
local change = false
function onThink()
if focus == 0 then
selfTurn(2)
fighting = false
challenger = 0
challenger_turn = 0
battle_turn = 1
afk_time = 0
afk_warning = false
if #getCreatureSummons(getThis()) >= 1 then
setPlayerStorageValue(getCreatureSummons(getThis())[1], 1006, 0)
doCreatureAddHealth(getCreatureSummons(getThis())[1], -getCreatureMaxHealth(getCreatureSummons(getThis())[1]))
end
return true
else
if not isCreature(focus) then
focus = 0
return true
end
if fighting then
talk_start = os.clock()
if not isCreature(getCreatureTarget(getThis())) then
afk_time = afk_time + 0.5
if change then
change = false
challenger_turn = challenger_turn + 1
end
end
if afk_time > afk_limit_time then
setPlayerStorageValue(focus, 991, -1)
focus = 0
selfSay("I have waited too long, come back when you are ready!")
return true
end
if not afk_warning and afk_time > afk_limit_time / 2 then
selfSay("Where's your pokemon? Let's fight!")
afk_warning = true
end
if #getCreatureSummons(getThis()) == 0 then
if battle_turn > #pokemons then
addEvent(doWinDuel, 1000, focus, getThis())
setPlayerStorageValue(focus, 991, -1)
focus = 0
return true
end
addEvent(doSummonGymPokemon, 1000, getThis())
end
end
local npcpos = getThingPos(getThis())
local focpos = getThingPos(focus)
if npcpos.z ~= focpos.z then
setPlayerStorageValue(focus, 991, -1)
focus = 0
selfSay("Bye then.")
return true
end
if (os.clock() - talk_start) > 30 then
selfSay("Good bye and keep training!")
setPlayerStorageValue(focus, 991, -1)
focus = 0
end
if getDistanceToCreature(focus) > max_distance then
setPlayerStorageValue(focus, 991, -1)
focus = 0
return true
end
local dir = doRedirectDirection(getDirectionTo(npcpos, focpos))
selfTurn(dir)
end
return true
end
info
Grupo: Herói
Registrado: 25/10/11
Posts: 2.2k
Reputação: +862
Gênero: Masculino
Char no Tibia: Sociopata

01 de dezembro de 2019 às 18:46
E o erro amigo? que está aparecendo..
info
Grupo: Conde
Registrado: 11/03/13
Posts: 629
Reputação: +183

01 de dezembro de 2019 às 21:44
A base DXP não tem a função de GYM na Source, tem que adicionar e compilar, não basta só adicionar os arquivos de outra base.




info
Grupo: Campones
Registrado: 03/01/19
Posts: 10
Reputação: 0
Gênero: Masculino
Char no Tibia: [FS] Ayslan
Bom gente como diz no titulo estou com problema com meu gym system ele nao funciona, gostaria de saber se alguem poderia me ajudar com esse problema
Base : DxP