Lava Titan
Developer
Hey there, I created this simple function, it's nothing special but I guess it may save some lines for some people
Some people may find it useless I guess, but like I said it's nothing special, it's just a simple function
How to add?
It's very simple, you can start by browsing "server\data\lib\compat\compat.lua" and add this code in last line.
How to use?
After you got this added in compat.lua you can use it on any Lua script you want, for example:
Instead of using the first one, you can always use this which is more simple and can also be used in addEvent
After you can simply use like:
For those who use Sublime Text 3 TFS AutoComplete, here's the code:
or
Some people may find it useless I guess, but like I said it's nothing special, it's just a simple function
How to add?
It's very simple, you can start by browsing "server\data\lib\compat\compat.lua" and add this code in last line.
Code:
function Player.sendMagicEffect(self, effect)
self:getPosition():sendMagicEffect(effect)
return true
end
How to use?
After you got this added in compat.lua you can use it on any Lua script you want, for example:
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
player:sendMagicEffect(CONST_ME_GIFT_WRAPS)
return true
end
Instead of using the first one, you can always use this which is more simple and can also be used in addEvent
Code:
function sendMagicEffect(playerId, effect)
local player = Player(playerId)
if not player then
return
end
player:getPosition():sendMagicEffect(effect)
return true
end
After you can simply use like:
Code:
addEvent(sendMagicEffect, 1000, CONST_ME_GIFT_WRAPS)
For those who use Sublime Text 3 TFS AutoComplete, here's the code:
Code:
{
"trigger": "Player:sendMagicEffect",
"contents": "${1:player}:sendMagicEffect(${2:effect})"
},
or
Code:
{
"trigger": "sendMagicEffect",
"contents": "sendMagicEffect(${1:effect})"
},
Last edited by a moderator: