Ir para conteúdo

cocazul

Posts Recomendados

Então um Cara fez um topico sobre esse Event defend-the-generato irei passar o site pra mostra tudo certinho mas a minha duvidada.

 

Site onde Peguei Esse event : http://www.xtibia.com/forum/topic/201610-defend-the-generator/

 

 

Minha duvida e como Que eu ligo o event ? , todos comando não funcionam.

 

 

fui entra no meu ot e abri o event com o comando /generator open.Não deu nada certo Nem um comando funciona.

 

Então essa parte pra que serve :

  1. tp_pos = {x = 316, y = 132, z = 7, stackpos = 1} -- Posição do teleport (Não altere o stackpos)
  2. Eu acho que e quando escrever o comando /generator open um teleport nascera Nas Posições x = 316 , 132 ..
Pra começar so instalando tudo em Mods . Não funciona pq os comando nem um deles funciona.
Essa parte Eu coloco onde ..?
Aqui > coloco em talkactions
  1. ------------------------------------------------------------------------------------
  2. <talkaction words="/generator" access="5" event="buffer"><![CDATA[
  3. domodlib('generator')
  4. if not param then
  5. doPlayerSendCancel(cid, 'Incorrect params. Choose if the event will "open", "force" or "reset".') returntrue
  6. elseif param == "open" then
  7. if getGlobalStorageValue(stor) ~= -1 or getGlobalStorageValue(stor) > 0 then
  8. doPlayerSendCancel(cid, "You can't start the event now.") return true
  9. end
  10. openTeleport()
  11. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've opened the Defend The Generator event.") return true
  12. elseif param == "force" then
  13. if getGlobalStorageValue(stor) == -1 or getGlobalStorageValue(sstor) >= 1 then
  14. doPlayerSendCancel(cid, "You can't force the event now.") return true
  15. end
  16. setGlobalStorageValue(sstor, 1)
  17. startEvent()
  18. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've closed the Defend The Generator event.") return true
  19. elseif param == "reset" then
  20. if getGlobalStorageValue(stor) == -1 or getGlobalStorageValue(sstor) == -1 then
  21. doPlayerSendCancel(cid, "You can't end the event now.") return true
  22. end
  23. resetEvent()
  24. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've reseted the Defend The Generator event.") return true
  25. end
  26. return true
  27. ]]></talkaction>
  28. ------------------------------------------------------------------------------------
[
[Em actions]
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Em actions :
  1. <action actionid="25177" event="script"><![CDATA[
  2. domodlib('generator')
  3. if isDefender(cid) and isGeneratorActived() then
  4. doPlayerSendCancel(cid, "You cannot deactivate the generator. You are defending it!") return true
  5. elseif isInvader(cid) and isGeneratorActived() then
  6. setGlobalStorageValue(gstor, -1)
  7. broadcastMessage(""..getCreatureName(cid).." [iNVADER] turned OFF the generator! Defenders Team now have "..gtime.." seconds to turn on it again or they will lose!")
  8. y = addEvent(destroyGenerator, gtime*1000)
  9. elseif isDefender(cid) and not isGeneratorActived() then
  10. setGlobalStorageValue(gstor, 1)
  11. generateSparks()
  12. broadcastMessage(""..getCreatureName(cid).." [DEFENDER] turned ON the generator!")
  13. stopEvent(y)
  14. elseif isInvader(cid) and not isGeneratorActived() then
  15. doPlayerSendCancel(cid, "The generator is already off!") return true
  16. end
  17. doSendAnimatedText(getThingPos(item.uid), getGlobalStorageValue(gstor) == -1 and "Off!" or "On!",math.random(1, 255))
  18. return true
  19. ]]></action>
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
E tudo no mods ? Pq não funciona os comando ..
em movements
  1. <movevent type="StepIn" actionid="23590" event="script"><![CDATA[
  2. domodlib('generator')
  3. function onStepIn(cid, position, fromPosition)
  4. if getGlobalStorageValue(stor) == (maxplayers-1) then
  5. setGlobalStorageValue(sstor, 1)
  6. startEvent()
  7. else
  8. broadcastMessage(""..getCreatureName(cid).." entered in the Defend The Generator Event. There is "..(maxplayers-(getGlobalStorageValue(stor)+1)).." slots remaining.")
  9. end
  10. selectPlayerTeam(cid)
  11. return true
  12. end
  13. ]]></movevent>
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Aqui que eu saiba era pra ser no login.lua
  1. <event type="logout" name="GeneratorLogout" event="script"><![CDATA[
  2. domodlib('generator')
  3. function onLogout(cid)
  4. if getPlayerStorageValue(cid, tstor) >= 1 then
  5. doPlayerSendCancel(cid, "You can't logout when you are in this event!") return false
  6. end
  7. return true
  8. end
  9. ]]></event>
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  1. <event type="preparedeath" name="GeneratorDeath" event="script"><![CDATA[
  2. domodlib('generator')
  3. function onPrepareDeath(cid)
  4. if isInvader(cid) and getGlobalStorageValue(invstor) > 1 then
  5. setGlobalStorageValue(invstor, getGlobalStorageValue(invstor)-1)
  6. broadcastMessage(""..getCreatureName(cid).." [iNVADER] died. "..getGlobalStorageValue(defstor).." Defenders and "..getGlobalStorageValue(invstor).." Invaders left.")
  7. elseif isInvader(cid) and getGlobalStorageValue(invstor) == 1 then
  8. for _, wid in ipairs(getPlayersOnline()) do
  9. if isDefender(wid) then
  10. if not doPlayerAddItem(wid, prizes[prand].id, prizes[prand].count) then
  11. local parcel = doCreateItemEx(ITEM_PARCEL)
  12. doAddContainerItem(parcel, prizes[prand].id, prizes[prand].count)
  13. doPlayerSendMailByName(getCreatureName(wid), parcel, getPlayerTown(wid))
  14. doPlayerSendTextMessage(wid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough cap. Your prize was sent to the depot.")
  15. end
  16. doPlayerSendTextMessage(wid, MESSAGE_STATUS_CONSOLE_BLUE, "You win "..prizes[prand].count.."x "..getItemNameById(prizes[prand].id)..".")
  17. end
  18. end
  19. broadcastMessage("All the Invaders are dead. Defenders won the Defend The Generator Event!")
  20. resetEvent()
  21. elseif isDefender(cid) then
  22. setGlobalStorageValue(defstor, getGlobalStorageValue(defstor)-1)
  23. broadcastMessage(""..getCreatureName(cid).." [DEFENDER] died. "..getGlobalStorageValue(defstor).." Defenders and "..getGlobalStorageValue(invstor).." Invaders left.")
  24. end
  25. setPlayerStorageValue(cid, tstor, -1)
  26. doCreatureSetDropLoot(cid, false)
  27. doPlayerSetLossSkill(cid, 0)
  28. doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
  29. return true
  30. end
  31. ]]></event>
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  1. <event type="combat" name="GeneratorCast" event="script"><![CDATA[
  2. domodlib('generator')
  3. function onCombat(cid, target)
  4. if isPlayer(cid) and isPlayer(target) then
  5. if isDefender(cid) and isDefender(target) or isInvader(cid) and isInvader(target) then
  6. doPlayerSendCancel(cid, "You may not attack your team mates.") return false
  7. end
  8. end
  9. return true
  10. end
  11. ]]></event>
  12. </mod>
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Então Instalei tudo como fala o site Que passei em cima la.

Mas nada Funcionou os comandos não funciona.

 

Eu acho que pra funciona normal Teria que instalar cada parte dessa que passei em cada parte.

 

 

ali talkactions em data/talkactions

 

 

Foi tudo instalado no mods Mas não funciona Nao da pra Iniciar o event Nadaa..

 

 

 

+rep pra quem conseguir ME ajuda.

 

 

 

Observe Instalei Tudo como O site do topico que passei acima diz tudo Certinho igual o site mas não funciona então nãoo adianta fica falando coisas ai que não instalei certo..

 

 

 

Minha instalação foi assim criei um xml no mods , com o nome Defend The Generator.xml

 

depois configurei todas posições tudo certinho Mas não funciona Pls ajuda ai ..+rep

 

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

 

O meu [Defend The Generator.xml] Ficou assim :

---------------------------------------------------------------

 

 

<?xml version="1.0" encoding="UTF-8"?>
<mod name="Defend The Generator" version="1.0" author="LuckOake" contact="none" enabled="yes">
-----------------------------------------------------------------------
<config name="generator"><![CDATA[
teams = {
["Defenders"] = {
pos = {x = 1295, y = 1589, z = 7},
storage = 43110,
},
["Invaders"] = {
pos = {x = 1061, y = 1591, z = 7},
storage = 43111,
}
}
defpos,defstor = teams["Defenders"].pos,teams["Defenders"].storage
invpos,invstor = teams["Invaders"].pos,teams["Invaders"].storage
stor = 43112
tstor = 43113
sstor = 43114
gstor = 43115
area1 = {x = 1048, y = 1564, z = 7} -- Ponta de cima na esquerda da área
area2 = {x = 1314, y = 1623, z = 7} -- Ponta de baixo na direita da área
tp_pos = {x = 150, y = 42, z = 5, stackpos = 1} -- Posição do teleport (Não altere o stackpos)
sparkpos = {x = 1280, y = 1584, z = 6} -- Posição dos sparks do Gerador
maxplayers = 20 -- Máximo de players (De preferência, coloque um número par)
gtime = 10 -- Quantos segundos o gerador deverá ficar desligado para que os Invaders vençam
wall = { -- Positions das paredes de bloqueio (Não altere o stackpos)
[1] = {x = 1076, y = 1590, z = 7, stackpos = 1},
[2] = {x = 1277, y = 1590, z = 7, stackpos = 1},
}
wallid = 1111 -- Id das walls
prizes = {
[1] = {id = 2149, count = 13},
[2] = {id = 2149, count = 12},
[3] = {id = 2149, count = 11}
}
prand = math.random(1, #prizes)
function isMale(cid)
return getPlayerSex(cid) == 1 and true or false
end
function isFemale(cid)
return getPlayerSex(cid) == 0 and true or false
end
function getNumberType(n)
return n % 2 == 0 and "par" or "impar"
end
function selectPlayerTeam(cid)
if getNumberType(getGlobalStorageValue(stor)) == "par" then
doTeleportThing(cid, defpos)
setPlayerStorageValue(cid, tstor, 1)
registerCreatureEvent(cid, "GeneratorCast")
setGlobalStorageValue(defstor, getGlobalStorageValue(defstor)+1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You must DEFEND the Generator. Kill the invaders!")
if isMale(cid) then
doSetCreatureOutfit(cid, {lookType = math.random(128,134), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88}, -1)
elseif isFemale(cid) then
doSetCreatureOutfit(cid, {lookType = math.random(136,142), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88}, -1)
end
elseif getNumberType(getGlobalStorageValue(stor)) == "impar" then
doTeleportThing(cid, invpos)
setPlayerStorageValue(cid, tstor, 2)
setGlobalStorageValue(invstor, getGlobalStorageValue(invstor)+1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You must DISABLE the Generator. Crush the defenders!")
if isMale(cid) then
doSetCreatureOutfit(cid, {lookType = math.random(128,134), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94}, -1)
elseif isFemale(cid) then
doSetCreatureOutfit(cid, {lookType = math.random(136,142), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94}, -1)
end
end
setGlobalStorageValue(stor, getGlobalStorageValue(stor)+1)
registerCreatureEvent(cid, "GeneratorLogout")
registerCreatureEvent(cid, "GeneratorDeath")
end
function removeWalls()
for _, walls in ipairs(wall) do
doRemoveItem(getThingFromPos(walls).uid, 1)
end
end
function createWalls()
for _, walls in ipairs(wall) do
doCreateItem(wallid, 1, walls)
end
end
function isGeneratorActived()
return getGlobalStorageValue(gstor) == 1 and true or false
end
function generateSparks()
if isGeneratorActived() then
doSendMagicEffect(sparkpos, 11)
addEvent(generateSparks, 1000)
end
end
function startEvent()
setGlobalStorageValue(gstor, 1)
generateSparks()
doRemoveItem(getThingFromPos(tp_pos).uid, 1)
doSendMagicEffect(tp_pos, 2)
broadcastMessage("Defend The Generator Event started.")
removeWalls()
end
function resetEvent()
for _, pid in ipairs(getPlayersOnline()) do
if isDefender(pid) or isInvader(pid) then
setPlayerStorageValue(pid, tstor, -1)
doRemoveCondition(pid, CONDITION_OUTFIT)
doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))
addEvent(doRemoveCreature, 3000, pid)
end
end
setGlobalStorageValue(stor, -1)
setGlobalStorageValue(sstor, -1)
setGlobalStorageValue(defstor, -1)
setGlobalStorageValue(invstor, -1)
setGlobalStorageValue(gstor, -1)
createWalls()
end
function destroyGenerator()
if getGlobalStorageValue(stor) == -1 then return true end
for _, tid in ipairs(getPlayersOnline()) do
if isInvader(tid) then
if not doPlayerAddItem(tid, prizes[prand].id, prizes[prand].count) then
local parcel = doCreateItemEx(ITEM_PARCEL)
doAddContainerItem(parcel, prizes[prand].id, prizes[prand].count)
doPlayerSendMailByName(getCreatureName(tid), parcel, getPlayerTown(tid))
doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough cap. Your prize was sent to the depot.")
end
doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, "You win "..prizes[prand].count.."x "..getItemNameById(prizes[prand].id)..".")
end
end
broadcastMessage("The generator is destroyed! The Invaders Team won!")
resetEvent()
end
function isDefender(cid)
return getPlayerStorageValue(cid, tstor) == 1 and true or false
end
function isInvader(cid)
return getPlayerStorageValue(cid, tstor) == 2 and true or false
end
function openTeleport()
local tp = 1387
local tele = doCreateItem(tp, 1, tp_pos)
setGlobalStorageValue(defstor, 0)
setGlobalStorageValue(invstor, 0)
doItemSetAttribute(tele, "aid", 23590)
doSendMagicEffect(tp_pos, 10)
setGlobalStorageValue(stor, 0)
broadcastMessage("Defend The Generator Event is now open!")
end
]]></config>
------------------------------------------------------------------------------------
<talkaction words="/generator" access="5" event="buffer"><![CDATA[
domodlib('generator')
if not param then
doPlayerSendCancel(cid, 'Incorrect params. Choose if the event will "open", "force" or "reset".') return true
elseif param == "open" then
if getGlobalStorageValue(stor) ~= -1 or getGlobalStorageValue(stor) > 0 then
doPlayerSendCancel(cid, "You can't start the event now.") return true
end
openTeleport()
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've opened the Defend The Generator event.") return true
elseif param == "force" then
if getGlobalStorageValue(stor) == -1 or getGlobalStorageValue(sstor) >= 1 then
doPlayerSendCancel(cid, "You can't force the event now.") return true
end
setGlobalStorageValue(sstor, 1)
startEvent()
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've closed the Defend The Generator event.") return true
elseif param == "reset" then
if getGlobalStorageValue(stor) == -1 or getGlobalStorageValue(sstor) == -1 then
doPlayerSendCancel(cid, "You can't end the event now.") return true
end
resetEvent()
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've reseted the Defend The Generator event.") return true
end
return true
]]></talkaction>
------------------------------------------------------------------------------------
<action actionid="25177" event="script"><![CDATA[
domodlib('generator')
if isDefender(cid) and isGeneratorActived() then
doPlayerSendCancel(cid, "You cannot deactivate the generator. You are defending it!") return true
elseif isInvader(cid) and isGeneratorActived() then
setGlobalStorageValue(gstor, -1)
broadcastMessage(""..getCreatureName(cid).." [iNVADER] turned OFF the generator! Defenders Team now have "..gtime.." seconds to turn on it again or they will lose!")
y = addEvent(destroyGenerator, gtime*1000)
elseif isDefender(cid) and not isGeneratorActived() then
setGlobalStorageValue(gstor, 1)
generateSparks()
broadcastMessage(""..getCreatureName(cid).." [DEFENDER] turned ON the generator!")
stopEvent(y)
elseif isInvader(cid) and not isGeneratorActived() then
doPlayerSendCancel(cid, "The generator is already off!") return true
end
doSendAnimatedText(getThingPos(item.uid), getGlobalStorageValue(gstor) == -1 and "Off!" or "On!", math.random(1, 255))
return true
]]></action>
------------------------------------------------------------------------------------
<movevent type="StepIn" actionid="23590" event="script"><![CDATA[
domodlib('generator')
function onStepIn(cid, position, fromPosition)
if getGlobalStorageValue(stor) == (maxplayers-1) then
setGlobalStorageValue(sstor, 1)
startEvent()
else
broadcastMessage(""..getCreatureName(cid).." entered in the Defend The Generator Event. There is "..(maxplayers-(getGlobalStorageValue(stor)+1)).." slots remaining.")
end
selectPlayerTeam(cid)
return true
end
]]></movevent>
------------------------------------------------------------------------------------
<event type="logout" name="GeneratorLogout" event="script"><![CDATA[
domodlib('generator')
function onLogout(cid)
if getPlayerStorageValue(cid, tstor) >= 1 then
doPlayerSendCancel(cid, "You can't logout when you are in this event!") return false
end
return true
end
]]></event>
------------------------------------------------------------------------------------
<event type="preparedeath" name="GeneratorDeath" event="script"><![CDATA[
domodlib('generator')
function onPrepareDeath(cid)
if isInvader(cid) and getGlobalStorageValue(invstor) > 1 then
setGlobalStorageValue(invstor, getGlobalStorageValue(invstor)-1)
broadcastMessage(""..getCreatureName(cid).." [iNVADER] died. "..getGlobalStorageValue(defstor).." Defenders and "..getGlobalStorageValue(invstor).." Invaders left.")
elseif isInvader(cid) and getGlobalStorageValue(invstor) == 1 then
for _, wid in ipairs(getPlayersOnline()) do
if isDefender(wid) then
if not doPlayerAddItem(wid, prizes[prand].id, prizes[prand].count) then
local parcel = doCreateItemEx(ITEM_PARCEL)
doAddContainerItem(parcel, prizes[prand].id, prizes[prand].count)
doPlayerSendMailByName(getCreatureName(wid), parcel, getPlayerTown(wid))
doPlayerSendTextMessage(wid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough cap. Your prize was sent to the depot.")
end
doPlayerSendTextMessage(wid, MESSAGE_STATUS_CONSOLE_BLUE, "You win "..prizes[prand].count.."x "..getItemNameById(prizes[prand].id)..".")
end
end
broadcastMessage("All the Invaders are dead. Defenders won the Defend The Generator Event!")
resetEvent()
elseif isDefender(cid) then
setGlobalStorageValue(defstor, getGlobalStorageValue(defstor)-1)
broadcastMessage(""..getCreatureName(cid).." [DEFENDER] died. "..getGlobalStorageValue(defstor).." Defenders and "..getGlobalStorageValue(invstor).." Invaders left.")
end
setPlayerStorageValue(cid, tstor, -1)
doCreatureSetDropLoot(cid, false)
doPlayerSetLossSkill(cid, 0)
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
return true
end
]]></event>
<event type="login" name="GeneratorLogin" event="script"><![CDATA[
domodlib('generator')
function onLogin(cid)
registerCreatureEvent(cid, "GeneratorCast")
return true
end
]]></event>
<event type="combat" name="GeneratorCast" event="script"><![CDATA[
domodlib('generator')
function onCombat(cid, target)
if isPlayer(cid) and isPlayer(target) then
if isDefender(cid) and isDefender(target) or isInvader(cid) and isInvader(target) then
doPlayerSendCancel(cid, "You may not attack your team mates.") return false
end
end
return true
end
]]></event>
</mod>

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

 

 

Não sei oque Tem de errado Mas ta igual ao Topico : http://www.xtibia.com/forum/topic/201610-defend-the-generator/

 

 

+rep para os que ajudam ..xD

 

 


UPPPPPPPPPP , UPPPPPPPPPPPPP

Editado por cocazul
Link para o comentário
Compartilhar em outros sites

  • 3 weeks later...
  • 4 years later...
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.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...