Jump to content

Recommended Posts

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

  • Love 1
Link to comment
Share on other sites

On 1/15/2016 at 10:22 AM, Denis said:

 

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

  • Honorable Member

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

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

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

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

(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

mEMHJT.png

 

(2)

Also in share/locale/XX/quest/quest_functions you need to add line with "pc.unequip_from_index"

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1
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.