Jump to content
  • 0

"Item Disassembler" NPC


jeffsaber

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  3
  • Reputation:   0
  • Joined:  03/16/20
  • Last Seen:  

Hello.

I'm trying to make an NPC script that allows a player to "Disassemble" specific items from their inventory (not equipped), and will yield results depending on the following factors:

1. Item Tier
- Depending on the ItemID. Determines whether the item to be disassembled belongs to the following:
> Soul Weapons
> Advanced Soul Weapons
> Easter Egg Quest Reward Weapons
> Faction Weapons
> Valkyrie Equipment
> Diabolus Equipment
> Sinister Equipment
> Dual-Slotted Armors
> Faction Equipment
> Ubergarments
> Advanced Headgear
> Geffen Magic Tournament Equipment
> Upgraded Geffen Magic Tournament Equipment

2. Refine Level
- Depending on refine level, either the amount or rate at which better items are yielded via disassembling the item increases.

3. Compounded Cards and Enhancements
- Depending on the rarity and level of enhancements, either the amount or rate at which better items are yielded via disassembling the item increases.

4. Faction (Clan) Alignment
- Depending on which Faction the player belongs to, changes the possible item yield of the disassembly process. If the player is Neutral (No Faction), then there is no change.

I may have realized mid-way through writing the initial settings that I may have gotten into something that's way above my skill level in code (I'm still pretty much a newbie at scripting), and am in need of assistance regarding this matter.

Here's what I've done so far, and where I am currently stuck at.

setarray .@itemtier[0],1283,1323,1489,1746,1830,1935,1992,2007,2115,2185,2186,2357,2361,2362,2363,2374,2375,2410,2421,2433,2524,2537,2632,2633,2750,2792,2793,5013,5171,5297,5373,5762,5808,13076,13088,13115,13431,15073,15074,15146,15177,20058,20059,20060,20061,20062,20063,20064,20065,20066,20067,20068,20069,20070,28605,28913,39000,39001,39002,39003,39004,39005,39006,39007,39008,39009,39010,39011,39012,39013,39014,39015,39016,39016,39017,39018,39019,39020,39021,39022,39023,39024,39025,39026,39027,39028,39029,39030,39032,39033,39034,39035,39036,39037,39038,39039,39040,39041,39046,39047,39048,39049,39050,39051,39052,39053,39054,39055,39056,40001,40003,40004,40005,40007,40008,40009,40010,10011,40012,40013,40014,40015,40016,40017,40018,40021,40023,40024,40025,40027,40028,40029,40030,40031,40032,40033,40034,40035,40036,40037,40038,40041,40043,40044,40045,40047,40048,40049,40050,40051,40052,40053,40054,40055,40056,40057,40058,40100,40101,40102,40103,40105,40109,40110,40111,40112,40200,40201,40202,40203;
set .@itemtcount,getarraysize(.@itemtier);
getinventorylist;
for ( .@i = 0; .@i < @inventorylist_count; .@i++ ) {
if (@inventorylist_id[.@i] == .@itemtier[.@h] && @inventorylist_equip[.@i] == 0 && @inventorylist_refine[.@i] < 11 && @inventorylist_card1[.@i] >= 0 && @inventorylist_card2[.@i] >= 0 && @inventorylist_card3[.@i] >= 0 && @inventorylist_card4[.@i] >= 0){
for ( .@j = 0; .@j < @inventorylist_count; .@j++ ) {
set .@blender[.@j],@inventorylist_id[.@i];
set .@blender$[.@j],getitemname(@inventorylist_id[.@i]);
set .@blendref[.@j],@inventorylist_refine[.@i];
set .@blendc1[.@j],@inventorylist_card1[.@i];
set .@blendc2[.@j],@inventorylist_card2[.@i];
set .@blendc3[.@j],@inventorylist_card3[.@i];
set .@blendc4[.@j],@inventorylist_card4[.@i];
}
}
}
set .@blen1,getarraysize(.@blender);
set .@blen2,getarraysize(.@blendref);
set .@blen3,getarraysize(.@blendc1);
set .@blen4,getarraysize(.@blendc2);
set .@blen5,getarraysize(.@blendc3);
set .@blen6,getarraysize(.@blendc4);
set .@blendsize,getarraysize(.@blender$);
set .@blend$,implode(.@blender$, ":");
.@j = select( .@blend$ ) - 1;

Getting confused with the looping process that's supposed to check if the items in the player's inventory (@inventorylist_id) matches the items in the "Able to Disassemble" itemID list (.@itemtier), and double-checks with getinventorylist if the above criteria for the disassembly process are met.

I couldn't wrap my head around that looping process, but then there's the issue of displaying every single item in the player's inventory that are able to be disassembled into the NPC's menu (.@blend$).

I couldn't set the other parameters (e.g. the player's alignment via getcharid(5) or query_sql("SELECT `clan_id` FROM `char` WHERE `char_id` = '"+getcharid(0)+"'");, and the item yield from the process itself) and add NPC flair, such as dialogue, unless I get past this hurdle lol

Thank you in advance, and sorry for being an overbearing newbie ?

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

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

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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...