Verrine
Member
- Joined
- Mar 2, 2016
- Messages
- 117
- Reaction score
- 7
Hello!
I found this here. I need to tell that is nice script and I like that:
https://otland.net/threads/amazing-hunting-room-much-features-in-1-script.180092/
But... It wont work with TFS1.2 / 1.1 so is there any good person who know how to script and who can transfer it to 1.2 TFS (or 1.1 i guess its similar) Ill be glad for this. No more words needed In this thread (UP) everything important is noticed.
EDIT:
After some hours with code i did that there is no eerors during loading script but when im entering into teleport here is the error:
How can I add getCreaturesInRange function to new TFS?
PS dont treat me like good coeder, I just know how to read it but I dont know many functions how to use them etc thats why this is in requests. I cant do it alone I think
EDIT2:
i did smth like this and now this error:
plz help ;<
I found this here. I need to tell that is nice script and I like that:
https://otland.net/threads/amazing-hunting-room-much-features-in-1-script.180092/
But... It wont work with TFS1.2 / 1.1 so is there any good person who know how to script and who can transfer it to 1.2 TFS (or 1.1 i guess its similar) Ill be glad for this. No more words needed In this thread (UP) everything important is noticed.
EDIT:
After some hours with code i did that there is no eerors during loading script but when im entering into teleport here is the error:
Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/hunting.lua:onStepIn
data/lib/miscellaneous/050-functions.lua:86: attempt to perform arithmetic on local 'radiusx' (a table value)
stack traceback:
[C]: in function '__unm'
data/lib/miscellaneous/050-functions.lua:86: in function 'getCreaturesInRange'
data/lib/miscellaneous/050-functions.lua:108: in function 'getMonstersInRange'
data/movements/scripts/hunting.lua:30: in function <data/movements/scripts/hunting.lua:1>
How can I add getCreaturesInRange function to new TFS?
PS dont treat me like good coeder, I just know how to read it but I dont know many functions how to use them etc thats why this is in requests. I cant do it alone I think
EDIT2:
PHP:
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=32463, y=32462, z=7}, to = {x=32471, y=32470, z=7}} -- for each room
local exitpos = {x=32463, y=32472, z=7} -- for each room
local startpos = {x=32463, y=32462, z=7} -- for each room
local monsterpos = {x=32469, y=32468, z=7} --on blood -- for each room
local teleportpos = {x=32467, y=32472, z=7} -- 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 = Game.createMonster(param, monster)
local mons = getSpectators(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 player:getStorageValue(onexitInRoom) == 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)
doPlayerSendCancel(cid, 'sorry, you monster is already summoned.')
doTeleportThing(cid, fromPosition)
return true
else
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
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
end
-------------------------------- enter teleprot
if item.actionid == RoomID then
if not isPlayer(cid) then
return 1
end
if player:getStorageValue(cid, onexit) > os.time() then
doPlayerSendCancel(cid, 'you must wait ' .. onexittime .. ' .')
doTeleportThing(cid, fromPosition)
return 1
end
if getGlobalStorageValue(RoomID) < 0 and player:getStorageValue(onexitInRoom) < 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 player:getStorageValue(onexitInRoom) == 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
i did smth like this and now this error:
Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/hunting.lua:onStepIn
data/movements/scripts/hunting.lua:70: attempt to index global 'player' (a nil value)
stack traceback:
[C]: in function '__index'
data/movements/scripts/hunting.lua:70: in function <data/movements/scripts/hunting.lua:1>
plz help ;<
Last edited: