DeYaN. 29 Posted January 14, 2016 Share Posted January 14, 2016 I want a quest when i teleport to a map to drop from equip in inventory a specific item. Can someone give me a ex ? Link to comment Share on other sites More sharing options...
Active Member enzi 842 Posted January 14, 2016 Active Member Share Posted January 14, 2016 I don't understand what do you want.. Can you be a little more spesific ? Link to comment Share on other sites More sharing options...
DeYaN. 29 Posted January 15, 2016 Author Share Posted January 15, 2016 (edited) 7 hours ago, enzi said: I don't understand what do you want.. Can you be a little more spesific ? When i teleport(login) than drop that item from equip in inventory . Edited August 24, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
wezt 95 Posted January 15, 2016 Share Posted January 15, 2016 Hey, if I understand you correct, you need to add new quest function in source, which will take as argument item vnum. Something like this pc.unequip_item(vnum) And use it like this (just an example): when login begin if pc.get_map_index() == 113 then pc.unequip_item(101) end end 1 Link to comment Share on other sites More sharing options...
Denis 1474 Posted January 15, 2016 Share Posted January 15, 2016 Here's the function http://pastebin.com/y8b71qeH The quest http://pastebin.com/CNBLSTXU 3 Link to comment Share on other sites More sharing options...
DeYaN. 29 Posted January 17, 2016 Author Share Posted January 17, 2016 On 1/15/2016 at 10:22 AM, Denis said: Here's the function http://pastebin.com/y8b71qeH The quest http://pastebin.com/CNBLSTXU good morning , thx Denis for reply. I put the function in questlua_pc.cpp, i try to change the quest,but don`t work in game. I put the original quest and same problem. Spoiler quest login_cal begin state start begin when login begin local mapindex,vnum = 41,71124 or 41,71125 or 41,71126 or 41,71127 or 41,71128 or 1,71124 or 1,71125 or 1,71126 or 1,71127 or 1,71128 or 21,71124 or 21,71125 or 21,71126 or 21,71127 or 21,71128 if pc.unequip_from_index(mapindex, vnum) then syschat(string.format('Item-ul %d a fost dezechipat.',vnum)) end end end end Link to comment Share on other sites More sharing options...
Former Staff Shisui 490 Posted January 17, 2016 Former Staff Share Posted January 17, 2016 That only happens when teleport/login or also when you click ctrl + g? Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19675 Posted January 17, 2016 Honorable Member Share Posted January 17, 2016 I think this will work: quest login_cal begin state start begin when login begin local t = { [1] = {71124, 71125, 71126, 71127, 71128}, [21] = {71124, 71125, 71126, 71127, 71128}, [41] = {71124, 71125, 71126, 71127, 71128}, } table.foreach(t, function(mapindex, items) for j=1, table.getn(items) do if pc.unequip_from_index(mapindex, items[j]) then syschat(string.format('Item-ul %d a fost dezechipat.', items[j])) end end end) end end end Link to comment Share on other sites More sharing options...
wezt 95 Posted January 17, 2016 Share Posted January 17, 2016 Try change your quest to this: Spoiler quest login_cal begin state start begin when login begin local info_map = { [1] = {41,71124}, [2] = {41,71125}, [3] = {41,71126}, [4] = {41,71127}, [5] = {41,71128}, [6] = {1,71124}, [7] = {1,71125}, [8] = {1,71126}, [9] = {1,71127}, [10] = {1,71128}, [11] = {21,71124}, [12] = {21,71125}, [13] = {21,71126}, [14] = {21,71127}, [15] = {21,71128}, } for j =1,15 do if pc.unequip_from_index(info_map[j][1], info_map[j][2]) then syschat(string.format('Item-ul %d a fost dezechipat.',info_map[j][2])) end end end end end If it won't work, then try to debug quest function. Add this line in source before "if (lMapIndex == ch->GetMapIndex())" sys_err("pc_unequip_from_index lMapIndex :%d vnum:%d", lMapIndex, vnum); Then you'll see in syserr more info about the problem. P.S.: Sry for almost the same quest, didn't see xP3NG3Rx reply. Link to comment Share on other sites More sharing options...
DeYaN. 29 Posted January 18, 2016 Author Share Posted January 18, 2016 Thx you all for reply. I try with all quest. i put the line to see the erorr in syserr , and there are : Spoiler SYSERR: Jan 18 16:22:28 :: RunState: LUA_ERROR: [string "login_cal"]:19: attempt to call field `unequip_from_index' (a nil value) SYSERR: Jan 18 16:22:28 :: WriteRunningStateToSyserr: LUA_ERROR: quest login_cal.start click Link to comment Share on other sites More sharing options...
wezt 95 Posted January 20, 2016 Share Posted January 20, 2016 Try to change c++ quest function to this http://pastebin.com/Um1abyPp P.S.: @Denis, in your function, at this part: " if (item->GetVnum() == vnum) " need to be change to " if (item && item->GetVnum() == vnum)". Because if core trying to get vnum from NULL item it leads to crash. Link to comment Share on other sites More sharing options...
DeYaN. 29 Posted January 20, 2016 Author Share Posted January 20, 2016 I change, didn`t work .. I put the quest function in questlua_pc.cpp and this is : http://pastebin.com/dP0F9bh3 And this is the quest: Spoiler quest login_cal begin state start begin when login begin local info_map = { [1] = {41,71124}, [2] = {41,71125}, [3] = {41,71126}, [4] = {41,71127}, [5] = {41,71128}, [6] = {1,71124}, [7] = {1,71125}, [8] = {1,71126}, [9] = {1,71127}, [10] = {1,71128}, [11] = {21,71124}, [12] = {21,71125}, [13] = {21,71126}, [14] = {21,71127}, [15] = {21,71128}, } for j =1,15 do if pc.unequip_from_index(info_map[j][1], info_map[j][2]) then syschat(string.format('Item-ul %d a fost dezechipat.',info_map[j][2])) end end end end end In syser,same errors... Link to comment Share on other sites More sharing options...
wezt 95 Posted January 20, 2016 Share Posted January 20, 2016 (edited) (1) In questlua_pc.cpp: Search for "{ "get_killee_drop_pct", pc_get_killee_drop_pct }," After add this line "{ "unequip_from_index", pc_unequip_from_index }," Like on screen (2) Also in share/locale/XX/quest/quest_functions you need to add line with "pc.unequip_from_index" Edited August 24, 2022 by Metin2 Dev Core X - External 2 Internal 1 Link to comment Share on other sites More sharing options...
DeYaN. 29 Posted January 20, 2016 Author Share Posted January 20, 2016 Ok,is the first time when i add a function in game source,and i don`t know that. Now i add i come back with a reply for status Link to comment Share on other sites More sharing options...
DeYaN. 29 Posted January 20, 2016 Author Share Posted January 20, 2016 Now is working !! danke wezt Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now