Slave Ots
LUA Newbie™
hi otlanders
Slave Ots Present a hunting room full systems + some features in one script
in this script
*when you enter a room it gets clean automaticlly
*it have 3 ways to check that you are in room or now and kicks you if your time is up
*noway to get 1 bug inside it
*very very very easy configs {beginners and newbies can use this script}
*every line have its own guides so that you don't need to get back to this thread;
*each line have got a comments on how to use or what this code/s do
*you will only edit 12 ~ 18 values or lines and script will be working
[only configurations]
** and much more.. Dont Forget to REP++ please
-------------------------------------------------------------------------------------------------------
now in data / movements / scripts add;
----------------------------
in data / movements / movements.xml add;
in data / lib / 050-function add this two functionsthey are not mine)
hope you like it
its 100% for me. 100% tested on TFS 0.3.6 and 100% worked. dont change credits
i think i deserve REP++
King Regards
Note: it only have 1 problem. that if you summoned a creatureutevo res " fire elemental it will not summon a monster in the room.. iam working on it and ill update this post later
Slave Ots
Slave Ots Present a hunting room full systems + some features in one script
in this script
*when you enter a room it gets clean automaticlly
*it have 3 ways to check that you are in room or now and kicks you if your time is up
*noway to get 1 bug inside it
*very very very easy configs {beginners and newbies can use this script}
*every line have its own guides so that you don't need to get back to this thread;
*each line have got a comments on how to use or what this code/s do
*you will only edit 12 ~ 18 values or lines and script will be working
[only configurations]
** and much more.. Dont Forget to REP++ please
-------------------------------------------------------------------------------------------------------
now in data / movements / scripts add;
Code:
function onStepIn(cid, item, pos, fromPosition)
-- all credits for slave ots @ otland.net
-- use the following AIDs
-- for enter teleprot --> 55xx
-- for exit teleprot --> 44xx
-- for summon sqm --> 33xx
--you can relocate this area valuis for empty storages
local InRoom = 12345 -- for players only. keep the same in all scripts
local Exhaust = 12346 -- for magic effects dont edit. keep the same for all scripts
local onexit = 12347 -- when exit he maynot enter after 30 sec. keep it for all rooms
local playerpos = getPlayerPosition(cid) -- player position for magic effects
local onsummon = 12344 -- when player summon this makes exhauste
local onsummontime = os.date("%S seconds", getPlayerStorageValue(cid, onsummon) - os.time()) -- dont change
local onexittime = os.date("%S seconds", getPlayerStorageValue(cid, onexit) - os.time()) -- dont change
--------------------------------------------------------------------------------------------------------------------
-- all creadits to 7I7A and Admin Slave <$>
local RoomID = 5501 -- 55xx where xx = room id for enter
local ExitID = 4401 -- 44xx where xx = room id for exit
local SummonID = 3301 -- 33xx wher xx = room id for summon monster
local reqcoins = 20 -- required coins to enter with id 6527
local pos = {from = {x=717, y=898, z=10}, to = {x=726, y=908, z=10}} -- for each room
local exitpos = {x=729, y=903, z=10} -- for each room
local startpos = {x=724, y=903, z=10} -- for each room
local monsterpos = {x=722, y=907, z=10} --on blood -- for each room
local teleportpos = {x=728, y=903, z=10} -- enter teleport for timer
local monster = 'Demon' -- monster name , dont remove ''
local xtime = 600000 -- 1 minutes milleseconds / huntting
local duration = 600 -- 10 minutes for exhaust storage . seconds
local mon = getCreatureByName(monster)
local mons = getMonstersInRange(pos.from, pos.to) -- check numbers of creatures in room
--local mons = getCreatureInRange(mon, pos.from, pos.to, count)
--------------- end of configs -----------
------------------
-- summond sqm aid 33xx
if item.actionid == SummonID then
if isPlayer(cid) then
if getGlobalStorageValue(RoomID) > 0 and getCreatureStorage(cid, InRoom) == RoomID and getPlayerStorageValue(cid, Exhaust) > os.time() then
-- this means that player have hunt time, if he haven't he will be kicked out
if (table.maxn(mons) >= 1) then
doSendMagicEffect(playerpos, 2)
return doPlayerSendCancel(cid, 'sorry, you monster is already summoned.') and doTeleportThing(cid, fromPosition) and true
if getPlayerStorageValue(cid, onsummon) > os.time() then
doPlayerSendCancel(cid, ' you must wait ' .. onsummontime .. ' before summon another monster.')
doSendMagicEffect(playerpos, 2)
doTeleportThing(cid, fromPosition)
return 1
end
return true
else
doTeleportThing(cid, exitpos)
setPlayerStorageValue(cid, onexit, os.time()+30)
doSendMagicEffect(exitpos, 10)
setGlobalStorageValue(RoomID, -1)
setPlayerStorageValue(cid, InRoom, -1)
return true
end
return true
end
end
end
-------------------------------- enter teleprot
if item.actionid == RoomID then
if not isPlayer(cid) then
return 1
end
if getPlayerStorageValue(cid, onexit) > os.time() then
doPlayerSendCancel(cid, 'you must wait ' .. onexittime .. ' .')
doTeleportThing(cid, fromPosition)
return 1
end
if getGlobalStorageValue(RoomID) < 0 and getCreatureStorage(cid, InRoom) < 0 then
if doPlayerRemoveItem(cid,6527, reqcoins) == TRUE then
doSendAnimatedText(playerpos, "welcome", 247)
doPlayerSendTextMessage(cid, 25, 'you have 10 minutes of huntting!')
setGlobalStorageValue(RoomID, 1)
setPlayerStorageValue(cid, InRoom, RoomID)
setPlayerStorageValue(cid, Exhaust, os.time() + duration)
doTeleportThing(cid, startpos)
doAreaClean(pos.from, pos.to)
return addEvent(
function()
if isPlayer(cid) and getGlobalStorageValue(RoomID) > 0 or getCreatureStorage(cid, InRoom) == RoomID then
--setPlayerStorageValue(cid, onexit, os.time()+10) --
doTeleportThing(cid, exitpos)
doPlayerSendTextMessage(cid, 25, 'times up!')
setPlayerStorageValue(cid, InRoom, -1)
setPlayerStorageValue(cid, Exhaust, 0)
setPlayerStorageValue(cid, DoubleSpawn, -1)
doSendMagicEffect(exitpos, 10)
return setGlobalStorageValue(RoomID, -1)
end end,
xtime, cid)--, RoomID) auto kicker
else
doPlayerSendCancel(cid, 'you dont have ' .. reqcoins .. ' game tokens!')
doTeleportThing(cid, fromPosition)
doSendMagicEffect(playerpos, 2)
return 1
end
else
doTeleportThing(cid, fromPosition)
doSendMagicEffect(playerpos, 2)
return doPlayerSendCancel(cid, 'Somebody is already in the room.')
end
return true
end
--------------------------
--exit teleport aid = 44xx
if item.actionid == ExitID then
if isPlayer(cid) then
doTeleportThing(cid, exitpos)
setPlayerStorageValue(cid, onexit, os.time()+30)
doPlayerSendTextMessage(cid, 25, 'you went out!')
setPlayerStorageValue(cid, Exhaust, -1)
setPlayerStorageValue(cid, InRoom, -1)
doSendMagicEffect(exitpos, 10)
return setGlobalStorageValue(RoomID, -1)
end
return true
end
return true
end
in data / movements / movements.xml add;
Code:
<movevent type="StepIn" actionid="5501;4401;3301" event="script" value="xxxx"/>
Code:
**function getMonstersInRange(fromPosition, toPosition)
local creatures = getCreaturesInRange(fromPosition, toPosition)
local monsters = {}
for _, creature in ipairs(creatures) do
if(isMonster(creature)) then
table.insert(monsters, creature)
end
end
return monsters
end
function isCleanAbleArea(pos)
pos.stackpos = 0
local tile = getThingfromPos(pos, false)
if tile ~= 0 and not hasProperty(tile.uid, CONST_PROP_BLOCKSOLID) and not isCreature(getTopCreature(pos).uid) then
return true
end
end
function doAreaClean(frompos, topos)
for x = frompos.x, topos.x do
for y = frompos.y, topos.y do
for z = frompos.z, topos.z do
local p = {x=x,y=y,z=z}
if isCleanAbleArea(p) or created_by_otswe == true then
doCleanTile(p,false)
end
end
end
end
end
its 100% for me. 100% tested on TFS 0.3.6 and 100% worked. dont change credits
i think i deserve REP++
King Regards
Note: it only have 1 problem. that if you summoned a creatureutevo res " fire elemental it will not summon a monster in the room.. iam working on it and ill update this post later
Slave Ots
Last edited: