• 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!

doubt in code

FearWar

Active Member
Joined
Sep 17, 2017
Messages
221
Reaction score
26
Location
Brasil
Lua:
-- bronze necklace lever
function onUse(cid, item, frompos, item2, topos)

       if item.uid == 8030 and item.itemid == 1945 then
        player1pos = {x=596, y=1225, z=9, stackpos=253}
        player1 = getThingfromPos(player1pos)

        if player1.itemid > 0 then
            queststatus1 = getPlayerStorageValue(player1.uid,8031)
            queststatus1 = getPlayerStorageValue(player1.uid,8032)

            if queststatus1 == -1 then
                nplayer1pos = {x=596, y=1229, z=9}

                doSendMagicEffect(player1pos,2)

                doTeleportThing(player1.uid,nplayer1pos)

                doSendMagicEffect(nplayer1pos,10)

                doTransformItem(item.uid,item.itemid+1)
  else
    doPlayerSendCancel(cid,"You already did this quest.")
  end
  else
  doPlayerSendCancel(cid,"You need one players four this quest.")
  end

elseif item.uid ==8030 and item.itemid == 1946 then
  if getPlayerAccess(cid,1) then
  doTransformItem(item.uid,item.itemid-1)
  else
  doPlayerSendCancel(cid,"Sorry, not possible.")
  end
else
  return 0
end

return 1
end

Lua:
                doSendMagicEffect(player1pos,2)

Not work, what?
 
Solution
Change the code back to what you had before, send both effects AFTER teleporting the player.
The client won't show you the effect after you get teleported because the effect starts before teleportation (it might redraw the window and I don't think the client draws a portion of the effect)
Code:
teleport to player1pos
magic effect player1pos
magic effect nplayer1pos
This part of the code does not work in the game!

Lua:
                doSendMagicEffect(player1pos,2)
Have you checked that the effect "2" is correct? Also, im not used to doX functions, check if that one is the correct for sending the maggic effects (it seems so). Also, if you send the magic effect to a position, then teleport to another, maybe you dont see it while testing.
 
Have you checked that the effect "2" is correct? Also, im not used to doX functions, check if that one is the correct for sending the maggic effects (it seems so). Also, if you send the magic effect to a position, then teleport to another, maybe you dont see it while testing.

effect "2" is correct, I can see the effect because I am in the same "room", I can send an image to you

36390
 
effect "2" is correct, I can see the effect because I am in the same "room", I can send an image to you

View attachment 36390
The only 2 things i see different here is the stackpos in player1pos, but should not be a problem imo.
The effect number 2 is not correct to be rendered. Do you have a command to test the effects? (Like /z or !z or something like that) So you can test the number 2 is correct.

As far as I can see, in that screenshot, number 10 si working. You could try to set both to effect #10, so you will know the stackpos is not making weird behaviour...
 
The only 2 things i see different here is the stackpos in player1pos, but should not be a problem imo.
The effect number 2 is not correct to be rendered. Do you have a command to test the effects? (Like /z or !z or something like that) So you can test the number 2 is correct.

As far as I can see, in that screenshot, number 10 si working. You could try to set both to effect #10, so you will know the stackpos is not making weird behaviour...
i go testing effect 10, moment


Not work, it's something in that

Lua:
        player1pos = {x=596, y=1225, z=9, stackpos=253}

36391
 
Change the code back to what you had before, send both effects AFTER teleporting the player.
The client won't show you the effect after you get teleported because the effect starts before teleportation (it might redraw the window and I don't think the client draws a portion of the effect)
Code:
teleport to player1pos
magic effect player1pos
magic effect nplayer1pos
 
Solution
Change the code back to what you had before, send both effects AFTER teleporting the player.
The client won't show you the effect after you get teleported because the effect starts before teleportation (it might redraw the window and I don't think the client draws a portion of the effect)
Code:
teleport to player1pos
magic effect player1pos
magic effect nplayer1pos

Thanks @Stigma and @samco !

Lua:
doTeleportThing(player1.uid,nplayer1pos)
                
                doSendMagicEffect(player1pos, 2)

                doSendMagicEffect(nplayer1pos,10)
 

Similar threads

Back
Top