I just made a training monk system with time train. So you are allowed to train in e.g 15 min and then you will be teleported to temple.
data/movements/scripts/trM.lua:
I think someone could do it with loops but I just copied and pasted.
CONFIG?
This:
is these positions [That is marked with red]:
These are the positions were the players are stepping and gets the 15 minutes of training.
AND
This:
is these positions [that is marked with black]:
These are the positions were the players are stepping and reseting the 15 minutes of training.
ALSO:
If you have training monk with a teleport inside the room. You have to mark the destination of the teleport in this line:
That is my destination of the teleport inside the training room. [That is marked with black]
END OF CONFIG!
Enjoy!
- No ActionsIds
- No UniqueIds
data/movements/scripts/trM.lua:
Lua:
local timeT = 15 -- minutes
local s = 258 -- storagevalue
local function tPzola(cid) -- Mooosie
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
return true
end
local function tPzolaa(cid) -- Mooosie
setPlayerStorageValue(cid, s, -1)
return true
end
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) -- Mooosie
if isInRange(getCreaturePosition(cid), {x=864, y=1075, z=7}, {x=864, y=1075, z=7})
or isInRange(getCreaturePosition(cid), {x=875, y=1075, z=7}, {x=875, y=1075, z=7}) then
if getPlayerStorageValue(cid, s) == 1 then
setPlayerStorageValue(cid, s, -1)
doSendMagicEffect(getCreaturePosition(cid), 13)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You've just ended the training.")
stopEvent(stoPeVentzalal)
stopEvent(stoPeVentzalala)
end
end
if getPlayerStorageValue(cid, s) < 0 then
if isInRange(getCreaturePosition(cid), {x=861, y=1076, z=7}, {x=861, y=1166, z=7})
or isInRange(getCreaturePosition(cid), {x=868, y=1076, z=7}, {x=868, y=1166, z=7})
or isInRange(getCreaturePosition(cid), {x=872, y=1076, z=7}, {x=872, y=1166, z=7})
or isInRange(getCreaturePosition(cid), {x=879, y=1076, z=7}, {x=879, y=1166, z=7})
-- FLOOR 2
or isInRange(getCreaturePosition(cid), {x=861, y=1076, z=6}, {x=861, y=1166, z=6})
or isInRange(getCreaturePosition(cid), {x=868, y=1076, z=6}, {x=868, y=1166, z=6})
or isInRange(getCreaturePosition(cid), {x=872, y=1076, z=6}, {x=872, y=1166, z=6})
or isInRange(getCreaturePosition(cid), {x=879, y=1076, z=6}, {x=879, y=1166, z=6})then
doSendMagicEffect(getCreaturePosition(cid), 12)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have ".. timeT .." minutes on you to train. You will be teleported to temple when the times is up!")
setPlayerStorageValue(cid, s, 1)
stoPeVentzalal = addEvent(tPzola, timeT*60*1000, cid)
stoPeVentzalala = addEvent(tPzolaa, timeT*60*1000, cid)
end
end
return true
end
function onStepOut(cid, item, position, fromPosition) -- Mooosie
if isInRange(getCreaturePosition(cid), {x=862, y=1076, z=7}, {x=862, y=1166, z=7})
or isInRange(getCreaturePosition(cid), {x=867, y=1076, z=7}, {x=867, y=1166, z=7})
or isInRange(getCreaturePosition(cid), {x=873, y=1076, z=7}, {x=873, y=1166, z=7})
or isInRange(getCreaturePosition(cid), {x=878, y=1076, z=7}, {x=878, y=1166, z=7})
-- FLOOR 2
or isInRange(getCreaturePosition(cid), {x=862, y=1076, z=6}, {x=862, y=1166, z=6})
or isInRange(getCreaturePosition(cid), {x=867, y=1076, z=6}, {x=867, y=1166, z=6})
or isInRange(getCreaturePosition(cid), {x=873, y=1076, z=6}, {x=873, y=1166, z=6})
or isInRange(getCreaturePosition(cid), {x=878, y=1076, z=6}, {x=878, y=1166, z=6})then
if getPlayerStorageValue(cid, s) == 1 then
setPlayerStorageValue(cid, s, -1)
doSendMagicEffect(getCreaturePosition(cid), 13)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You've just ended the training.")
stopEvent(stoPeVentzalal)
stopEvent(stoPeVentzalala)
end
end
return true
end
XML:
<movevent type="StepIn" itemid="406" event="script" value="trM.lua" />
<movevent type="StepOut" itemid="406" event="script" value="trM.lua" />
CONFIG?
This:
Lua:
if getPlayerStorageValue(cid, s) < 0 then
if isInRange(getCreaturePosition(cid), {x=861, y=1076, z=7}, {x=861, y=1166, z=7})
These are the positions were the players are stepping and gets the 15 minutes of training.
AND
This:
Lua:
function onStepOut(cid, item, position, fromPosition)
if isInRange(getCreaturePosition(cid), {x=862, y=1076, z=7}, {x=862, y=1166, z=7})
These are the positions were the players are stepping and reseting the 15 minutes of training.
ALSO:
If you have training monk with a teleport inside the room. You have to mark the destination of the teleport in this line:
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) -- Mooosie
if isInRange(getCreaturePosition(cid), {x=864, y=1075, z=7}, {x=864, y=1075, z=7})
or isInRange(getCreaturePosition(cid), {x=875, y=1075, z=7}, {x=875, y=1075, z=7}) then
if getPlayerStorageValue(cid, s) == 1 then
setPlayerStorageValue(cid, s, -1)
doSendMagicEffect(getCreaturePosition(cid), 13)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You've just ended the training.")
stopEvent(stoPeVentzalal)
stopEvent(stoPeVentzalala)
end
end
That is my destination of the teleport inside the training room. [That is marked with black]
END OF CONFIG!
Enjoy!
Last edited: