• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ How to display effect above character

Liryk

New Member
Joined
Jun 20, 2018
Messages
42
Reaction score
1
Hey i need help with magic effect, how i can display effect above character?
I don't know how to use math in lua

playerpos = getPlayerPosition(pid)
doSendMagicEffect(playerpos, CONST_ME_FIREAREA)
 
Solution
in pre 1.0
Lua:
playerpos = getPlayerPosition(pid)
doSendMagicEffect({x=playerpos.x, y=playerpos.y-1, z=playerpos.z}, CONST_ME_FIREAREA)
or
Lua:
pos= getPlayerPosition(pid)
pos.y = pos.y-1
doSendMagicEffect(pos, CONST_ME_FIREAREA)
But i have code:


elseif(getPlayerVocation(pid) == 0) then
playerpos = getPlayerPosition(pid)
doSendMagicEffect(playerpos, CONST_ME_FIREAREA)

and i need to send effect above my character
 
Okay, can you explain what you mean by above? Do you want the effect on top of the character? CTRL-A your entire file. Insert in this post a code block, and label it Lua. I'll modify it for you to work.
 
Yea on top of character because i create new magic effect something in the style of the admin string and I want to show it on to of my character

like this:
0zYjFAk.png


EDIT:
Here is a small code
Lua:
local players = getPlayersOnline()
for _, pid in ipairs(getPlayersOnline()) do

if(getPlayerVocation(pid) == 0) then
playerpos = getPlayerPosition(pid)
doSendMagicEffect(playerpos, CONST_ME_FIREAREA)
 
Last edited:
Okay, what you really mean is you want it to appear to be "above", but positioning wise, it's actually -1 along the Y axis. That is doable, but in order to do that, you will need to edit the Y value of the player position before passing it to your doSendMagicEffect call.

I'm not quite sure if the playerpos variable is in this format, but I'm guessing you can do a playerpos.y -= 1 operation before sending the effect.
 
Okay, what you really mean is you want it to appear to be "above", but positioning wise, it's actually -1 along the Y axis. That is doable, but in order to do that, you will need to edit the Y value of the player position before passing it to your doSendMagicEffect call.

I'm not quite sure if the playerpos variable is in this format, but I'm guessing you can do a playerpos.y -= 1 operation before sending the effect.
Ok but i try all "in my opinion" and no results
Lua:
playerpos(y-1) = getPlayerPosition(pid)
doSendMagicEffect(playerpos, CONST_ME_FIREAREA)
 
Its as easy as this. Stop using 0.X functions.
Lua:
playerpos = player:getPosition()
effectpos = Position(playerpos.x, playerpos.y -1, playerpos.z)
effectpos:sendMagicEffect(CONST_ME_FIREAREA)
 
Its as easy as this. Stop using 0.X functions.
Lua:
playerpos = player:getPosition()
effectpos = Position(playerpos.x, playerpos.y -1, playerpos.z)
effectpos:sendMagicEffect(CONST_ME_FIREAREA)
Errors
data/globalevents/scripts/efekty.lua:296: attempt to index global 'player' (a nil value)
 
in pre 1.0
Lua:
playerpos = getPlayerPosition(pid)
doSendMagicEffect({x=playerpos.x, y=playerpos.y-1, z=playerpos.z}, CONST_ME_FIREAREA)
or
Lua:
pos= getPlayerPosition(pid)
pos.y = pos.y-1
doSendMagicEffect(pos, CONST_ME_FIREAREA)
 
Last edited:
Solution
Back
Top