knighters god
Active Member
- Joined
- Feb 14, 2009
- Messages
- 166
- Solutions
- 1
- Reaction score
- 40
TFS 1.2
CLIENT 10.77
So I am playing around with scripts for a quest I'm doing, and I want to send magic effects when you teleport using a lever.
Everything but the magic effects work.
Full script in case that could help.
Help would be greatly appreciated!
CLIENT 10.77
So I am playing around with scripts for a quest I'm doing, and I want to send magic effects when you teleport using a lever.
Everything but the magic effects work.
Code:
_config._TeleportPOS.FROM:sendMagicEffect(CONST_ME_POFF)
_config._TeleportPOS.TO:sendMagicEffect(CONST_ME_TELEPORT)
Full script in case that could help.
Code:
local _config =
{
_Lever =
{
FirstID = 9825,
SecondID = 9826,
UniqueID = 16003
},
_MagicRock =
{
RockID = 1353,
SecondRockID = 1354,
UniqueID = 16002,
},
_TeleportPOS =
{
FROM = {x = 1056, y = 1220, z = 11},
TO = {x = 1063, y = 1220, z = 11}
},
_LevelRequirment =
{
PhaseOne = 80,
PhaseTwo = 90,
PhaseThree = 100
},
_Storages =
{
MagicRockStorageID = 17306,
RewardStorageID = 17307
}
}
local function ROLLBACKrockEVENT()
doTransformItem(_config._MagicRock.UniqueID, _config._MagicRock.RockID)
end
local function ROLLBACKleverEVENT()
doTransformItem(_config._Lever.UniqueID, _config._Lever.FirstID)
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if (item.itemid == _config._MagicRock.RockID or item.itemid == _config._MagicRock.SecondRockID) and item.uid == _config._MagicRock.UniqueID then -- From here is only about the magic rock
if item.itemid == _config._MagicRock.RockID and player:getLevel() >= _config._LevelRequirment.PhaseOne then
doTransformItem(_config._MagicRock.UniqueID, _config._MagicRock.SecondRockID)
addEvent(ROLLBACKrockEVENT, 5 * 1000)
setPlayerStorageValue(player, _config._Storages.MagicRockStorageID, 5)
elseif item.itemid == _config._MagicRock.SecondRockID and player:getLevel() >= _config._LevelRequirment.PhaseOne then
setPlayerStorageValue(player, _config._Storages.MagicRockStorageID, 5)
else
doPlayerSendCancel(player, "You cannot use this object!")
end
end -- To here is only about the magic rock
----------------------------------------
if item.itemid == _config._Lever.FirstID and item.uid == _config._Lever.UniqueID then
if getPlayerStorageValue(player, _config._Storages.MagicRockStorageID) > 1 then
doTransformItem(_config._Lever.UniqueID, _config._Lever.SecondID)
doTeleportThing(player, _config._TeleportPOS.TO)
player:setDirection(DIRECTION_EAST)
addEvent(ROLLBACKleverEVENT, 2 * 1000)
_config._TeleportPOS.FROM:sendMagicEffect(CONST_ME_POFF)
_config._TeleportPOS.TO:sendMagicEffect(CONST_ME_TELEPORT)
else
doPlayerSendCancel(player, "The lever is stuck in place!")
end
end
return true
end
Help would be greatly appreciated!