Jump to content
FapFap

Exchanger NPC

Recommended Posts

I made an Exchanger NPC and im having such error at lua_err.txt

[06-14 17:30:43]resource/script/MisSdk/NpcSdk.lua:173: attempt to index local `exchangeData' (a nil value)


Exchanger NPC Script:

function exch_1 ()

	Talk( 1, "Exchanger: Hi, welcome! How can I help you?" )
	Text( 1, "Exchange Item", SendExchangeXData)
	Text( 1, "Nothing...",CloseTalk )

	InitExchangeX() 
	ExchangeDataX(	7505	,	300	,	7591	,	1	,	1)
end 


NpcSdk.lua Function:

function SendExchangeXData( character, npc, exchangeData )
	local packet = GetPacket()
	WriteCmd( packet, CMD_MC_EXCHANGEDATA )
	local npcid = GetCharID( npc )
	WriteDword( packet, npcid )
	
	if exchangeData.count ~= nil then
		WriteWord( packet, exchangeData.count )
		
		for n = 1, exchangeData.count, 1 do
			WriteWord( packet, exchangeData.srcid[n] )
			WriteWord( packet, exchangeData.srcnum[n] )
			WriteWord( packet, exchangeData.tarid[n] )
			WriteWord( packet, exchangeData.tarnum[n] )
		end
	else
		WriteWord( packet, 0 )
	end
	
	SendPacket( character, packet );
end



Error shows at SystemNotice after clicking "Exchange Item"

Edited by FapFap

Share this post


Link to post
Share on other sites
On 6/14/2019 at 8:03 PM, Leba said:

You have to add an appropriate ChangeItemList[] line in variable.lua too if I remember right.

I already did, but its showing the error that i posted here

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...