X
Xikini
Guest
The problem is a few players will randomly get a bug, and one of my gods have gotten this bug as well, where you cannot teleport to the location because you are in combat.
However you Are always able to teleport to the first checkpoint
I have created a sort of Checkpoint System, Such as in the game Oblivion, where you can teleport around the map as long as you've been there before and have unlocked the area.
The Script below is a slightly modified script of a monster outfit changer.
I changed it so that the 'monster name' is actually the name of the place that you wish to teleport to.
Also added teleport function instead of changing outfit
and Finally added a check for combat.
Whenever I tried to do the check like this..
It would come up with an error when I reloaded talkactions.
At the moment there is no error's appearing in the console, but players do get this error in-game from time to time, and even if they relog they still have the bug.
The only way to fix it is to restart the server
Oh also if it's not too much trouble.. is it possible to add a 'second name' to call the script?
in talkactions I have
But inside the script I can't do it like that.
As it's kind of hard to write the entire thing everytime a player wants to teleport somewhere
I wanted to make it shorter and longer
!checkpoint Imperial City Entrance
!cp 1
and both would be the same
or should I just copy the line and make 2 lines for every checkpoint?
Rep++ as always for anyone who helps
However you Are always able to teleport to the first checkpoint
I have created a sort of Checkpoint System, Such as in the game Oblivion, where you can teleport around the map as long as you've been there before and have unlocked the area.
The Script below is a slightly modified script of a monster outfit changer.
I changed it so that the 'monster name' is actually the name of the place that you wish to teleport to.
Also added teleport function instead of changing outfit
and Finally added a check for combat.
LUA:
local config = {
cooldown = 3, -- 3 secs of exhaust
needParam = "You need to insert a checkpoint name.",
cancelMessage = "You can't use this checkpoint.", -- if player doesn't have the storagevalue or outfit is invalid
exhaustCancel = "You can't use this spell again yet." -- if player is exhausted
}
local outfits = {
{monster = "Imperial City Entrance", pos = {x = 1505, y = 2674, z = 7 , stackpos = 1}, storageValue = 20001, needed = 1, effect = 10},
{monster = "Imperial City Market", pos = {x = 1571, y = 2620, z = 7 , stackpos = 1}, storageValue = 20002, needed = 1, effect = 10},
{monster = "Imperial City Depot", pos = {x = 1615, y = 2608, z = 7 , stackpos = 1}, storageValue = 20003, needed = 1, effect = 10},
{monster = "Imperial City Arena", pos = {x = 1659, y = 2674, z = 7 , stackpos = 1}, storageValue = 20004, needed = 1, effect = 10},
{monster = "Imperial City Shrine", pos = {x = 1654, y = 2715, z = 7 , stackpos = 1}, storageValue = 20005, needed = 1, effect = 10},
{monster = "Imperial City Tower", pos = {x = 1604, y = 2673, z = 7 , stackpos = 1}, storageValue = 20006, needed = 1, effect = 10},
{monster = "Imperial Area Oblivion Gate 1", pos = {x = 1615, y = 1412, z = 6 , stackpos = 1}, storageValue = 20007, needed = 1, effect = 10},
{monster = "Imperial Area Oblivion Gate 2", pos = {x = 1596, y = 1643, z = 6 , stackpos = 1}, storageValue = 20008, needed = 1, effect = 10},
{monster = "Imperial Area Elven Ruins", pos = {x = 1568, y = 1622, z = 6 , stackpos = 1}, storageValue = 20009, needed = 1, effect = 10},
{monster = "Imperial Area Minotaur Den", pos = {x = 1516, y = 1578, z = 6 , stackpos = 1}, storageValue = 20010, needed = 1, effect = 10},
{monster = "Imperial Area Chicken Farm", pos = {x = 1416, y = 1536, z = 6 , stackpos = 1}, storageValue = 20011, needed = 1, effect = 10},
{monster = "Imperial Area Orc Cave", pos = {x = 1450, y = 1489, z = 6 , stackpos = 1}, storageValue = 20012, needed = 1, effect = 10},
{monster = "Imperial Area Cyclops Mountain", pos = {x = 1383, y = 1436, z = 6 , stackpos = 1}, storageValue = 20013, needed = 1, effect = 10},
{monster = "Imperial Area Tortoise Cave", pos = {x = 1483, y = 1422, z = 6 , stackpos = 1}, storageValue = 20014, needed = 1, effect = 10},
{monster = "Imperial Area Bear Cave", pos = {x = 1546, y = 1394, z = 6 , stackpos = 1}, storageValue = 20015, needed = 1, effect = 10},
{monster = "Imperial Area Dwarven Mine Cave Entrance", pos = {x = 1583, y = 1499, z = 6 , stackpos = 1}, storageValue = 20016, needed = 1, effect = 10},
{monster = "Imperial Area Dwarven Mine Entrance", pos = {x = 1545, y = 1474, z = 6 , stackpos = 1}, storageValue = 20017, needed = 1, effect = 10},
{monster = "Imperial Area Bat Cave West Entrance", pos = {x = 1460, y = 1485, z = 6 , stackpos = 1}, storageValue = 20018, needed = 1, effect = 10},
{monster = "Imperial Area Bat Cave North Entrance", pos = {x = 1519, y = 1456, z = 6 , stackpos = 1}, storageValue = 20019, needed = 1, effect = 10},
{monster = "Imperial Area Bat Cave South Entrance", pos = {x = 1538, y = 1534, z = 6 , stackpos = 1}, storageValue = 20020, needed = 1, effect = 10},
{monster = "Imperial Area Troll Cave Entrance", pos = {x = 1489, y = 1442, z = 6 , stackpos = 1}, storageValue = 20021, needed = 1, effect = 10},
{monster = "Imperial Area Troll Hidden Cave Entrance", pos = {x = 1452, y = 1499, z = 6 , stackpos = 1}, storageValue = 20022, needed = 1, effect = 10},
{monster = "Imperial Area Rotworm Cave Entrance", pos = {x = 1585, y = 1413, z = 6 , stackpos = 1}, storageValue = 20023, needed = 1, effect = 10},
{monster = "Imperial Area Hidden Cyclops Mountain", pos = {x = 1587, y = 1501, z = 5 , stackpos = 1}, storageValue = 20024, needed = 1, effect = 10},
{monster = "Imperial Area Hidden Goblin Cave", pos = {x = 1556, y = 1428, z = 6 , stackpos = 1}, storageValue = 20025, needed = 1, effect = 10},
{monster = "Imperial Area Hidden Dwarven City", pos = {x = 1544, y = 1613, z = 8 , stackpos = 1}, storageValue = 20026, needed = 1, effect = 10},
{monster = "Imperial Area Dragon Caves", pos = {x = 1540, y = 1584, z = 12 , stackpos = 1}, storageValue = 20027, needed = 1, effect = 10},
{monster = "Imperial Area Hidden Maze", pos = {x = 1463, y = 1577, z = 7 , stackpos = 1}, storageValue = 20028, needed = 1, effect = 10},
{monster = "Imperial Area Tortoise Island", pos = {x = 1418, y = 1558, z = 7 , stackpos = 1}, storageValue = 20029, needed = 1, effect = 10},
{monster = "Imperial Area Hidden Outlaw Stronghold", pos = {x = 1503, y = 1605, z = 7 , stackpos = 1}, storageValue = 20030, needed = 1, effect = 10},
{monster = "Imperial Area Grave Hole", pos = {x = 1509, y = 1423, z = 6 , stackpos = 1}, storageValue = 20031, needed = 1, effect = 10},
{monster = "Elven City", pos = {x = 1356, y = 2766, z = 7 , stackpos = 1}, storageValue = 20032, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20033, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20034, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20035, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20036, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20037, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20038, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20039, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20040, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20041, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20042, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20043, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20044, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20045, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20046, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20047, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20048, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20049, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20050, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20051, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20052, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20053, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20054, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20055, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20056, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20057, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20058, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20059, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20060, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20061, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20062, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20063, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20064, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20065, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20066, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20067, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20068, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20069, needed = 1, effect = 10},
{monster = "3", pos = {x = 1619, y = 2608, z = 6 , stackpos = 1}, storageValue = 20070, needed = 1, effect = 10},
{monster = "Never Used", pos = {x = 1620, y = 2608, z = 4 , stackpos = 1}, storageValue = 20600, needed = 1, effect = 10}
} -- The monster, the id of the outfit, the storage key and the storage value that you need to use it, and the effect
function nocase(s) -- DO NOT EDIT
s = string.gsub(s, "%a", function (c)
return string.format("[%s%s]", string.lower(c),
string.upper(c))
end)
return s
end
function onSay(cid, words, param, channel)
explodes = string.explode(param, " ")
if (param == "") then
doPlayerSendCancel(cid, config.needParam)
return true
end
if getPlayerStorageValue(cid, 4040) ~= -1 then
if not((os.time()-getPlayerStorageValue(cid, 4040) >= config.cooldown)) then
doPlayerSendCancel(cid, config.exhaustCancel)
return 1
else
doPlayerSetStorageValue(cid, 4040, os.time())
end
else
doPlayerSetStorageValue(cid, 4040, os.time())
end
for i, a in pairs(outfits) do
valid = 0 -- DO NOT CHANGE
validNeed = 1 -- DO NOT CHANGE
monsterxplode = string.explode(a.monster, " ")
if #explodes > 1 and #explodes == #monsterxplode then
validNeed = #explodes
for i=1, #explodes do
if nocase(explodes[i]) == nocase(monsterxplode[i]) then
valid = valid+1
end
end
else
if nocase(param) == nocase(a.monster) then
valid = 1
end
end
if valid == validNeed then
if getPlayerStorageValue(cid, a.storageValue) == a.needed then
if hasCondition(cid, CONDITION_INFIGHT) == FALSE then -- This is the check for the in combat
doTeleportThing(cid, a.pos)
changedMessage = "You have been teleported to " .. a.monster .. "." -- No need to change it~
if a.effect ~= NIL then
doSendMagicEffect(getPlayerPosition(cid), a.effect)
end
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, changedMessage)
return 1
else
doPlayerSendCancel(cid, config.cancelMessage)
end
else
doPlayerSendCancel(cid, config.cancelMessage)
end
else
doPlayerSendCancel(cid, "You may not use this spell while in combat!")
end
end
return 1
end
LUA:
if hasCondition(cid, CONDITION_INFIGHT) == TRUE then
Return FALSE
end
At the moment there is no error's appearing in the console, but players do get this error in-game from time to time, and even if they relog they still have the bug.
The only way to fix it is to restart the server
Oh also if it's not too much trouble.. is it possible to add a 'second name' to call the script?
in talkactions I have
XML:
<talkaction words="!checkpoint;/checkpoint;!cp;/cp" event="script" value="checkpoint.lua"/>
As it's kind of hard to write the entire thing everytime a player wants to teleport somewhere
I wanted to make it shorter and longer
!checkpoint Imperial City Entrance
!cp 1
and both would be the same
or should I just copy the line and make 2 lines for every checkpoint?
LUA:
{monster = "Imperial City Entrance", pos = {x = 1505, y = 2674, z = 7 , stackpos = 1}, storageValue = 20001, needed = 1, effect = 10},
{monster = "1", pos = {x = 1505, y = 2674, z = 7 , stackpos = 1}, storageValue = 20001, needed = 1, effect = 10},
Rep++ as always for anyone who helps