Jump to content
  • 0

Item Combo Script Command


Dolphin86

Question


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  757
  • Reputation:   17
  • Joined:  01/07/12
  • Last Seen:  

hello guys, i have a question, how should i put the script for item for as described below?

player have a weapon in inventory (equipped) and 1 more item etc in player inventory, 

now when a player kill a monster it will drop a bonus item ( we call it meat for now ) which is 100% drop rate, but if player have 1 more item in player inventory (we call this item a medal for now), it will drop 100% sure drop a diffrent item ( we call it Big Meat for now ) and it wont drop (meat) but instead it drop ( Big Meat )

item drop depends on what weapon using and what type of medal player have

if player do not have medal only weapon it will just drop (meat)

but if player have both weapon and medal, it will drop (Big Meat) instend of (meat)

my plan was to make diffrent type of item drop depends on what weapon and medal combination player had

diffrent type of weapon and medal will drop diffrent type of bonus item (100% drop) 

just need a working example with some guide or explaint how does the script works will do good

thanks !

 

Edited by Dolphin86
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  446
  • Reputation:   30
  • Joined:  12/08/11
  • Last Seen:  

 

-	script	item_bonus_drop	-1,{
OnInit:
	// List of Equipments with bonus drop
	setarray .Equipments,1107,1201,1222;
	end;

OnNPCKillEvent:
	// Get the id of the equipped item
	.@itemid = getequipid(EQI_HAND_R);

	// Medal ID is 35001
	// End the script if equipment is not equipped and no medal in the inventory
	if ( inarray(.Equipments, .@itemid) < 0 && countitem(35001) ) end;

	// GID of mob killed (do not touch)
	.@killedgid = killedgid;

	// Amount to drop (default: 1)
	.@amount = 1;

	// When a Medal is detected, set drop base on what is equipped
	// If no medal is detected, the else section will be the default
	if ( countitem(35001) ) {
		switch(.@itemid) {
		case 1107: // Blade [3]
			.@dropid = 512; // Apple
			break;
		case 1201: // Knife [3]
			.@dropid = 582; // Orange
			break;
		default: // Equipping Damascus will drop meat
			.@dropid = 35002; // Big Meat
			break;
		}
	/*} else if ( countitem(MEDAL_ID_HERE) ) {
		// Similar to above, modify loots base on whatever medal is detected in your inventory.
		// You also have to consider the priority if there are multiple medals in the inventory.
	*/
	} else {
		// Default drops for each equipment when Medal is not detected
		// If not specified, default drop is Meat(517)
		switch(.@itemid) {
		case 1107: // Blade [3]
			.@dropid = 512; // Apple
			break;
		case 1201: // Knife [3]
			.@dropid = 582; // Orange
			break;
		default: // Equipping Damascus will drop meat
			.@dropid = 517; // Meat
			break;
		}
	}

	// Determine player and monster positions, don't touch
	getunitdata .@killedgid, .@mob;
	.@mymap$ = strcharinfo(3);

	// Drop randomly around the monster
	// Check script 'checkcell' on how to check a cell if reachable for the loot(s)
	makeitem .@dropid, .@amount, .@mymap$, .@mob[UMOB_X] + rand(-1, 1), .@mob[UMOB_Y] + rand(-1, 1);

	end; // End of script
}

I've not tested the code so it may contain warnings or errors.

There are multiple ways to achieve this but i think this is the most basic. Like for example, you can skip the else section when setting drops and just use an array in the beginning to hold the default loots for each equipment only leaving the part where the loot is modified when a medal is detected in the inventory.

Edited by Magnetix
Link to comment
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
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...