• 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!

How i automatize this castle war event?

kamikashi

New Member
Joined
Oct 2, 2011
Messages
9
Reaction score
0
I want automatize this event (one day, start time and end the event ) ,

this is the script :

data/lib/050-functions.lua ache a função isInArea, delete and put this:

function isInArea(arr, arr1, arr2)

if (arr.x <= arr1.x and arr.x >= arr2.x) or (arr.x >= arr1.x and arr.x <= arr2.x) then
if (arr.y <= arr1.y and arr.y >= arr2.y) or (arr.y >= arr1.y and arr.y <= arr2.y) then
if (arr.z <= arr1.z and arr.z >= arr2.z) or (arr.z >= arr1.z and arr.z <= arr2.z) then
return TRUE
end
end
end

return FALSE
end

Data/actions/scripts/ create archive castlewar-action.lua and put this :

local storage = 1755
local emGuerra = 1756

function onUse(cid, item, frompos, item2, topos)
if getPlayerGuildId(cid) == nil or getPlayerGuildId(cid) <= 0 or getPlayerGuildId(cid) == false then
return doPlayerSendCancel(cid,"Voce precisa de uma guild para dominar o castelo!")
end
if getGlobalStorageValue(emGuerra) <= 0 then
return doPlayerSendCancel(cid,"O Castelo nao está em guerra!")
end

if getPlayerGuildId(cid) == getGlobalStorageValue(storage) then
return doPlayerSendCancel(cid,"Sua guild ja está dominando o castelo!")
end

setGlobalStorageValue(storage,getPlayerGuildId(cid))
doBroadcastMessage("A Guild ".. getPlayerGuildName(cid) .." dominou o castelo!",22)
return true
end

Data/actions/actions.xml put this:

<action actionid="1755" script="castlewar-action.lua" />

data/movements/scripts/ create archive castlewar-movements.lua and put this:

local storage = 1755
local emGuerra = 1756
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if getGlobalStorageValue(storage) == getPlayerGuildId(cid) then
return true
end

if getGlobalStorageValue(emGuerra) == 1 then
return true
else
doTeleportThing(cid,fromPosition,false)
return doPlayerSendCancel(cid,"Por favor espere a batalha começar!")
end

return true
end

data/movements/movements.xml put this:

<movevent type="StepIn" actionid="1756" event="script" value="castlewar-movements.lua"/>

data/talkactions/scripts/ create archive castlewar-talk.lua and put this:

local storage = 1755
local emGuerra = 1756
local firstpos = {x = 582,y = 1290,z = 7}
local secondpos = {x = 802,y = 1490,z = 0}
function onSay(cid, words, param)
if param == "open" then
setGlobalStorageValue(emGuerra,1)
doBroadcastMessage("A Guerra pelo castelo começou!",22)
return true
elseif param == "close" then
for _, pid in ipairs(getPlayersOnline()) do
if isInArea(getCreaturePosition(pid),firstpos,secondpos)then
if getGlobalStorageValue(storage) ~= getPlayerGuildId(pid) then
doTeleportThing(pid,getTownTemplePosition(getPlayerTown(pid)))
doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE,"Desculpe mas sua guild não venceu essa guerra!")
else
doPlayerSendTextMessage(pid,MESSAGE_STATUS_CONSOLE_BLUE,"Sua guild conseguio dominar o castelo. Parabens por ajuda-la!")
end
end
end
setGlobalStorageValue(emGuerra,0)
doBroadcastMessage("A Guerra pelo castelo terminou!",22)
else
return doPlayerSendCancel(cid,"Digite !war open[inicia a guerra] ou !war close[terminaa guerra]")
end
return true
end

data/talkactions/talkactions.xml add this:

<talkaction log="yes" words="!war" access="5" event="script" value="castlewar-talk.lua"/>

removed from brazilian forum,
 
Back
Top