RO
poketibia

[Encerrado] Pokemon de player so pode atacar se estiver storage

Por RodriigoRobson, 30 de set. de 2013 em Tópicos Sem Resposta

resolvido
tibia
script
otserv
5
1.2k
30 de setembro de 2013 às 16:15

Alguem pode me ajuda nesse script to batendo cabeça e faz tempo que nao mecho com script de poketibia.

 

Eu quero que o pokemon do time azul nao pode atacar os outros pokemons do time azul .

O Time Red e a mesma coisa.Alguem pode me ajuda plx

 

 


function onCombat(cid, target,attacker)
local Red = 6666 -- time azul
local Blue = 6667 -- time vermelho
if getPlayerStorageValue(cid,Red) == 1 then
if isPlayer(attacker) and isPlayer(getCreatureMaster(cid)) then
if getPlayerStorageValue(cid, Red) >= 1 and getPlayerStorageValue(cid, Red) >= 1 then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER)
elseif getPlayerStorageValue(cid,Blue) == 1 then
if isPlayer(attacker) and isPlayer(getCreatureMaster(cid)) then
if getPlayerStorageValue(cid, Blue) >= 1 and getPlayerStorageValue(cid, Blue) >= 1 then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER)
return FALSE
end
end
return TRUE
end
end
end
end

 

OriGMO
01 de outubro de 2013 às 14:41

Cara estou procurando algo parecido tambem,mas bem mais complexo,acredito que voce consiga fazer oque voce quer de outra forma,procura no forum por "não dar dano em party" ,e acredito que dando uma mexida aqui e ali,voce consiga fazer essa função funcionar.

01 de outubro de 2013 às 22:49

Tente isso:

Vá em creaturescripts/scripts/playerattack.lua <-- Peço que faça um backup do original:

 

local fightcondition = createConditionObject(CONDITION_INFIGHT)

setConditionParam(fightcondition, CONDITION_PARAM_TICKS, 12 * 1000)
function fightCondic(cid)
if not isCreature(cid) then return true end
if not isCreature(getCreatureTarget(cid)) then return true end
doAddCondition(cid, fightcondition)
addEvent(fightCondic, 1000, cid)
end
function onTarget(cid, target)
if isPlayer(target) then
if canAttackOther(cid, target) == "Cant" then --edited PVP system
return false
elseif isPlayer(target) and #getCreatureSummons(target) >= 1 and canAttackOther(cid, target) == "Can" then
return false
end
end
if getPlayerStorageValue(target, 201) ~= -1 then
for a, b in pairs(ginasios) do
if getPlayerStorageValue(target, ginasios[getPlayerStorageValue(target, 201)].storage) == 1 then
if getPlayerStorageValue(cid, ginasios[getPlayerStorageValue(target, 201)].storage) ~= 1 then
doPlayerSendCancel(cid, "You can't attack this pokemon.")
return false
end
end
end
end
if isSummon(target) then --edited PVP system
if canAttackOther(cid, target) == "Cant" then
return false
end
end
if false then -- desativado
if not isPlayerInAgressiveList(target, cid) then
addPlayerToAgressiveList(target, cid)
end
if isPassive(target) then
setAgressive(target)
if #getCreatureSummons(cid) >= 1 then
doMonsterSetTarget(target, getCreatureSummons(cid)[1])
else
doMonsterSetTarget(target, cid)
end
else
local histarget = getCreatureTarget(target)
if isCreature(histarget) and isPlayer(getCreatureMaster(histarget)) and #getCreatureSummons(cid) >= 1 and #getCreatureSummons(getCreatureMaster(histarget)) <= 0 then
doMonsterSetTarget(target, getCreatureSummons(cid)[1])
end
end
end
return TRUE
end

Tente ai, se der algum erro, poste-o.

Editado Outubro 1 por FlamesAdmin

2 semanas depois...
GabrieltxuG
09 de outubro de 2013 às 09:43

Tópico movido para a seção de dúvidas e pedidos resolvidos.

4 anos depois...
StigalS
21 de abril de 2018 às 03:09
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.