Jump to content

pc.give_item2_select() function


Recommended Posts

				local res = mysql_query("SELECT vnum,applytype0,applyvalue0,applytype1,applyvalue1,applytype2,applyvalue2,applytype3,applyvalue3,applytype4,applyvalue4,socket0,socket1,socket2 FROM player.test WHERE item_id='"..tostring(item_id).."'")
				pc.give_item2_select(tonumber(res[1][1]))
				item.set_socket(0,tonumber(res[1][12]))
				item.set_socket(1,tonumber(res[1][13]))
				item.set_socket(2,tonumber(res[1][14]))
				item.set_attr(tonumber(res[1][2]),tonumber(res[1][3]))
				item.set_attr(tonumber(res[1][4]),tonumber(res[1][5]))
				item.set_attr(tonumber(res[1][6]),tonumber(res[1][7]))
				item.set_attr(tonumber(res[1][8]),tonumber(res[1][9]))
				item.set_attr(tonumber(res[1][10]),tonumber(res[1][11]))

I have this piece of code and the quest stops at the line item.set_socket(0,tonumber(res[1][12])), i think that the item is not even selected.

Ingame i receive the item but bonuses and stones are not added...

I try to chat(item.get_id()) but quest stops there too...

Syserr:

RunState: LUA_ERROR: locale/germany/quest/object/state/auction:35: attempt to index global `item' (a string value) WITH ERRORCODE 1
RunState: LUA_STATE: index 0 ref 3

Any expert who can help??!

I am using Vanilla core

Link to comment
Share on other sites

pc.give_item2 returns the new item id, so you can do this way:

 

local id = pc.give_item2(12345)

local ret = item.select(id)

if not ret then syschat("something is wrong") else

...

end

 

I have tried this way, but quest stops again at line local ret = item.select(id)  i even chat(id) and it returns me correctly the item id...

What the hell is wrong o.O

Link to comment
Share on other sites

Maybe you have an error in the quest. If you named a variable to "item" it will overwrite the "userdata object" and a function call on it may cause a "attempt to index global `item' (a string value)" like error.

 

That was the case :)

Now the whole quest is executed but i still have a problem, the item that i receive does not take any socket nor bonuses

Link to comment
Share on other sites

  • Bronze

I remember at the moment. item.set_socket and another functions using "GetCurrentItem" if you don't select current item, system does not work.

 

Like ATAG said. But this solution not work on your quest. Try with cell.

local a = mysql_query("select pos from player.item where vnum = '"..tostring(item_id).."',applytype,etc")
local b = item.select_cell(a[1])
item.set_socket(0,row[2])
item.select_cell(

Best Regards

Ellie

 

Do not be sorry, be better.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.