• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

HELP PLEASE CONVERT TO TFS 1.2!!!

avastsz2856

New Member
Joined
Jul 9, 2017
Messages
15
Reaction score
1
please help me, can anybody of good heart convert me?

Lua:
 function onStepIn(cid, item, pos, fromPosition)
 local pos = getThingfromPos(cid)
 if item.actionid == 16203 then
  if not isPlayer(cid) then
     return true
  end
  if getGlobalStorageValue(COH_STATUS) == getPlayerGuildName(cid) then
   doSendMagicEffect(getThingfromPos(cid), 14)
   doPlayerSendTextMessage(cid, 4, "[CoH] Membros da guild dominante "..getGlobalStorageValue(COH_STATUS).." possuem o privilegio de passar por aqui!")
  else
   doSendMagicEffect(getThingfromPos(cid), 2)
      doTeleportThing(cid, fromPosition, false)
   doPlayerSendCancel(cid, "[CoH] Você não pertence á guild dominante "..getGlobalStorageValue(COH_STATUS)..".")
  end
  return true
 end
    if item.actionid == 16202 then
    if not isPlayer(cid) then
     return true
  end
  if getPlayerGuildLevel(cid) > 0 then
   if (getGlobalStorageValue(COH_STATUS) ~= getPlayerGuildName(cid)) then
          doPlayerSendTextMessage(cid, 20, "[Castle of Honor] Você e sua guild estão no comando, os antigos donos ["..tostring(getGlobalStorageValue(COH_STATUS)).."] podem se vingar!")
     setGlobalStorageValue(COH_PREPARE1, -1)
       setGlobalStorageValue(COH_PREPARE2, -1)
     setGlobalStorageValue(COH_STATUS, getPlayerGuildName(cid))
     doCastleRemoveEnemies()
    broadcastMessage("[Castle of Honor] O jogador ["..getCreatureName(cid).."] e sua guild ["..getPlayerGuildName(cid).."] estão agora no comando do castelo. Tente dominar o Castle ou os aceite como governantes!")
      end
    else
   doSendMagicEffect(getThingfromPos(cid), 2)
      doTeleportThing(cid, fromPosition, false)
   doPlayerSendCancel(cid, "[CoH] Você não possui uma guild.")
   end
    return true
 end
    if item.actionid == 16200 then
  if not isPlayer(cid) then
     return true
  end
  if getPlayerGuildLevel(cid) > 0 then
   doPlayerSendTextMessage(cid, 4, "CoH Invasion Camp!")
   if (getGlobalStorageValue(COH_PREPARE1) ~= getPlayerGuildName(cid)) and ((getGlobalStorageValue(COH_PREPARE2) ~= getPlayerGuildName(cid))) then
    setGlobalStorageValue(COH_PREPARE1, getPlayerGuildName(cid))
    broadcastMessage("[Castle of Honor] Atenção! A guild "..getPlayerGuildName(cid).." está indo em direção ao Castelo. Guild dominante preparem-se!")
   end
  else
   doSendMagicEffect(getThingfromPos(cid), 2)
      doTeleportThing(cid, fromPosition, false)
   doPlayerSendCancel(cid, "[CoH] Você não possui uma guild.")  
   return true
  end  
 end
 if item.actionid == 16201 then
  if not isPlayer(cid) then
     return true
  end
  doPlayerSendTextMessage(cid, 4, "CoH Invasion Castle!")
  if (getGlobalStorageValue(COH_PREPARE2) ~= getPlayerGuildName(cid)) then
   setGlobalStorageValue(COH_PREPARE2, getPlayerGuildName(cid))
   broadcastMessage("[Castle of Honor] Atenção! A guild "..getPlayerGuildName(cid).." está próxima do domínio do Castle. Guild dominanete defenda o Castle para não perde-lo!")
  end
 end
 return true
end
 
Last edited:
please help me, can anybody of good heart convert me?

function onStepIn(cid, item, pos, fromPosition)
local pos = getThingfromPos(cid)
if item.actionid == 16203 then
if not isPlayer(cid) then
return true
end
if getGlobalStorageValue(COH_STATUS) == getPlayerGuildName(cid) then
doSendMagicEffect(getThingfromPos(cid), 14)
doPlayerSendTextMessage(cid, 4, "[CoH] Membros da guild dominante "..getGlobalStorageValue(COH_STATUS).." possuem o privilegio de passar por aqui!")
else
doSendMagicEffect(getThingfromPos(cid), 2)
doTeleportThing(cid, fromPosition, false)
doPlayerSendCancel(cid, "[CoH] Você não pertence á guild dominante "..getGlobalStorageValue(COH_STATUS)..".")
end
return true
end
if item.actionid == 16202 then
if not isPlayer(cid) then
return true
end
if getPlayerGuildLevel(cid) > 0 then
if (getGlobalStorageValue(COH_STATUS) ~= getPlayerGuildName(cid)) then
doPlayerSendTextMessage(cid, 20, "[Castle of Honor] Você e sua guild estão no comando, os antigos donos ["..tostring(getGlobalStorageValue(COH_STATUS)).."] podem se vingar!")
setGlobalStorageValue(COH_PREPARE1, -1)
setGlobalStorageValue(COH_PREPARE2, -1)
setGlobalStorageValue(COH_STATUS, getPlayerGuildName(cid))
doCastleRemoveEnemies()
broadcastMessage("[Castle of Honor] O jogador ["..getCreatureName(cid).."] e sua guild ["..getPlayerGuildName(cid).."] estão agora no comando do castelo. Tente dominar o Castle ou os aceite como governantes!")
end
else
doSendMagicEffect(getThingfromPos(cid), 2)
doTeleportThing(cid, fromPosition, false)
doPlayerSendCancel(cid, "[CoH] Você não possui uma guild.")
end
return true
end
if item.actionid == 16200 then
if not isPlayer(cid) then
return true
end
if getPlayerGuildLevel(cid) > 0 then
doPlayerSendTextMessage(cid, 4, "CoH Invasion Camp!")
if (getGlobalStorageValue(COH_PREPARE1) ~= getPlayerGuildName(cid)) and ((getGlobalStorageValue(COH_PREPARE2) ~= getPlayerGuildName(cid))) then
setGlobalStorageValue(COH_PREPARE1, getPlayerGuildName(cid))
broadcastMessage("[Castle of Honor] Atenção! A guild "..getPlayerGuildName(cid).." está indo em direção ao Castelo. Guild dominante preparem-se!")
end
else
doSendMagicEffect(getThingfromPos(cid), 2)
doTeleportThing(cid, fromPosition, false)
doPlayerSendCancel(cid, "[CoH] Você não possui uma guild.")
return true
end
end
if item.actionid == 16201 then
if not isPlayer(cid) then
return true
end
doPlayerSendTextMessage(cid, 4, "CoH Invasion Castle!")
if (getGlobalStorageValue(COH_PREPARE2) ~= getPlayerGuildName(cid)) then
setGlobalStorageValue(COH_PREPARE2, getPlayerGuildName(cid))
broadcastMessage("[Castle of Honor] Atenção! A guild "..getPlayerGuildName(cid).." está próxima do domínio do Castle. Guild dominanete defenda o Castle para não perde-lo!")
end
end
return true
end

Please read the rules; Rules for the Support board
#7

How to display CODE properly in your post
 
Now it's right?

This should work;
Lua:
function onStepIn(player, item, position, fromPosition)
    if not player then
        return true
    end

    local guild = player:getGuild()
    if not player:getGuild() then
        return true
    end

    if item.actionid == 16203 then
        if Game.getStorageValue(COH_STATUS) == guild:getName() then
            player:getPosition():sendMagicEffect(14)
            player:sendTextMessage(4, "[CoH] Membros da guild dominante " .. Game.getStorageValue(COH_STATUS) .. " possuem o privilegio de passar por aqui!")
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Você não pertence á guild dominante " .. Game.getStorageValue(COH_STATUS) .. ".")
        end
        return true
    end

    if item.actionid == 16202 then
        if player:getGuildLevel() > 0 then
            if (Game.getStorageValue(COH_STATUS) ~= guild:getName()) then
                player:sendTextMessage(20, "[Castle of Honor] Você e sua guild estão no comando, os antigos donos [" .. tostring(Game.getStorageValue(COH_STATUS)) .. "] podem se vingar!")
                Game.setStorageValue(COH_PREPARE1, -1)
                Game.setStorageValue(COH_PREPARE2, -1)
                Game.setStorageValue(COH_STATUS, guild:getName())
                doCastleRemoveEnemies()
                Game.broadcastMessage("[Castle of Honor] O jogador [" .. player:getName() .. "] e sua guild [" .. guild:getName() .. "] estão agora no comando do castelo. Tente dominar o Castle ou os aceite como governantes!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Você não possui uma guild.")
        end
        return true
    end

    if item.actionid == 16200 then
        if player:getGuildLevel() > 0 then
            player:sendTextMessage(4, "CoH Invasion Camp!")
            if (Game.getStorageValue(COH_PREPARE1) ~= guild:getName()) and ((Game.getStorageValue(COH_PREPARE2) ~= guild:getName())) then
                Game.setStorageValue(COH_PREPARE1, guild:getName())
                Game.broadcastMessage("[Castle of Honor] Atenção! A guild " .. guild:getName() .. " está indo em direção ao Castelo. Guild dominante preparem-se!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Você não possui uma guild.")  
            return true
        end  
    end

    if item.actionid == 16201 then
        player:sendTextMessage("CoH Invasion Castle!")
        if (Game.getStorageValue(COH_PREPARE2) ~= guild:getName()) then
            Game.setStorageValue(COH_PREPARE2, guild:getName())
            Game.broadcastMessage("[Castle of Honor] Atenção! A guild " .. guild:getName() .. " está próxima do domínio do Castle. Guild dominanete defenda o Castle para não perde-lo!")
        end
    end
    return true
end
 
This should work;
Lua:
function onStepIn(player, item, position, fromPosition)
    if not player then
        return true
    end

    local guild = player:getGuild()
    if not player:getGuild() then
        return true
    end

    if item.actionid == 16203 then
        if Game.getStorageValue(COH_STATUS) == guild:getName() then
            player:getPosition():sendMagicEffect(14)
            player:sendTextMessage(4, "[CoH] Membros da guild dominante " .. Game.getStorageValue(COH_STATUS) .. " possuem o privilegio de passar por aqui!")
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Você não pertence á guild dominante " .. Game.getStorageValue(COH_STATUS) .. ".")
        end
        return true
    end

    if item.actionid == 16202 then
        if player:getGuildLevel() > 0 then
            if (Game.getStorageValue(COH_STATUS) ~= guild:getName()) then
                player:sendTextMessage(20, "[Castle of Honor] Você e sua guild estão no comando, os antigos donos [" .. tostring(Game.getStorageValue(COH_STATUS)) .. "] podem se vingar!")
                Game.setStorageValue(COH_PREPARE1, -1)
                Game.setStorageValue(COH_PREPARE2, -1)
                Game.setStorageValue(COH_STATUS, guild:getName())
                doCastleRemoveEnemies()
                Game.broadcastMessage("[Castle of Honor] O jogador [" .. player:getName() .. "] e sua guild [" .. guild:getName() .. "] estão agora no comando do castelo. Tente dominar o Castle ou os aceite como governantes!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Você não possui uma guild.")
        end
        return true
    end

    if item.actionid == 16200 then
        if player:getGuildLevel() > 0 then
            player:sendTextMessage(4, "CoH Invasion Camp!")
            if (Game.getStorageValue(COH_PREPARE1) ~= guild:getName()) and ((Game.getStorageValue(COH_PREPARE2) ~= guild:getName())) then
                Game.setStorageValue(COH_PREPARE1, guild:getName())
                Game.broadcastMessage("[Castle of Honor] Atenção! A guild " .. guild:getName() .. " está indo em direção ao Castelo. Guild dominante preparem-se!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Você não possui uma guild.") 
            return true
        end 
    end

    if item.actionid == 16201 then
        player:sendTextMessage("CoH Invasion Castle!")
        if (Game.getStorageValue(COH_PREPARE2) ~= guild:getName()) then
            Game.setStorageValue(COH_PREPARE2, guild:getName())
            Game.broadcastMessage("[Castle of Honor] Atenção! A guild " .. guild:getName() .. " está próxima do domínio do Castle. Guild dominanete defenda o Castle para não perde-lo!")
        end
    end
    return true
end


Error:

Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/COH.lua:onStepIn
data/lib/core/game.lua:109: table index is nil
stack traceback:
        [C]: in function '__newindex'
        data/lib/core/game.lua:109: in function 'setStorageValue'
        data/movements/scripts/COH.lua:27: in function <data/movements/scripts/COH.lua:1>

Lua Script Error: [MoveEvents Interface]
data/movements/scripts/COH.lua:onStepIn
data/lib/core/game.lua:109: table index is nil
stack traceback:
        [C]: in function '__newindex'
        data/lib/core/game.lua:109: in function 'setStorageValue'
        data/movements/scripts/COH.lua:27: in function <data/movements/scripts/COH.lua:1>
 
Error:

Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/COH.lua:onStepIn
data/lib/core/game.lua:109: table index is nil
stack traceback:
        [C]: in function '__newindex'
        data/lib/core/game.lua:109: in function 'setStorageValue'
        data/movements/scripts/COH.lua:27: in function <data/movements/scripts/COH.lua:1>

Lua Script Error: [MoveEvents Interface]
data/movements/scripts/COH.lua:onStepIn
data/lib/core/game.lua:109: table index is nil
stack traceback:
        [C]: in function '__newindex'
        data/lib/core/game.lua:109: in function 'setStorageValue'
        data/movements/scripts/COH.lua:27: in function <data/movements/scripts/COH.lua:1>

Hard to say, is COH.lua the file you are editing?
In that case can you access the variable COH_PREPARE1 and COH_STATUS from it?
 
Hard to say, is COH.lua the file you are editing?
In that case can you access the variable COH_PREPARE1 and COH_STATUS from it?

Follow the files.

COH.lua
Lua:
function onStepIn(player, item, position, fromPosition)
    if not player then
        return true
    end
    local guild = player:getGuild()
    if not player:getGuild() then
        return true
    end
    if item.actionid == 16203 then
        if Game.getStorageValue(COH_STATUS) == guild:getName() then
            player:getPosition():sendMagicEffect(14)
            player:sendTextMessage(4, "[CoH] Membros da guild dominante " .. Game.getStorageValue(COH_STATUS) .. " possuem o privilegio de passar por aqui!")
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Você não pertence á guild dominante " .. Game.getStorageValue(COH_STATUS) .. ".")
        end
        return true
    end
    if item.actionid == 16202 then
        if player:getGuildLevel() > 0 then
            if (Game.getStorageValue(COH_STATUS) ~= guild:getName()) then
                player:sendTextMessage(20, "[Castle of Honor] Você e sua guild estão no comando, os antigos donos [" .. tostring(Game.getStorageValue(COH_STATUS)) .. "] podem se vingar!")
                Game.setStorageValue(COH_PREPARE1, -1)
                Game.setStorageValue(COH_PREPARE2, -1)
                Game.setStorageValue(COH_STATUS, guild:getName())
                doCastleRemoveEnemies()
                Game.broadcastMessage("[Castle of Honor] O jogador [" .. player:getName() .. "] e sua guild [" .. guild:getName() .. "] estão agora no comando do castelo. Tente dominar o Castle ou os aceite como governantes!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Você não possui uma guild.")
        end
        return true
    end
    if item.actionid == 16200 then
        if player:getGuildLevel() > 0 then
            player:sendTextMessage(4, "CoH Invasion Camp!")
            if (Game.getStorageValue(COH_PREPARE1) ~= guild:getName()) and ((Game.getStorageValue(COH_PREPARE2) ~= guild:getName())) then
                Game.setStorageValue(COH_PREPARE1, guild:getName())
                Game.broadcastMessage("[Castle of Honor] Atenção! A guild " .. guild:getName() .. " está indo em direção ao Castelo. Guild dominante preparem-se!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Você não possui uma guild.")  
            return true
        end  
    end
    if item.actionid == 16201 then
        player:sendTextMessage("CoH Invasion Castle!")
        if (Game.getStorageValue(COH_PREPARE2) ~= guild:getName()) then
            Game.setStorageValue(COH_PREPARE2, guild:getName())
            Game.broadcastMessage("[Castle of Honor] Atenção! A guild " .. guild:getName() .. " está próxima do domínio do Castle. Guild dominanete defenda o Castle para não perde-lo!")
        end
    end
    return true
end


data/lib/015-COH.lua

Lua:
COH_PUSHTIME = 10800 -- Tempo (em segundos) de exhausted para usar o comando !gocastle - Padrão (3 horas)
COH_AREA = {{x = 1001, y = 1025, z = 7}, {x = 1058, y = 1045, z = 7}} -- Canto superior esquerdo / inferior direito do Castle

-- // Não mexa daqui para baixo
COH_STATUS = 201320111714
COH_PREPARE1 = 201320111715
COH_PUSHSTOR = 201320111716
COH_PREPARE2 = 201320111717

function doCastleRemoveEnemies()

 for index, creature in ipairs(getPlayersOnline()) do
  if isInArea(getThingPos(creature), COH_AREA[1], COH_AREA[2]) then
   if getPlayerGuildName(creature) ~= getGlobalStorageValue(COH_STATUS) then
    doTeleportThing(creature, getTownTemplePosition(getPlayerTown(creature)))
   end
  end
 end
 return true
end
 
Follow the files.

COH.lua
Lua:
function onStepIn(player, item, position, fromPosition)
    if not player then
        return true
    end
    local guild = player:getGuild()
    if not player:getGuild() then
        return true
    end
    if item.actionid == 16203 then
        if Game.getStorageValue(COH_STATUS) == guild:getName() then
            player:getPosition():sendMagicEffect(14)
            player:sendTextMessage(4, "[CoH] Membros da guild dominante " .. Game.getStorageValue(COH_STATUS) .. " possuem o privilegio de passar por aqui!")
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Você não pertence á guild dominante " .. Game.getStorageValue(COH_STATUS) .. ".")
        end
        return true
    end
    if item.actionid == 16202 then
        if player:getGuildLevel() > 0 then
            if (Game.getStorageValue(COH_STATUS) ~= guild:getName()) then
                player:sendTextMessage(20, "[Castle of Honor] Você e sua guild estão no comando, os antigos donos [" .. tostring(Game.getStorageValue(COH_STATUS)) .. "] podem se vingar!")
                Game.setStorageValue(COH_PREPARE1, -1)
                Game.setStorageValue(COH_PREPARE2, -1)
                Game.setStorageValue(COH_STATUS, guild:getName())
                doCastleRemoveEnemies()
                Game.broadcastMessage("[Castle of Honor] O jogador [" .. player:getName() .. "] e sua guild [" .. guild:getName() .. "] estão agora no comando do castelo. Tente dominar o Castle ou os aceite como governantes!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Você não possui uma guild.")
        end
        return true
    end
    if item.actionid == 16200 then
        if player:getGuildLevel() > 0 then
            player:sendTextMessage(4, "CoH Invasion Camp!")
            if (Game.getStorageValue(COH_PREPARE1) ~= guild:getName()) and ((Game.getStorageValue(COH_PREPARE2) ~= guild:getName())) then
                Game.setStorageValue(COH_PREPARE1, guild:getName())
                Game.broadcastMessage("[Castle of Honor] Atenção! A guild " .. guild:getName() .. " está indo em direção ao Castelo. Guild dominante preparem-se!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Você não possui uma guild.") 
            return true
        end 
    end
    if item.actionid == 16201 then
        player:sendTextMessage("CoH Invasion Castle!")
        if (Game.getStorageValue(COH_PREPARE2) ~= guild:getName()) then
            Game.setStorageValue(COH_PREPARE2, guild:getName())
            Game.broadcastMessage("[Castle of Honor] Atenção! A guild " .. guild:getName() .. " está próxima do domínio do Castle. Guild dominanete defenda o Castle para não perde-lo!")
        end
    end
    return true
end


data/lib/015-COH.lua

Lua:
COH_PUSHTIME = 10800 -- Tempo (em segundos) de exhausted para usar o comando !gocastle - Padrão (3 horas)
COH_AREA = {{x = 1001, y = 1025, z = 7}, {x = 1058, y = 1045, z = 7}} -- Canto superior esquerdo / inferior direito do Castle

-- // Não mexa daqui para baixo
COH_STATUS = 201320111714
COH_PREPARE1 = 201320111715
COH_PUSHSTOR = 201320111716
COH_PREPARE2 = 201320111717

function doCastleRemoveEnemies()

 for index, creature in ipairs(getPlayersOnline()) do
  if isInArea(getThingPos(creature), COH_AREA[1], COH_AREA[2]) then
   if getPlayerGuildName(creature) ~= getGlobalStorageValue(COH_STATUS) then
    doTeleportThing(creature, getTownTemplePosition(getPlayerTown(creature)))
   end
  end
 end
 return true
end

Did the script work prior to the "update"?
If not try adding a dofile("path_to_file")
 
Follow the files.

COH.lua
Lua:
function onStepIn(player, item, position, fromPosition)
    if not player then
        return true
    end
    local guild = player:getGuild()
    if not player:getGuild() then
        return true
    end
    if item.actionid == 16203 then
        if Game.getStorageValue(COH_STATUS) == guild:getName() then
            player:getPosition():sendMagicEffect(14)
            player:sendTextMessage(4, "[CoH] Membros da guild dominante " .. Game.getStorageValue(COH_STATUS) .. " possuem o privilegio de passar por aqui!")
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Você não pertence á guild dominante " .. Game.getStorageValue(COH_STATUS) .. ".")
        end
        return true
    end
    if item.actionid == 16202 then
        if player:getGuildLevel() > 0 then
            if (Game.getStorageValue(COH_STATUS) ~= guild:getName()) then
                player:sendTextMessage(20, "[Castle of Honor] Você e sua guild estão no comando, os antigos donos [" .. tostring(Game.getStorageValue(COH_STATUS)) .. "] podem se vingar!")
                Game.setStorageValue(COH_PREPARE1, -1)
                Game.setStorageValue(COH_PREPARE2, -1)
                Game.setStorageValue(COH_STATUS, guild:getName())
                doCastleRemoveEnemies()
                Game.broadcastMessage("[Castle of Honor] O jogador [" .. player:getName() .. "] e sua guild [" .. guild:getName() .. "] estão agora no comando do castelo. Tente dominar o Castle ou os aceite como governantes!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Você não possui uma guild.")
        end
        return true
    end
    if item.actionid == 16200 then
        if player:getGuildLevel() > 0 then
            player:sendTextMessage(4, "CoH Invasion Camp!")
            if (Game.getStorageValue(COH_PREPARE1) ~= guild:getName()) and ((Game.getStorageValue(COH_PREPARE2) ~= guild:getName())) then
                Game.setStorageValue(COH_PREPARE1, guild:getName())
                Game.broadcastMessage("[Castle of Honor] Atenção! A guild " .. guild:getName() .. " está indo em direção ao Castelo. Guild dominante preparem-se!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Você não possui uma guild.")
            return true
        end
    end
    if item.actionid == 16201 then
        player:sendTextMessage("CoH Invasion Castle!")
        if (Game.getStorageValue(COH_PREPARE2) ~= guild:getName()) then
            Game.setStorageValue(COH_PREPARE2, guild:getName())
            Game.broadcastMessage("[Castle of Honor] Atenção! A guild " .. guild:getName() .. " está próxima do domínio do Castle. Guild dominanete defenda o Castle para não perde-lo!")
        end
    end
    return true
end


data/lib/015-COH.lua

Lua:
COH_PUSHTIME = 10800 -- Tempo (em segundos) de exhausted para usar o comando !gocastle - Padrão (3 horas)
COH_AREA = {{x = 1001, y = 1025, z = 7}, {x = 1058, y = 1045, z = 7}} -- Canto superior esquerdo / inferior direito do Castle

-- // Não mexa daqui para baixo
COH_STATUS = 201320111714
COH_PREPARE1 = 201320111715
COH_PUSHSTOR = 201320111716
COH_PREPARE2 = 201320111717

function doCastleRemoveEnemies()

 for index, creature in ipairs(getPlayersOnline()) do
  if isInArea(getThingPos(creature), COH_AREA[1], COH_AREA[2]) then
   if getPlayerGuildName(creature) ~= getGlobalStorageValue(COH_STATUS) then
    doTeleportThing(creature, getTownTemplePosition(getPlayerTown(creature)))
   end
  end
 end
 return true
end
did you add it to core.lua using dofile?
lib/core/coh.lua -> the script you posted before in your lib
lib/core/core.lua -> dofile("data/lib/core/coh.lua")
 
did you add it to core.lua using dofile?
lib/core/coh.lua -> the script you posted before in your lib
lib/core/core.lua -> dofile("data/lib/core/coh.lua")
The coh.lua is in movements







Did the script work prior to the "update"?
If not try adding a dofile("path_to_file")
It is for version 9.8, and I wanted to convert
 
i said the coh.lua from your lib not movements
ill give you the exact thing you said though just in case

data/lib/015-COH.lua


Woow bro,
It worked, a problem that is happening is. That when the player does not have guild he can but has the check so he can not .. what will it be?

Hard to say, is COH.lua the file you are editing?
In that case can you access the variable COH_PREPARE1 and COH_STATUS from it?
I have a problem, player that does not have guild can enter into the positions ie:
Does not work checking if it has guild, could you help me?

Lua:
-- // Não mexa daqui para baixo
COH_STATUS = 201320111714
COH_PREPARE1 = 201320111715
COH_PUSHSTOR = 201320111716
COH_PREPARE2 = 201320111717

function doCastleRemoveEnemies()

for index, creature in ipairs(getPlayersOnline()) do
  if isInArea(getThingPos(creature), COH_AREA[1], COH_AREA[2]) then
   if getPlayerGuildName(creature) ~= getGlobalStorageValue(COH_STATUS) then
    doTeleportThing(creature, getTownTemplePosition(getPlayerTown(creature)))
   end
  end
end
return true
end

Friends, what is happening is that when the player is without guild can get into the castle war, and does not work the verification, I wanted him not to enter, only with guild. can you help me?

Lua:
dofile('data/lib/core/015-COH.lua')

function onStepIn(player, item, position, fromPosition)
    if not player then
        return true
    end
    local guild = player:getGuild()
    if not player:getGuild() then
        return true
    end
    if item.actionid == 16203 then
        if Game.getStorageValue(COH_STATUS) == guild:getName() then
            player:getPosition():sendMagicEffect(14)
            player:sendTextMessage(4, "[CoH] Membros da guild dominante " .. Game.getStorageValue(COH_STATUS) .. " possuem o privilegio de passar por aqui!")
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Voce nao pertence a guild dominante " .. Game.getStorageValue(COH_STATUS) .. ".")
        end
        return true
    end
    if item.actionid == 16202 then
        if player:getGuildLevel() > 0 then
            if (Game.getStorageValue(COH_STATUS) ~= guild:getName()) then
                player:sendTextMessage(20, "[Castle of Honor] Voce e sua guild estao no comando, os antigos donos [" .. tostring(Game.getStorageValue(COH_STATUS)) .. "] podem se vingar!")
                Game.setStorageValue(COH_PREPARE1, -1)
                Game.setStorageValue(COH_PREPARE2, -1)
                Game.setStorageValue(COH_STATUS, guild:getName())
                doCastleRemoveEnemies()
                Game.broadcastMessage("[Castle of Honor] O jogador [" .. player:getName() .. "] e sua guild [" .. guild:getName() .. "] estao agora no comando do castelo. Tente dominar o Castle ou os aceite como governantes!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Voce nao possui uma guild.")
        end
        return true
    end
    if item.actionid == 16200 then
        if player:getGuildLevel() > 0 then
            player:sendTextMessage(4, "CoH Invasion Camp!")
            if (Game.getStorageValue(COH_PREPARE1) ~= guild:getName()) and ((Game.getStorageValue(COH_PREPARE2) ~= guild:getName())) then
                Game.setStorageValue(COH_PREPARE1, guild:getName())
                Game.broadcastMessage("[Castle of Honor] Atençao! A guild " .. guild:getName() .. " está indo em direcao ao Castelo. Guild dominante preparem-se!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Voce nao possui uma guild.") 
            return true
        end 
    end
    if item.actionid == 16201 then
        player:sendTextMessage("CoH Invasion Castle!")
        if (Game.getStorageValue(COH_PREPARE2) ~= guild:getName()) then
            Game.setStorageValue(COH_PREPARE2, guild:getName())
            Game.broadcastMessage("[Castle of Honor] Atencao! A guild " .. guild:getName() .. " esta próxima do dominio do Castle. Guild dominanete defenda o Castle para nao perde-lo!")
        end
    end
    return true
end
 
Last edited by a moderator:
Lua:
-- // Não mexa daqui para baixo
COH_STATUS = 201320111714
COH_PREPARE1 = 201320111715
COH_PUSHSTOR = 201320111716
COH_PREPARE2 = 201320111717

function doCastleRemoveEnemies()

for index, creature in ipairs(getPlayersOnline()) do
  if isInArea(getThingPos(creature), COH_AREA[1], COH_AREA[2]) then
   if getPlayerGuildName(creature) ~= getGlobalStorageValue(COH_STATUS) then
    doTeleportThing(creature, getTownTemplePosition(getPlayerTown(creature)))
   end
  end
end
return true
end

Lua:
COH_STATUS = 201320111714
COH_PREPARE1 = 201320111715
COH_PUSHSTOR = 201320111716
COH_PREPARE2 = 201320111717

function doCastleRemoveEnemies()
    for index, player in ipairs(Game.getPlayers()) do
        if isInArea(player:getPosition(), COH_AREA[1], COH_AREA[2]) then
            local guild = player:getGuild()
            if guild and guild:getName() ~= Game.getStorageValue(COH_STATUS) then
                player:teleportTo(player:getTown():getTemplePosition())
            end
        end
    end
    return true
end
 
Lua:
COH_STATUS = 201320111714
COH_PREPARE1 = 201320111715
COH_PUSHSTOR = 201320111716
COH_PREPARE2 = 201320111717

function doCastleRemoveEnemies()
    for index, player in ipairs(Game.getPlayers()) do
        if isInArea(player:getPosition(), COH_AREA[1], COH_AREA[2]) then
            local guild = player:getGuild()
            if guild and guild:getName() ~= Game.getStorageValue(COH_STATUS) then
                player:teleportTo(player:getTown():getTemplePosition())
            end
        end
    end
    return true
end
Thx!

Guys, can anyone help me in my castle guild war ?, What's going on?

It does not check if the player has guild or not, so he can enter the area that is dominated by a guild without guild.
 
Last edited by a moderator:
Atleast post your TFS version all the scripts that are related to the castle guild war -.- we aren't psychic you know...
 
Atleast post your TFS version all the scripts that are related to the castle guild war -.- we aren't psychic you know...
movements/COH.lua

Lua:
dofile('data/lib/core/015-COH.lua')

function onStepIn(player, item, position, fromPosition)
    if not player then
        return true
    end
    local guild = player:getGuild()
    if not player:getGuild() then
        return true
    end
    if item.actionid == 16203 then
        if Game.getStorageValue(COH_STATUS) == guild:getName() then
            player:getPosition():sendMagicEffect(14)
            player:sendTextMessage(4, "[CoH] Membros da guild dominante " .. Game.getStorageValue(COH_STATUS) .. " possuem o privilegio de passar por aqui!")
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Voce nao pertence a guild dominante " .. Game.getStorageValue(COH_STATUS) .. ".")
        end
        return true
    end
    if item.actionid == 16202 then
        if player:getGuildLevel() > 0 then
            if guild and guild:getName() ~= Game.getStorageValue(COH_STATUS) then
                player:sendTextMessage(20, "[Castle of Honor] Voce e sua guild estao no comando, os antigos donos [" .. tostring(Game.getStorageValue(COH_STATUS)) .. "] podem se vingar!")
                Game.setStorageValue(COH_PREPARE1, -1)
                Game.setStorageValue(COH_PREPARE2, -1)
                Game.setStorageValue(COH_STATUS, guild:getName())
                doCastleRemoveEnemies()
                Game.broadcastMessage("[Castle of Honor] O jogador [" .. player:getName() .. "] e sua guild [" .. guild:getName() .. "] estao agora no comando do castelo. Tente dominar o Castle ou os aceite como governantes!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Voce nao possui uma guild.")
        end
        return true
    end
    if item.actionid == 16200 then
        if player:getGuildLevel() > 0 then
            player:sendTextMessage(4, "CoH Invasion Camp!")
            if (Game.getStorageValue(COH_PREPARE1) ~= guild:getName()) and ((Game.getStorageValue(COH_PREPARE2) ~= guild:getName())) then
                Game.setStorageValue(COH_PREPARE1, guild:getName())
                Game.broadcastMessage("[Castle of Honor] Atençao! A guild " .. guild:getName() .. " está indo em direcao ao Castelo. Guild dominante preparem-se!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Voce nao possui uma guild.") 
            return true
        end 
    end
    if item.actionid == 16201 then
        player:sendTextMessage("CoH Invasion Castle!")
        if (Game.getStorageValue(COH_PREPARE2) ~= guild:getName()) then
            Game.setStorageValue(COH_PREPARE2, guild:getName())
            Game.broadcastMessage("[Castle of Honor] Atencao! A guild " .. guild:getName() .. " esta próxima do dominio do Castle. Guild dominanete defenda o Castle para nao perde-lo!")
        end
    end
    return true
end


lib/015-COH.lua
Lua:
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.

-- //

COH_PUSHTIME = 10800 -- Tempo (em segundos) de exhausted para usar o comando !gocastle - Padrão (3 horas)
COH_AREA = {{x = 1001, y = 1025, z = 7}, {x = 1058, y = 1045, z = 7}} -- Canto superior esquerdo / inferior direito do Castle

-- // Não mexa daqui para baixo
COH_STATUS = 201320111714
COH_PREPARE1 = 201320111715
COH_PUSHSTOR = 201320111716
COH_PREPARE2 = 201320111717

function doCastleRemoveEnemies()
    for index, player in ipairs(Game.getPlayers()) do
        if isInArea(player:getPosition(), COH_AREA[1], COH_AREA[2]) then
            local guild = player:getGuild()
            if guild and guild:getName() ~= Game.getStorageValue(COH_STATUS) then
                player:teleportTo(player:getTown():getTemplePosition())
            end
        end
    end
    return true
end
 
movements/COH.lua

Lua:
dofile('data/lib/core/015-COH.lua')

function onStepIn(player, item, position, fromPosition)
    if not player then
        return true
    end
    local guild = player:getGuild()
    if not player:getGuild() then
        return true
    end
    if item.actionid == 16203 then
        if Game.getStorageValue(COH_STATUS) == guild:getName() then
            player:getPosition():sendMagicEffect(14)
            player:sendTextMessage(4, "[CoH] Membros da guild dominante " .. Game.getStorageValue(COH_STATUS) .. " possuem o privilegio de passar por aqui!")
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Voce nao pertence a guild dominante " .. Game.getStorageValue(COH_STATUS) .. ".")
        end
        return true
    end
    if item.actionid == 16202 then
        if player:getGuildLevel() > 0 then
            if guild and guild:getName() ~= Game.getStorageValue(COH_STATUS) then
                player:sendTextMessage(20, "[Castle of Honor] Voce e sua guild estao no comando, os antigos donos [" .. tostring(Game.getStorageValue(COH_STATUS)) .. "] podem se vingar!")
                Game.setStorageValue(COH_PREPARE1, -1)
                Game.setStorageValue(COH_PREPARE2, -1)
                Game.setStorageValue(COH_STATUS, guild:getName())
                doCastleRemoveEnemies()
                Game.broadcastMessage("[Castle of Honor] O jogador [" .. player:getName() .. "] e sua guild [" .. guild:getName() .. "] estao agora no comando do castelo. Tente dominar o Castle ou os aceite como governantes!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Voce nao possui uma guild.")
        end
        return true
    end
    if item.actionid == 16200 then
        if player:getGuildLevel() > 0 then
            player:sendTextMessage(4, "CoH Invasion Camp!")
            if (Game.getStorageValue(COH_PREPARE1) ~= guild:getName()) and ((Game.getStorageValue(COH_PREPARE2) ~= guild:getName())) then
                Game.setStorageValue(COH_PREPARE1, guild:getName())
                Game.broadcastMessage("[Castle of Honor] Atençao! A guild " .. guild:getName() .. " está indo em direcao ao Castelo. Guild dominante preparem-se!")
            end
        else
            player:getPosition():sendMagicEffect(2)
            player:teleportTo(fromPosition, false)
            player:sendCancelMessage("[CoH] Voce nao possui uma guild.")
            return true
        end
    end
    if item.actionid == 16201 then
        player:sendTextMessage("CoH Invasion Castle!")
        if (Game.getStorageValue(COH_PREPARE2) ~= guild:getName()) then
            Game.setStorageValue(COH_PREPARE2, guild:getName())
            Game.broadcastMessage("[Castle of Honor] Atencao! A guild " .. guild:getName() .. " esta próxima do dominio do Castle. Guild dominanete defenda o Castle para nao perde-lo!")
        end
    end
    return true
end


lib/015-COH.lua
Lua:
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.

-- //

COH_PUSHTIME = 10800 -- Tempo (em segundos) de exhausted para usar o comando !gocastle - Padrão (3 horas)
COH_AREA = {{x = 1001, y = 1025, z = 7}, {x = 1058, y = 1045, z = 7}} -- Canto superior esquerdo / inferior direito do Castle

-- // Não mexa daqui para baixo
COH_STATUS = 201320111714
COH_PREPARE1 = 201320111715
COH_PUSHSTOR = 201320111716
COH_PREPARE2 = 201320111717

function doCastleRemoveEnemies()
    for index, player in ipairs(Game.getPlayers()) do
        if isInArea(player:getPosition(), COH_AREA[1], COH_AREA[2]) then
            local guild = player:getGuild()
            if guild and guild:getName() ~= Game.getStorageValue(COH_STATUS) then
                player:teleportTo(player:getTown():getTemplePosition())
            end
        end
    end
    return true
end

Merged all of your threads, don't create new ones use the same one if they are related to the same issue.
 
Back
Top