Lua Error in script UPGRADE

Godz4t4n1c

Member
Joined
Sep 9, 2015
Messages
47
Reaction score
1
I have a system that transforms one item to another here I leave it ...

Version:
Lua:
[2/2/2018 2:31:5] The OTX Server Version: (2.X.S - 1) - Codename: (Crying Damson)
[2/2/2018 2:31:5] Compiled with Microsoft Visual C++ version 12.0 for arch 32 Bits at Sep  1 2015 15:56:14
Movements
Lua:
<movevent type="AddItem" tileitem="8303" itemid="12606;12603;12604;12607;12605;12610;12609;8849;2547" event="script" value="evolitem.lua"/>
Movements/Scripts

Lua:
local c = {
  Distance = CONST_ANI_EXPLOSION,
  Effect = CONST_ME_BLOCKHIT,
  StoneID = 8303,
  [12606] = {149, 10},
  [12603] = {150, 10},
  [12604] = {151, 10},
  [12607] = {152, 10},
  [12605] = {153, 10},
  [12610] = {121, 10},
  [12609] = {148, 10},
  [8849] = {110, 10},
  [2547] = {6529, 10},
}
function onAddItem(moveitem, tileitem, position, cid)
local t = c[tileitem.itemid]
  if moveitem.itemid == c.StoneID then
      if t then
          doSendDistanceShoot(getThingPos(cid), position, c.Distance)
          doRemoveItem(moveitem.uid, 1)
          if math.random(0,100) < t[2] then
              doSendMagicEffect(position, c.Effect)
              doTransformItem(tileitem.uid, t[1])
            else
              doPlayerSendCancel(cid, "Failed")
              doSendMagicEffect(position, CONST_ME_POFF)
          end
      end
  end
return true
end
The problem is that it does not do what the script says, it just says this:
Error: sdasda10.png - Click to see more photos on ServImg
I do not see any error in the console or anything but the stone does not work .....

I can not understand why the stone does not work, could you help me or what is my mistake?
 

bayview

Banned User
Joined
Jan 25, 2018
Messages
612
Reaction score
287
When in doubt print.
Lua:
print(moveitem.itemid, tileitem.itemid, position, cid)
 

kingsley666

Intermediate OT User
Joined
Jul 24, 2011
Messages
146
Reaction score
24
Location
Venezuela
I have a system that transforms one item to another here I leave it ...

Version:
Lua:
[2/2/2018 2:31:5] The OTX Server Version: (2.X.S - 1) - Codename: (Crying Damson)
[2/2/2018 2:31:5] Compiled with Microsoft Visual C++ version 12.0 for arch 32 Bits at Sep  1 2015 15:56:14
Movements
Lua:
<movevent type="AddItem" tileitem="8303" itemid="12606;12603;12604;12607;12605;12610;12609;8849;2547" event="script" value="evolitem.lua"/>
Movements/Scripts

Lua:
local c = {
  Distance = CONST_ANI_EXPLOSION,
  Effect = CONST_ME_BLOCKHIT,
  StoneID = 8303,
  [12606] = {149, 10},
  [12603] = {150, 10},
  [12604] = {151, 10},
  [12607] = {152, 10},
  [12605] = {153, 10},
  [12610] = {121, 10},
  [12609] = {148, 10},
  [8849] = {110, 10},
  [2547] = {6529, 10},
}
function onAddItem(moveitem, tileitem, position, cid)
local t = c[tileitem.itemid]
  if moveitem.itemid == c.StoneID then
      if t then
          doSendDistanceShoot(getThingPos(cid), position, c.Distance)
          doRemoveItem(moveitem.uid, 1)
          if math.random(0,100) < t[2] then
              doSendMagicEffect(position, c.Effect)
              doTransformItem(tileitem.uid, t[1])
            else
              doPlayerSendCancel(cid, "Failed")
              doSendMagicEffect(position, CONST_ME_POFF)
          end
      end
  end
return true
end
The problem is that it does not do what the script says, it just says this:
Error: sdasda10.png - Click to see more photos on ServImg
I do not see any error in the console or anything but the stone does not work .....

I can not understand why the stone does not work, could you help me or what is my mistake?
Is the stone an usable item?, if you don't change the property to "usable" with item editor it wont let you target the helmet.
 
OP
G

Godz4t4n1c

Member
Joined
Sep 9, 2015
Messages
47
Reaction score
1
Is the stone an usable item?, if you don't change the property to "usable" with item editor it wont let you target the helmet.
Sure, but how do I convert it to usable?, because I tried another item but nothing friend.
 

kingsley666

Intermediate OT User
Joined
Jul 24, 2011
Messages
146
Reaction score
24
Location
Venezuela
Sure, but how do I convert it to usable?, because I tried another item but nothing friend.
Try using a knife, that item is usable, to conver an item to usable you need to use Item Editor, you can find it in tools section.

Then you load the items of your ot and find the one you need to be usable (the stone) by the ingame id, after that you need to modify this property:



Then it should work.
 
OP
G

Godz4t4n1c

Member
Joined
Sep 9, 2015
Messages
47
Reaction score
1
Try using a knife, that item is usable, to conver an item to usable you need to use Item Editor, you can find it in tools section.

Then you load the items of your ot and find the one you need to be usable (the stone) by the ingame id, after that you need to modify this property:



Then it should work.
Nothing, is the same i think it's the script :(
 

SpiderOT

™ツʂριԃҽɾσƚ➽ ٩(•‿•)۶★彡
Joined
Sep 29, 2008
Messages
1,020
Reaction score
112
Location
Egypt/cairo
The script doesn't make any sense
Lua:
<movevent type="AddItem" tileitem="8303" itemid="12606;12603;12604;12607;12605;12610;12609;8849;2547" event="script" value="evolitem.lua"/>
this means when you throw "itemid="12606;12603;12604;12607;12605;12610;12609;8849;2547" on this item "8303" it will trigger the script.
Lua:
if moveitem.itemid == c.StoneID then
this means if the throwed items == the tile item.
which will never trigger the rest of script

based on your script the following one should works
Lua:
local c = {
  Distance = CONST_ANI_EXPLOSION,
  Effect = CONST_ME_BLOCKHIT,
  StoneID = 8303,
  [12606] = {149, 10},
  [12603] = {150, 10},
  [12604] = {151, 10},
  [12607] = {152, 10},
  [12605] = {153, 10},
  [12610] = {121, 10},
  [12609] = {148, 10},
  [8849] = {110, 10},
  [2547] = {6529, 10},
}
function onAddItem(moveitem, tileitem, position, cid)
local t = c[moveitem.itemid]
if tileitem.itemid == c.StoneID and t then
   doSendDistanceShoot(getThingPos(cid), position, c.Distance)
   doRemoveItem(tileitem.uid, 1)
   if math.random(0,100) < t[2] then
       doSendMagicEffect(position, c.Effect)
       doTransformItem(moveitem.uid, t[1])
   else
       doPlayerSendCancel(cid, "Failed")
       doSendMagicEffect(position, CONST_ME_POFF)
   end
end
return true
end
 
OP
G

Godz4t4n1c

Member
Joined
Sep 9, 2015
Messages
47
Reaction score
1
The script doesn't make any sense
Lua:
<movevent type="AddItem" tileitem="8303" itemid="12606;12603;12604;12607;12605;12610;12609;8849;2547" event="script" value="evolitem.lua"/>
this means when you throw "itemid="12606;12603;12604;12607;12605;12610;12609;8849;2547" on this item "8303" it will trigger the script.
Lua:
if moveitem.itemid == c.StoneID then
this means if the throwed items == the tile item.
which will never trigger the rest of script

based on your script the following one should works
Lua:
local c = {
  Distance = CONST_ANI_EXPLOSION,
  Effect = CONST_ME_BLOCKHIT,
  StoneID = 8303,
  [12606] = {149, 10},
  [12603] = {150, 10},
  [12604] = {151, 10},
  [12607] = {152, 10},
  [12605] = {153, 10},
  [12610] = {121, 10},
  [12609] = {148, 10},
  [8849] = {110, 10},
  [2547] = {6529, 10},
}
function onAddItem(moveitem, tileitem, position, cid)
local t = c[moveitem.itemid]
if tileitem.itemid == c.StoneID and t then
   doSendDistanceShoot(getThingPos(cid), position, c.Distance)
   doRemoveItem(tileitem.uid, 1)
   if math.random(0,100) < t[2] then
       doSendMagicEffect(position, c.Effect)
       doTransformItem(moveitem.uid, t[1])
   else
       doPlayerSendCancel(cid, "Failed")
       doSendMagicEffect(position, CONST_ME_POFF)
   end
end
return true
end

Hello, sorry, in XML I put it that way
Lua:
<movevent type="AddItem" tileitem="12606;12603;12604;12607;12605;12610;12609;8849;2547" itemid="8303" event="script" value="evolitem.lua"/>
but keep saying the same, do not send me error in the console or anything, help!!:(
 
Top