Jump to content
  • 0

Costumes dropped from mobs


CyberDevil

Question


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.02
  • Content Count:  242
  • Reputation:   37
  • Joined:  02/25/18
  • Last Seen:  

I thought of including costumes among the mobs, but to avoid complicating my life I created this script that I haven't tested:

-	script	Costume_Drop	-1,{
OnNPCKillEvent:
	if ( rand( 10000 ) <= 3 ) { //0.03% drop rate
		.@item_id = F_Rand( 31236,20156,19524,20120,20394,20334,31178 ); //costume drop list
		announce "Congratulations to the player "+ strcharinfo(0) +" who, after killing a "+ getmonsterinfo( killedrid, MOB_NAME ) +" in "+ strcharinfo(3)", got a rare costume!",0,0x00FF00;
		getitem .@item_id,1;
}

With this script every monster on the server has a 0.03% chance of dropping one of the costumes on the list (I'm not sure it works!) And a global announcement is sent for congratulations.
But now I thought that it is better to insert a specific costume for a specific mob as in this list: https://www.shining-moon.com/helheim/index.php/Costume_Drops#Costume_List (thanx @fr0sty123456789 for this idea!)

In this case I could use the file "/rathena/db/mob_item_ratio.txt" with the simple structure "ItemID, Ratio, MonsterID" but so I would lose the global announcement... so I wanted to know if it was possible to modify this script from someone more experienced than me, to have the same function and structure with attached global announcement!?!

Edited by CyberDevil
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

-	script	costume_drop	-1,{
OnNPCKillEvent:
	.@index = inarray(.mob_id[0],killedrid);
	if(.@index < 0) end;
	if(rand(1,10000) <= .chance){
		explode(.@ID$,.drop_data$[.@index],":");
		announce "Congratulations to the player "+ strcharinfo(0) +" who, after killing a "+ getmonsterinfo( killedrid, MOB_NAME ) +" in "+ strcharinfo(3) +", got a rare costume!",0,0x00FF00;
		getitem atoi(.@ID$[1]),1;
		deletearray .@ID$[0],getarraysize(.@ID$);
	}
	end;
		
OnInit:
	.chance = 3; 
	setarray .drop_data$,
	"1001:501","1002:502","1003:503","1005:504"; //= "Mob ID:Costume ID"
	for(.@i = 0; .@i < getarraysize(.drop_data$); .@i++){
		explode(.@mob_id$,.drop_data$[.@i],":");
		.mob_id[.@i] = atoi(.@mob_id$[0]);
		deletearray .@mob_id$[0],getarraysize(.@mob_id$);
	}
	end;
}

I haven't tested this yet, but it should work fine :))

Edited by crazyarashi
  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.02
  • Content Count:  242
  • Reputation:   37
  • Joined:  02/25/18
  • Last Seen:  

Thank you @crazyarashi,
but in this case the variable ".chance = 3;" is it also affected by the server's drop rate?
This option:

// The rate at which equipment is dropped.
item_rate_equip: 100

at: https://github.com/rathena/rathena/blob/master/conf/battle/drops.conf#L62

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

No it's not. :))

  • Upvote 1
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...