zabuzo
Well-Known Member
- Joined
- Jun 10, 2016
- Messages
- 238
- Reaction score
- 54
I miss dugeon system on OTs.
I wanna make a server based in dugeon system.
I made this pseudo code to this dugeon system:
- 4 sqms (1 per vocation)
- different IPs
- a lot dugeons in same script
- some tasks min/max lvl
- 24 hours exausted per task (after in)
- only 1 team per time
- no logout zone inside task and after 15 min if players dont kill the boss and open the chest, go teleport back to fromPos
- random rewards
/lib/dugeon_system.lua
<action actionid="9602" script="dugeonsystem_lever.lua"/>
<action actionid="9603" script="dugeonsystem_chest.lua"/>
edit: I'm using 0.4 sources
I wanna make a server based in dugeon system.
I made this pseudo code to this dugeon system:
- 4 sqms (1 per vocation)
- different IPs
- a lot dugeons in same script
- some tasks min/max lvl
- 24 hours exausted per task (after in)
- only 1 team per time
- no logout zone inside task and after 15 min if players dont kill the boss and open the chest, go teleport back to fromPos
- random rewards
/lib/dugeon_system.lua
Code:
local dugeonName = "dragons"
local fromPos[1] = {x = 952, y = 1039, z = 7},
local fromPos[2] = {x = 953,, y = 1039, z = 7},
local fromPos[3] = {x = 954, y = 1039, z = 7},
local fromPos[4] = {x = 955, y = 1039, z = 7},
local toPos[1] = {x = 952, y = 1039, z = 6},
local toPos[1] = {x = 953, y = 1039, z = 6},
local toPos[1] = {x = 954, y = 1039, z = 6},
local toPos[1] = {x = 955, y = 1039, z = 6},
local playerMinimumLevel = 15
local playerMaximumLevel = 30
local rewards = {1100, 1101, 1102}
<action actionid="9602" script="dugeonsystem_lever.lua"/>
Code:
-- get a vocation's base vocation
function getBaseVocation(vocation)
if vocation >= 5 and vocation <= 8 then
return vocation - 4
elseif vocation >= 9 and vocation <= 12 then
return vocation - 8
end
return vocation
end
function onUse(cid)
for i = 1, 4 do
local pid = getTopCreature(p[i].player.position).uid
if isPlayer(pid) then
-- MIN / MAX level
if getPlayerLevel(pid) > playerMinimumLevel then
doPlayerSendCancel(cid, getCreatureName(pid) .. ", is not high enough in level, minimum level is " .. playerMinimumLevel .. ".")
return false
end
if getPlayerLevel(pid) < playerMinimumLevel then
doPlayerSendCancel(cid, getCreatureName(pid) .. ", is not low enough in level, maximum level is " .. playerMinimumLevel .. ".")
return false
end
-- CHECK 1 PER VOCATION (1 knight, 1 paladin, 1 sorcerer, 1 druid)
if getBaseVocation( getPlayerVocation(pid) ) == X then
-- CHECK IF EVERY PLAYER HAVE DIFFERENT IP
if() then
end
-- everything is working - GO GO GO
-- check if have 4 players allowed
if() then
doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "You are inside " .. dugeonName .. "dugeon! You have 15 minutes to finish this dugeon.")
doTeleportThing(x, pos)
-- add a PLAYER storage and if player do not finish dugeon in 15 minutes teleport back to fromPos
-- add a PLAYER storage to set exausted for this task (24 hours)
-- add a GLOBAL storage to block dugeon to no other team enter, if there is a team inside
end
end
return true
end
<action actionid="9603" script="dugeonsystem_chest.lua"/>
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- STORAGE
local storage = 9603
-- check if player is in a dugeon (to avoid abuses)
-- check if player is in a dugeon exausted (to avoid aabuses)
-- ITEMS
local rewardid = random rewards
if getPlayerFreeCap(cid) >= getItemWeightById(rewardid, 1) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a '..getItemNameById(rewardid)..'. It weighs '..getItemWeightById(rewardid, 1)..'.00 and it is too heavy.')
return false
end
doPlayerAddItem(cid, rewardid, 1)
-- STOP auto teleport OUT (15 min inside with no complete, teleport out...)
-- teleport player topos
return true
end
edit: I'm using 0.4 sources
Last edited: