doubt in code

FearWar

Member
Joined
Sep 17, 2017
Messages
83
Best answers
0
Reaction score
4
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?
 

samco

4x4 Developer.
Joined
Jul 3, 2007
Messages
909
Best answers
7
Reaction score
184
Location
Spain
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.
 
OP
FearWar

FearWar

Member
Joined
Sep 17, 2017
Messages
83
Best answers
0
Reaction score
4
Location
Brasil
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
 

samco

4x4 Developer.
Joined
Jul 3, 2007
Messages
909
Best answers
7
Reaction score
184
Location
Spain
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...
 
OP
FearWar

FearWar

Member
Joined
Sep 17, 2017
Messages
83
Best answers
0
Reaction score
4
Location
Brasil
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
 

samco

4x4 Developer.
Joined
Jul 3, 2007
Messages
909
Best answers
7
Reaction score
184
Location
Spain
i go testing effect 10, moment


Not work, it's something in that

Lua:
        player1pos = {x=596, y=1225, z=9, stackpos=253}
View attachment 36391
If you dont want to create a new variable, then you can use doSendMagicEffect({player1pos.x, player1pos.y, player1pos.z},2)
 
OP
FearWar

FearWar

Member
Joined
Sep 17, 2017
Messages
83
Best answers
0
Reaction score
4
Location
Brasil
If you dont want to create a new variable, then you can use doSendMagicEffect({player1pos.x, player1pos.y, player1pos.z},2)
not work

Lua:
doSendMagicEffect({player1pos.x, player1pos.y, player1pos.z},2)
 

Delusion

Divine Intellect
Support Team
Joined
Feb 14, 2015
Messages
5,049
Best answers
472
Reaction score
2,678
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
 
OP
FearWar

FearWar

Member
Joined
Sep 17, 2017
Messages
83
Best answers
0
Reaction score
4
Location
Brasil
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)
 
Top