Masuka00 54 Report post Posted September 26, 2016 hello i wanted to know how to add my own items on npc scrip i found ExchangeData( 2608 , 100 , 2682 , 1 , 1) ExchangeData( 2609 , 100 , 2683 , 1 , 1) ExchangeData( 2609 , 1000 , 2684 , 1 , 1) ExchangeData( 2608 , 100 , 2692 , 1 , 1) ExchangeData( 2609 , 100 , 2693 , 1 , 1) ExchangeData( 2609 , 1000 , 2694 , 1 , 1) ExchangeData( 2608 , 100 , 2702 , 1 , 1) ExchangeData( 2609 , 100 , 2703 , 1 , 1) ExchangeData( 2609 , 1000 , 2704 , 1 , 1) ExchangeData( 2608 , 100 , 2712 , 1 , 1) ExchangeData( 2609 , 100 , 2713 , 1 , 1) ExchangeData( 2609 , 1000 , 2714 , 1 , 1) and i saw in variable ChangeItemList[ 248 ]= { 855 , 600 , 803 , 1 } buti still donth understand and i got lost, can some one guide me please Quote ǤØĐ βŁ€ŞŞ ƤƗŘΔĆ¥ Share this post Link to post Share on other sites
Billy 164 Report post Posted September 26, 2016 Since the packet sent from client to server when you use the exchange npc contains the item ID, the ChangeItemList table is required as it contains all the valid exchanges and compares the IDs in the packet received to it. You can edit ExchangeData function to contain something like: table.insert(ChangeItemList,{srcID, srcNum, tarID, tarNum}) To automaticly make this table for you, then you can just use: ExchangeData( srcID, srcNum, tarID, tarNum, timeNum ) 1 Quote Share this post Link to post Share on other sites
Masuka00 54 Report post Posted September 26, 2016 3 minutes ago, Billy said: Since the packet sent from client to server when you use the exchange npc contains the item ID, the ChangeItemList table is required as it contains all the valid exchanges and compares the IDs in the packet received to it. You can edit ExchangeData function to contain something like: table.insert(ChangeItemList,{srcID, srcNum, tarID, tarNum}) To automaticly make this table for you, then you can just use: ExchangeData( srcID, srcNum, tarID, tarNum, timeNum ) Could you write and example how will be added in an NPC and in the variable i still got lost Quote ǤØĐ βŁ€ŞŞ ƤƗŘΔĆ¥ Share this post Link to post Share on other sites
Shako 97 Report post Posted September 26, 2016 (edited) 6 hours ago, Billy said: Since the packet sent from client to server when you use the exchange npc contains the item ID, the ChangeItemList table is required as it contains all the valid exchanges and compares the IDs in the packet received to it. You can edit ExchangeData function to contain something like: table.insert(ChangeItemList,{srcID, srcNum, tarID, tarNum}) To automaticly make this table for you, then you can just use: ExchangeData( srcID, srcNum, tarID, tarNum, timeNum ) Can you explain a more? Would this just be for automatically creating a table for ChangeItemList? How would you implement that? With a new function or with an existing one? Edited September 26, 2016 by Shako Quote Sunny Go! Online pko.host Share this post Link to post Share on other sites
Juan 20 Report post Posted September 26, 2016 13 hours ago, Covadola said: hello i wanted to know how to add my own items on npc scrip i found ExchangeData( 2608 , 100 , 2682 , 1 , 1) ExchangeData( 2609 , 100 , 2683 , 1 , 1) ExchangeData( 2609 , 1000 , 2684 , 1 , 1) ExchangeData( 2608 , 100 , 2692 , 1 , 1) ExchangeData( 2609 , 100 , 2693 , 1 , 1) ExchangeData( 2609 , 1000 , 2694 , 1 , 1) ExchangeData( 2608 , 100 , 2702 , 1 , 1) ExchangeData( 2609 , 100 , 2703 , 1 , 1) ExchangeData( 2609 , 1000 , 2704 , 1 , 1) ExchangeData( 2608 , 100 , 2712 , 1 , 1) ExchangeData( 2609 , 100 , 2713 , 1 , 1) ExchangeData( 2609 , 1000 , 2714 , 1 , 1) and i saw in variable ChangeItemList[ 248 ]= { 855 , 600 , 803 , 1 } buti still donth understand and i got lost, can some one guide me please Check guide section> how to make a new npc, i explained a bit there Quote Share this post Link to post Share on other sites
Shako 97 Report post Posted September 27, 2016 @Covadola U have to add to NPC, and then add that exchange to ChangeItemList in variable.lua. Warning: Long post below Spoiler @Billy's script addition made it so that you don't have to change ChangeItemList anymore, by adding the line table.insert( ChangeItemList , { srcID , srcNum , tarID , tarNum } ) into the function function ExchangeData( srcID, srcNum, tarID, tarNum, timeNum ) if srcID == nil or srcNum == nil or tarID == nil or tarNum == nil or timeNum == nil then LG( "npcinit_error", "ExchangeData: Function parameter error!srcID, srcNum, tarID, tarNum, timeNum", srcID, srcNum, tarID, tarNum, timeNum ) return end Exchange.count = Exchange.count + 1 --兑换数据 Exchange.srcid[Exchange.count] = srcID Exchange.srcnum[Exchange.count] = srcNum Exchange.tarid[Exchange.count] = tarID Exchange.tarnum[Exchange.count] = tarNum Exchange.timenum[Exchange.count] = timeNum end in ScriptSDK.lua (like this) function ExchangeData( srcID, srcNum, tarID, tarNum, timeNum ) if srcID == nil or srcNum == nil or tarID == nil or tarNum == nil or timeNum == nil then LG( "npcinit_error", "ExchangeData: Function parameter error!srcID, srcNum, tarID, tarNum, timeNum", srcID, srcNum, tarID, tarNum, timeNum ) return end table.insert( ChangeItemList , { srcID , srcNum , tarID , tarNum } ) Exchange.count = Exchange.count + 1 --兑换数据 Exchange.srcid[Exchange.count] = srcID Exchange.srcnum[Exchange.count] = srcNum Exchange.tarid[Exchange.count] = tarID Exchange.tarnum[Exchange.count] = tarNum Exchange.timenum[Exchange.count] = timeNum end in ScriptSDK.lua Now, you can make your NPC, and put in ExchangeData( 2608 , 100 , 2682 , 1 , 1) or whatever you want. Now, for my explanation If you wanted to make an exchange function with another character in the map already using the function, it will overlap and won't work. So you have to make your own: Search for: function ExchangeData( srcID, srcNum, tarID, tarNum, timeNum ) function SendExchangeData( character, npc ) function InitExchange() and make your own script, such as: ExchangeData2 SendExchangeData2 InitExchange2 and then put into NpcSdk.lua function MsgProc elseif item.func == SendExchangeData2 then return SendExchangeData2( character, npc ) next to the original one. Then, you will have 2 exchange NPCs in 1 map. This can be a guide on it's own 1 Quote Sunny Go! Online pko.host Share this post Link to post Share on other sites
Shako 97 Report post Posted September 27, 2016 1 minute ago, Shako said: @Covadola U have to add to NPC, and then add that exchange to ChangeItemList in variable.lua. Warning: Long post below Reveal hidden contents @Billy's script addition made it so that you don't have to change ChangeItemList anymore, by adding the line table.insert( ChangeItemList , { srcID , srcNum , tarID , tarNum } ) into the function function ExchangeData( srcID, srcNum, tarID, tarNum, timeNum ) if srcID == nil or srcNum == nil or tarID == nil or tarNum == nil or timeNum == nil then LG( "npcinit_error", "ExchangeData: Function parameter error!srcID, srcNum, tarID, tarNum, timeNum", srcID, srcNum, tarID, tarNum, timeNum ) return end Exchange.count = Exchange.count + 1 --兑换数据 Exchange.srcid[Exchange.count] = srcID Exchange.srcnum[Exchange.count] = srcNum Exchange.tarid[Exchange.count] = tarID Exchange.tarnum[Exchange.count] = tarNum Exchange.timenum[Exchange.count] = timeNum end in ScriptSDK.lua (like this) function ExchangeData( srcID, srcNum, tarID, tarNum, timeNum ) if srcID == nil or srcNum == nil or tarID == nil or tarNum == nil or timeNum == nil then LG( "npcinit_error", "ExchangeData: Function parameter error!srcID, srcNum, tarID, tarNum, timeNum", srcID, srcNum, tarID, tarNum, timeNum ) return end table.insert( ChangeItemList , { srcID , srcNum , tarID , tarNum } ) Exchange.count = Exchange.count + 1 --兑换数据 Exchange.srcid[Exchange.count] = srcID Exchange.srcnum[Exchange.count] = srcNum Exchange.tarid[Exchange.count] = tarID Exchange.tarnum[Exchange.count] = tarNum Exchange.timenum[Exchange.count] = timeNum end in ScriptSDK.lua Now, you can make your NPC, and put in ExchangeData( 2608 , 100 , 2682 , 1 , 1) or whatever you want. Now, for my explanation If you wanted to make an exchange function with another character in the map already using the function, it will overlap and won't work. So you have to make your own: Search for: function ExchangeData( srcID, srcNum, tarID, tarNum, timeNum ) function SendExchangeData( character, npc ) function InitExchange() and make your own script, such as: ExchangeData2 SendExchangeData2 InitExchange2 and then put into NpcSdk.lua function MsgProc elseif item.func == SendExchangeData2 then return SendExchangeData2( character, npc ) next to the original one. Then, you will have 2 exchange NPCs in 1 map. This can be a guide on it's own Now the question: Is there a better way to do this? 1 Quote Sunny Go! Online pko.host Share this post Link to post Share on other sites
Masuka00 54 Report post Posted September 27, 2016 Well @Shako i think i am gonna pass this one its complicated and donth take me wrong guys but i got 1 day no sleep and still not figure out i forgot this is 2016 not 2009 all you guys know alot and i am still with the basic stuff Quote ǤØĐ βŁ€ŞŞ ƤƗŘΔĆ¥ Share this post Link to post Share on other sites
Shako 97 Report post Posted September 27, 2016 (edited) Okay ._. @Covadola Edited September 27, 2016 by Shako Quote Sunny Go! Online pko.host Share this post Link to post Share on other sites
Angelix 374 Report post Posted September 27, 2016 12 minutes ago, Covadola said: Well @Shako i think i am gonna pass this one its complicated and donth take me wrong guys but i got 1 day no sleep and still not figure out i forgot this is 2016 not 2009 all you guys know alot and i am still with the basic stuff One day? It might seem basic, yet you don't know how to do it, so how is it basic? A lot of people with knowledge started the same, just because they didn't get answers on a forum didn't mean they gave up, they started looking how scripts worked and eventually worked them out or found a way around it. That didn't take one day, it might of took a week even to understand everything completely. 1 Quote Share this post Link to post Share on other sites
Masuka00 54 Report post Posted September 27, 2016 46 minutes ago, Angelix said: One day? It might seem basic, yet you don't know how to do it, so how is it basic? A lot of people with knowledge started the same, just because they didn't get answers on a forum didn't mean they gave up, they started looking how scripts worked and eventually worked them out or found a way around it. That didn't take one day, it might of took a week even to understand everything completely. Thanks @Angelix It was more difficult than I thought thanks to @Shako for helping me to solve this problem and @Billy for the table.insert, thank you guys 1 Quote ǤØĐ βŁ€ŞŞ ƤƗŘΔĆ¥ Share this post Link to post Share on other sites