Jump to content
  • 0

Refine On Equip Global


Question

Posted (edited)

Hello, I would like to know if there is any variable that detects when the person equips some equipment.
I would like to use this variable to refine equipment when equipping anywhere in the server.

Example:

2220,Hat,Hat,4,1000,,200,,2,,0,0xFFFFFFFF,63,2,256,,0,1,16,{},{ atcommand "@refine 256 20";  },{}
2301,Cotton_Shirt,Cotton Shirt,4,10,,100,,10,,0,0xFFFFFFFF,63,2,16,,0,1,0,{},{ atcommand "@refine 16 20"; },{}
1201,Knife,Knife,5,50,,400,17,,1,3,0x3E9F7EEF,63,2,2,1,1,1,1,{},{ atcommand "@refine 2 20"; },{}
2101,Guard,Guard,4,500,,300,,20,,0,0xFFFFFFFF,63,2,32,,0,1,1,{},{ atcommand "@refine 32 20"; },{}

I want something like that, but without writing this all times.

Edited by Griemfiend

2 answers to this question

Recommended Posts

  • 0
Posted (edited)
17 hours ago, Griemfiend said:

I want something like that, but without writing this all times.

Not that I know of... I've never tried OnEquip_Script inside of a npc script but I don't see how that would even work. That being said there is an alternative.

I'm just going to post the two methods I worked out feel free to use either although they are both untested.
 

Simple:

-	script	set_script_npc	-1,{
	for( .@a = 0; .@a < .len; .@a++ )
		setitemscript .item_ids[.@a], "{ atcommand \"@refine "+getiteminfo( .item_ids[.@a], 5 )+" 20\"; }", 1;
	end;
	
OnInit:
	setarray .item_ids, 2220, 2301, 1201, 2101;
	.len = getarraysize( .item_ids );
}

 

Convoluted:

-	script	set_script_npc	-1,{
	for( .@a = 0; .@a < .len; .@a++ ) {
		.@equip_loc = getiteminfo( .item_ids[.@a], 5 );
		for( .@b = 0; pow( 2, .@b ) <= .@equip_loc; .@b++ )
			if( .@equip_loc & pow( 2, .@b ) ) {
				setitemscript .item_ids[.@a], "{ callfunc(\"on_eq_refiner\","+.script_equip_slot[.@a]+"); }", 1;
				break;
			}
	}
	end;
	
OnInit:
	setarray .item_ids, 2220, 2301, 1201, 2101;
	setarray .script_equip_slot, EQI_HEAD_LOW, EQI_HAND_R, EQI_ACC_R, EQI_ARMOR, EQI_HAND_L, EQI_SHOES,
								 EQI_ACC_L, EQI_HEAD_TOP, EQI_HEAD_MID, EQI_COSTUME_HEAD_TOP, EQI_COSTUME_HEAD_MID,
								 EQI_COSTUME_HEAD_LOW, EQI_COSTUME_GARMENT, 0, EQI_AMMO, EQI_SHADOW_ARMOR, EQI_SHADOW_WEAPON,
								 EQI_SHADOW_SHIELD, EQI_SHADOW_SHOES, EQI_SHADOW_ACC_R, EQI_SHADOW_ACC_L;
	.len = getarraysize( .item_ids );
}

function	script	on_eq_refiner	{
	.@refine = getequiprefinerycnt( getarg(0) );
	if( .@refine < 20 )
		successrefitem getarg(0), 20 - .@refine;
	return;
}

 

Edited by Skorm
  • Upvote 1

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...