The way it works
Gm says !open This will open the event, and tell the players its open, and to say !rush.
Players say !rush, they get teleported into team (if red is more then they go blue) vice-versa
When the game is full, the gm will say !start to open the door, and start the event.
When the deathLimit is reached, or a GM says !end, the event will end, and kick everyone out.
Here it is!
This is your talkaction script. name it rushEvent
Now in your creaturescripts make these files:
rushDeath
antiTeamKill
antiSkull
last killedPlayer
In your login.lua put these
Now in globalevents make a file called checkDeaths
There you have it. If you know how to but Tibias function into scripts, you will be able to edit this event in anyway you want.
Gm says !open This will open the event, and tell the players its open, and to say !rush.
Players say !rush, they get teleported into team (if red is more then they go blue) vice-versa
When the game is full, the gm will say !start to open the door, and start the event.
When the deathLimit is reached, or a GM says !end, the event will end, and kick everyone out.
Here it is!
This is your talkaction script. name it rushEvent
Lua:
--------Death limit------------
local deathLimit = 250
---------Winners--------------
local items = {2557} -- you can make this as many items you want, it will math.radom the items. --
---------Can Start Events?-----
local Allowed_To_Start_Events = 4 --They must have this access to start events--
----------EVENTS---------------
local RUSH = rushEvent
---------------------------------------------RUSH-----Red vs. Blue-----------------------
-----------------------------------------------------CONFIG--------------------------
local myOutfit = getCreatureOutfit(cid)
local red = {lookType = myOutfit.lookType, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = myOutfit.lookAddons}
local blue = {lookType = myOutfit.lookType, lookHead = 86, lookBody = 86, lookLegs = 86, lookFeet = 86, lookTypeEx = 0, lookAddons = myOutfit.lookAddons}
------------EVENT POSITION---------------
local eventTop.xyz = {x = 1000, y = 1000, z = 7, stackpos = 253}
local eventBottom.xyz = {x = 1000, y = 1000, z = 7, stackpos = 253}
local eventPosition = eventTop.xyz, eventBottom.xyz
------------Red Team Position------------
local redTopleft.xyz = {x = 1000, y = 1000, z = 7}
local redBottomright.xyz = {x = 1000, y = 1000, z = 7}
local redPosition = redTopleft.xyz, redBottomRight.xyz
---------Blue Team Position---------------
local blueTopleft.xyz = {x = 1000, y = 1000, z = 7}
local blueBottomleft.xyz = {x = 1000, y = 1000, z = 7}
local bluePosition = blueTopleft.xyz, blueBottomRight.xyz
------------DOORS------------
local bdoor = {x = 1000, y = 1000, z = 7}
local blueDoor = getItemFromPos(bdoor)
local bdoorItem = 5712 -- Set this to the door item id you want for blue team. --
local rdoor = {x = 1000, y = 1000, z = 7}
local blueDoor = getItemFromPos(rdoor)
local rdoorItem = 5713 -- Set this to the door item id you want for red team. --
------------TEAMS------------------------
local redStorage = redteamstorage
local blueStorage = blueteamstorage
-----------Max Players Per Team----------
local full_event = 30
--------Ignore----------
local t = string.explode(param, ",")
-------------EDIT THIS-----------
local fullMSG = "The event is full!"
local redMSG = "You have joined the red team!"
local blueMSG = "You have joined the blue team!"
local openMSG = "RUSH IS NOW OPEN! Type !rush to enter the event!"
local typeMSG = MESSAGE_STATUS_CONSOLE_RED
local redME = 10 -- red team magic effect--
local blueME = 11 -- blue team magic effect--
--------------MISC-------------------
local outOfEvent = {x = 1000, y = 1000, z = 7} -- Keep in mind you can make this getPlayerTown(cid) --
local players = getThingFromPos(eventPosition)
----------------WORDS------------------
local wordsToOpen = "!open"
local wordsToStart = "!start"
local wordsToEnd = "!end"
local joinRush = "!rush"
local function setPlayerRushStatus()
if getPlayerStorageValue(players) ~= rushPlayer then
doPlayerSetLossPercent(cid, 1, 0)
setPlayerStorageValue(cid, rushPlayer, 1)
end
end
function onSay(cid, word, param)
if (param == wordsToOpen) then
if getPlayerAccess(cid) >= Allowed_To_Start_Events then
if getGlobalStorageValue(RUSH) ~= 1 then
doBroadcastMessage(openMSG, 1)
setGlobalStorageValue(RUSH, 1)
setGlobalStorageValue(blueDeaths, deathLimit)
setGlobalStorageValue(redDeaths, deathLimit)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have started the event Red Vs. Blue!")
else
doPlayerSendCancel(cid, "The event is already started.")
return false
end
else
doPlayerSendCancel(cid, "You cannot use this command.")
return false
end
elseif (param == joinRush) then
if getGlobalStorageValue(RUSH) == 1 then
if getGlobalStorageValue(redStorage) and getGlobalStorageValue(blueStorage) == full_event then
doPlayerSendCancel(cid, fullMSG)
return false
end
if getGlobalStorageValue(redStorage) > getGlobalStorageValue(blueStorage) then
doTeleportThing(cid, bluePosition)
setGlobalStorage(blueStorage) + 1
doPlayerSendTextMessage(cid, typeMSG, blueMSG)
doSendMagicEffect(getPlayerPosition(cid), blueME)
setPlayerRushStatus()
setPlayerStorageValue(cid, rushTeam, 2)
doCreatureChangeOutfit(cid, blue)
else
doTeleportThing(cid, redPosition)
setGlobalStorage(redStorage) + 1
doPlayerSendTextMessage(cid, typeMSG, redMSG)
doSendMagicEffect(getPlayerPosition(cid), redME)
setPlayerRushStatus()
setPlayerStorageValue(cid, rushTeam, 1)
doCreatureChangeOutfit(cid, red)
end
else
doPlayerSendCancel(cid, "This event is not open!")
return false
end
elseif (param == wordToEnd) then
if getPlayerAccess(cid) >= Access_To_Start_Events then
if getGlobalStorageValue(RUSH) == 1 then
setGlobalStorageValue(RUSH, 0)
doTransformItem(bdoor, bdoorItem)
doTransformItem(rdoor, rdoorItem)
if (isPlayer(players)) then
for i, pid in ipairs(players) do
setPlayerStorageValue(pid, rushPlayer, 0)
doTeleportThing(pid, outOfEvent)
doPlayerSetLossPercent(pid, 1, 100)
if getPlayerStorageValue(pid, rushTeam) == 1 or 2 then
setPlayerStorageValue(pid, rushTeam, 0)
end
if getPlayerStorageValue(pid, rushPlayer) == 1 or 2 then
setPlayerStorageValue(pid, rushPlayer, 0)
end
if getPlayerStorageValue(pid, rushWinner) then
setPlayerStorageValue(pid, rushWinner, 0)
doPlayerAddItem(pid, math.random(items), 1)
if math.random(item) == 1 then
doPlayerAddItem(pid, items[1], 1)
end
end
else
return false
end
else
doPlayerSendCancel(cid, "There is no event running!")
return false
end
else
doPlayerSendCancel(cid, "You cannot use this command.")
return false
end
elseif (param == wordToStart) then
if getPlayerAccess(cid) >= Access_To_Start_Events then
if getGlobalStorageValue(RUSH) == 1 then
if getGlobalStorage(blueStorage) and getGlobalStorage(redStorage) == full_event then
doTransformItem(bdoorItem, bdoorOpen)
doTransformItem(rdoorItem, rdoorOpen)
else
doPlayerSendCancel(cid, "The event is not full!")
return false
end
else
doPlayerSendCancel(cid, "The event is not open!")
return false
end
else
doPlayerSendCancel(cid, "You cannot use this command.")
return false
end
end
return true
end
Code:
<talkaction log="no" words="!open;!start;!end;!rush" event="script" value="rushEvent"/>
Now in your creaturescripts make these files:
rushDeath
Lua:
------------Red Team Position------------
local redTopleft.xyz = {x = 1000, y = 1000, z = 7}
local redBottomright.xyz = {x = 1000, y = 1000, z = 7}
local redPosition = redTopleft.xyz, redBottomRight.xyz
---------Blue Team Position---------------
local blueTopleft.xyz = {x = 1000, y = 1000, z = 7}
local blueBottomleft.xyz = {x = 1000, y = 1000, z = 7}
local bluePosition = {x = 1000, y = 1000, z = 7}
local msgDeath = "You have died during the rush event. You have been teleported back to your teams side!"
function onDeath(cid)
if getPlayerStorageValue(cid, rushPlayer) == 1 then
if getPlayerStorageValue(cid, blueRusher) == 1 then
doTeleportThing(cid, bluePosition)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, msgDeath)
else
doTeleportThing(cid, redPosition)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, msgDeath)
end
end
end
antiTeamKill
Lua:
function onAttack(cid, target)
if(getGlobalStorageValue(RUSH) == 1) then
if isPlayer(cid) and isPlayer(target) then
if getPlayerStorageValue(cid, rushTeam) == getPlayerStorageValue(target, rushTeam) then
doPlayerSendCancel(cid, "Sorry, you cannot attack your own team.")
end
end
end
return true
end
antiSkull
Lua:
function onAttack(cid, target)
if(getGlobalStorageValue(RUSH) == 1) then
if isPlayer(cid) and isPlayer(target) then
if getPlayerStorageValue(cid, rushTeam) == getPlayerStorageValue(target, rushTeam) then
doPlayerSendCancel(cid, "Sorry, you cannot attack your own team.")
end
end
end
return true
end
last killedPlayer
Lua:
function onKill(cid, target)
if (isPlayer(cid) then
if getPlayerStorageValue(cid, rushTeam, 1) and getPlayerStorageValue(target, rushTeam, 2) then
setGlobalStorageValue(redDeaths) - 1
elseif getPlayerStorageValue(cid, rushTeam, 2) and getPlayerStorageValue(target, rushTeam, 1) then
setGlobalStorageValue(blueDeaths) - 1
end
end
end
Code:
<event type="death" name="rushDeath" event="script" value="rushDeath.lua"/>
<event type="kill" name="antiSkull" event="script" value="antiSkull.lua"/>
<event type="target" name="antiTeamKill" event="script" value="antiTeamKill.lua"/>
In your login.lua put these
Code:
registerCreatureEvent(cid, "rushDeath")
registerCreatureEvent(cid, "antiTeamKill")
registerCreatureEvent(cid, "antiSkull")
registerCreatureEvent(cid, "killedPlayer")
Now in globalevents make a file called checkDeaths
Lua:
local items = {2557}
local eventTop.xyz = {x = 1000, y = 1000, z = 7, stackpos = 253}
local eventBottom.xyz = {x = 1000, y = 1000, z = 7, stackpos = 253}
local eventPosition = eventTop.xyz, eventBottom.xyz
local outOfEvent = {x = 1000, y = 1000, z = 7}
local players = getThingfromPos(eventPosition)
function onThink(intravel)
if getGlobalStorageValue(cid, rushEvent) == 1 then
if getGlobalStorageValue(cid, redDeaths) == 0 or getGlobalStorageValue(cid, blueDeaths) == 0 then
for i, pid in ipairs(players) do
if (isPlayer(players)) then
setPlayerStorageValue(pid, rushPlayer, 0)
doTeleportThing(pid, outOfEvent)
doPlayerSetLossPercent(pid, 1, 100)
if getPlayerStorageValue(pid, rushTeam) == 1 or 2 then
setPlayerStorageValue(pid, rushTeam, 0)
end
if getPlayerStorageValue(pid, rushPlayer) == 1 or 2 then
setPlayerStorageValue(pid, rushPlayer, 0)
end
if getPlayerStorageValue(pid, rushWinner) then
setPlayerStorageValue(pid, rushWinner, 0)
doPlayerAddItem(pid, math.random(items), 1)
if math.random(item) == 1 then
doPlayerAddItem(pid, items[1], 1)
end
end
end
end
end
end
Code:
<globalevent name="check" interval="1" event="script" value="checkDeaths.lua"/>
There you have it. If you know how to but Tibias function into scripts, you will be able to edit this event in anyway you want.