AdilsonHacker 98 Postado Junho 18, 2015 Share Postado Junho 18, 2015 Bom galera, eu queria saber se é póssivel um script que só permita X vocation id atacar esse X monstro (configurado) e o monstro também só podendo atacar essa X vocation. Bom é isso ai, desculpem se não expliquei direito. Agradeço desde já. Link para o comentário https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/ Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Junho 21, 2015 Share Postado Junho 21, 2015 (editado) Foi mal, é o sono. Códigos corrigidos. Editado Junho 21, 2015 por zipter98 Link para o comentário https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/page/3/#findComment-1657176 Compartilhar em outros sites More sharing options...
0 Creatserv 0 Postado Junho 21, 2015 Share Postado Junho 21, 2015 Funcionou, obrigado. Mas enquanto em lua, nenhum resultado o monster ainda ataca o jogador com vocation id diferente da adicionada no script. mano poderia dizer qual sua idéia com esses script. Link para o comentário https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/page/3/#findComment-1657195 Compartilhar em outros sites More sharing options...
0 AdilsonHacker 98 Postado Junho 22, 2015 Autor Share Postado Junho 22, 2015 (editado) Obrigado a todos que tentaram de todo jeito me ajudar, principalmente Bruno e Zipter98. Grato. mano poderia dizer qual sua idéia com esses script. Creatserv, meu servidor possui raças com esse script criarei guardas para cada centro da cidade. @EDIT Zipter, achei um pequeno erro outra vocation sem o id configurado consegue matar o bixo, sendo que apenas os id configurado poderia matar, queria que quando jogadores sem o vocation id configurado aparece um doPlayerSendCancel dizendo "você não pode atacar esta criatura." (OBS: tinha esquecido deste detalhe) Editado Junho 22, 2015 por AdilsonTsunami Link para o comentário https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/page/3/#findComment-1657306 Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Junho 22, 2015 Share Postado Junho 22, 2015 (editado) Ops, é mesmo. local config = { name = "xxx", --nome do monstro vocId = xxx, --vocation id } function onTarget(cid, target) local player = isMonster(cid) and isPlayer(target) and target or isPlayer(cid) and isMonster(target) and getCreatureName(target) == config.name and cid or false if player then if getPlayerVocation(player) ~= config.vocId then if isPlayer(cid) then doPlayerSendCancel(cid, "você não pode atacar esta criatura.") end return false end end return true end function onStatsChange(cid, attacker, type, combat, value) local player = isMonster(attacker) and isPlayer(cid) and cid or isPlayer(attacker) and isMonster(cid) and getCreatureName(cid) == config.name and attacker or false if player then return getPlayerVocation(player) == config.vocId end return true end PS: O diretório na tag de ambos os creatureevents deve ser o mesmo. Editado Junho 22, 2015 por zipter98 Link para o comentário https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/page/3/#findComment-1657379 Compartilhar em outros sites More sharing options...
0 AdilsonHacker 98 Postado Junho 23, 2015 Autor Share Postado Junho 23, 2015 Zipter, infelizmente nada aconteceu, o jogador sem a vocation id adicionada no script ainda consegue atacar o monstro. Link para o comentário https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/page/3/#findComment-1657522 Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Junho 23, 2015 Share Postado Junho 23, 2015 E o monstro, ele foca apenas os jogadores com a vocation id configurada? Link para o comentário https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/page/3/#findComment-1657545 Compartilhar em outros sites More sharing options...
0 AdilsonHacker 98 Postado Junho 23, 2015 Autor Share Postado Junho 23, 2015 Sim, e era para apenas os jogadores que ele foca poder atacar ele, quando outro vocation id não configurado atacar falar aquela mensagem que citei acima. Link para o comentário https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/page/3/#findComment-1657547 Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Junho 23, 2015 Share Postado Junho 23, 2015 OK, tenta assim: local config = { name = "xxx", --nome do monstro vocId = xxx, --vocation id } function onTarget(cid, target) if isMonster(cid) and isPlayer(target) then if getPlayerVocation(target) ~= config.vocId then return false end elseif isPlayer(cid) and isMonster(target) then if getCreatureName(target) == config.name and getPlayerVocation(cid) ~= config.vocId then return doPlayerSendCancel(cid, "você não pode atacar esta criatura.") and false end end return true end function onStatsChange(cid, attacker, type, combat, value) if isMonster(attacker) and isPlayer(cid) then if getPlayerVocation(cid) ~= config.vocId then return false end elseif isPlayer(attacker) and isMonster(cid) then if getCreatureName(cid) == config.name and getPlayerVocation(attacker) ~= config.vocId then return doPlayerSendCancel(attacker, "você não pode atacar esta criatura.") and false end end return true end Link para o comentário https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/page/3/#findComment-1657549 Compartilhar em outros sites More sharing options...
0 AdilsonHacker 98 Postado Junho 23, 2015 Autor Share Postado Junho 23, 2015 Mesma coisa, não da erros no console mais também não pega. Continua outra vocation id atacando o monstro. Link para o comentário https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/page/3/#findComment-1657557 Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Junho 23, 2015 Share Postado Junho 23, 2015 Como ficaram as tags e o registro em login.lua? Link para o comentário https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/page/3/#findComment-1657561 Compartilhar em outros sites More sharing options...
0 AdilsonHacker 98 Postado Junho 23, 2015 Autor Share Postado Junho 23, 2015 (editado) <event type="target" name="guarda" event="script" value="guarda.lua"/> <event type="StatsChange" name="guarda" event="script" value="guarda.lua"/> Editado Junho 23, 2015 por AdilsonTsunami Link para o comentário https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/page/3/#findComment-1657562 Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Junho 23, 2015 Share Postado Junho 23, 2015 (editado) Tags: <event type="statschange" name="guardaStatsChange" event="script" value="guarda.lua"/> <event type="target" name="guardaTarget" event="script" value="guarda.lua"/> Em login.lua: registerCreatureEvent(cid, "guardaStatsChange") registerCreatureEvent(cid, "guardaTarget") No xml do monstro: <script> <event name="guardaStatsChange"/> <event name="guardaTarget"/> </script> Editado Junho 23, 2015 por zipter98 Link para o comentário https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/page/3/#findComment-1657567 Compartilhar em outros sites More sharing options...
0 AdilsonHacker 98 Postado Junho 24, 2015 Autor Share Postado Junho 24, 2015 Mesma coisa, nada acontece. @up Link para o comentário https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/page/3/#findComment-1657570 Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Junho 24, 2015 Share Postado Junho 24, 2015 (editado) Use este código e informe tudo que for imprimido no console. local config = { name = "xxx", --nome do monstro vocId = xxx, --vocation id } function onTarget(cid, target) if isMonster(cid) and isPlayer(target) then if getPlayerVocation(target) ~= config.vocId then return false end elseif isPlayer(cid) and isMonster(target) then print("[Target] - "..getCreatureName(cid)) print("[Target] - Vocation ID: [configurada: "..config.vocId.."] / [cid: "..getPlayerVocation(cid).."]") if getCreatureName(target) == config.name and getPlayerVocation(cid) ~= config.vocId then print("[Target] Cid can't target monster.") return doPlayerSendCancel(cid, "você não pode atacar esta criatura.") and false end end return true end function onStatsChange(cid, attacker, type, combat, value) if isMonster(attacker) and isPlayer(cid) then if getPlayerVocation(cid) ~= config.vocId then return false end elseif isPlayer(attacker) and isMonster(cid) and type == STATSCHANGE_HEALTHLOSS then print("[StatsChange] - "..getCreatureName(attacker)) print("[StatsChange] - Vocation ID: [configurada: "..config.vocId.."] / [cid: "..getPlayerVocation(attacker).."]") if getCreatureName(cid) == config.name and getPlayerVocation(attacker) ~= config.vocId then print("[StatsChange] Cid can't damage monster.") return doPlayerSendCancel(attacker, "você não pode atacar esta criatura.") and false end end return true end Editado Junho 24, 2015 por zipter98 Link para o comentário https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/page/3/#findComment-1657754 Compartilhar em outros sites More sharing options...
0 AdilsonHacker 98 Postado Junho 25, 2015 Autor Share Postado Junho 25, 2015 Link para o comentário https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/page/3/#findComment-1657787 Compartilhar em outros sites More sharing options...
Pergunta
AdilsonHacker 98
Bom galera, eu queria saber se é póssivel um script que só permita X vocation id atacar esse X monstro (configurado) e o monstro também só podendo atacar essa X vocation.
Bom é isso ai, desculpem se não expliquei direito.
Agradeço desde já.
Link para o comentário
https://xtibia.com/forum/topic/234873-apenas-x-vocation-id-pode-atacar-x-monstro/Compartilhar em outros sites
Top Posters For This Question
17
12
8
6
Popular Days
Jun 18
13
Jun 21
8
Jun 23
8
Jun 20
7
Top Posters For This Question
AdilsonHacker 17 posts
zipter98 12 posts
RigBy 8 posts
Vodkart 6 posts
Popular Days
Jun 18 2015
13 posts
Jun 21 2015
8 posts
Jun 23 2015
8 posts
Jun 20 2015
7 posts
Popular Posts
Vodkart
olá amigo, acho q vc está falando besteira. esse código é simples e pode ser feito com onAttack ou onCombat
zipter98
Ué, você configurou corretamente o nome do monstro no código (letras maiúsculas e minúsculas fazem diferença)? local config = { name = "xxx", --nome do monstro vocId = xxx, --vocation
RigBy
Eu ja tentei fazer um onCombat e coloca um return false mas o Mob continua atacando, vo testar agora onAttack nunca usei
47 respostass a esta questão
Posts Recomendados