Jump to content
  • 0

Random item drop in a group


deniswalle96

Question


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  32
  • Reputation:   3
  • Joined:  03/15/20
  • Last Seen:  

Given a list of for example, 5 items, is it possible to add them to the drop list of a mob, but in a way that only one of them has a chance to drop when the mob is killed?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  896
  • Reputation:   118
  • Joined:  05/23/12
  • Last Seen:  

U can use OnNPCKillEvent and do some checks

 

Rynbef~

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  32
  • Reputation:   3
  • Joined:  03/15/20
  • Last Seen:  

On 4/15/2024 at 2:38 AM, Rynbef said:

U can use OnNPCKillEvent and do some checks

 

Rynbef~

I kinda figured it out, but I still can't make the item drop on the coordinates where the monster died. Tried getunitdata, but no success.

OnMonsterKilled:
	.@dropchance = rand(1,100);
	if(.@dropchance <= 5){
		getmapxy(.@map$,.@x,.@y,BL_PC);
		setarray .@fateshard[0],1000258,1000259,1000260,1000261,1000262;
		.@randomshard = rand(getarraysize(.@fateshard));
		makeitem (.@fateshard[.@randomshard]),1,.@map$,.@x,.@y;
	}
	dispbottom "Rand: "+.@dropchance;
}

Also, since i'm a complete newbie at scripting, I still don't understand the different scopes of variables, can you enlight me on this one?I've read the doc/script_commands.txt file, but it's not clear to me. Like, when should I use ".@" vs "." var?

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