Jump to content
Sign in to follow this  
Shrek

Monster Item

Recommended Posts

Can someone help me make A Monster / Boss whatever ( just 1 of them ), After killing it, it gives an item directly to player's invertory ( but not always, with a %, sometimes it gives sometimes it doesnt ).

Share this post


Link to post
Share on other sites

go into exp_and_level.lua and find the function GetExp_PKM

somewhere inside of it add

	local dead_id = GetChaID(dead)
	if dead_id == XXXX then
	local rand = math.random(1,100)
		if rand < 60 then
			GiveItem ( atk , 0 , ItemID , Qt , Ql )	
		else
			BickerNotice ( atk, "You weren't lucky enough. Keep trying!")
		end
	end

changin XXXX for the boss/monster Id, ItemID item's id, Qt for the quantity, Ql for the quality and 60 for the desired % of success rate.

Edited by iZae
  • Like 3

Share this post


Link to post
Share on other sites

@iZae can you give me an example also if i want to use 3 mobs for the same item ( the item is random still )
This would work?

if dead_id == XXXX and if dead_id == XXXX and if dead_id == XXXX then
or this: 
if dead_id == XXXX or if dead_id == XXXX or if dead_id == XXXX then

Edited by Shrek

Share this post


Link to post
Share on other sites
40 minutes ago, Shrek said:

@iZae can you give me an example also if i want to use 3 mobs for the same item ( the item is random still )
This would work?

if dead_id == XXXX and if dead_id == XXXX and if dead_id == XXXX then
or this: 
if dead_id == XXXX or if dead_id == XXXX or if dead_id == XXXX then

 

you have to use "OR". it is physically impossible to get more than 1 id every time you kill a mob, so "if id=... and id= ..." would be senseless.

 

Share this post


Link to post
Share on other sites
local dead_id = GetChaID(dead)
local mob = {}
mob[111] = {ItemDrop = 3457, Quantity = 1, Quality = 4,  Rate = 0.1}	--10% drop
mob[112] = {ItemDrop = 3457, Quantity = 1, Quality = 4,  Rate = 0.2}	--20% drop
if mob[dead_id] ~= nil then
	if Percentage_Random(mob[dead_id].Rate) == 1 then
		GiveItem ( atk, 0, mob[dead_id].ItemDrop, mob[dead_id].Quantity , mob[dead_id].Quality)
	end
end

 

Edited by Syntax
  • Like 5

Share this post


Link to post
Share on other sites
В 14.10.2017 в 17:29, Shrek сказал:

@iZae can you give me an example also if i want to use 3 mobs for the same item ( the item is random still )
This would work?

if dead_id == XXXX and if dead_id == XXXX and if dead_id == XXXX then
or this: 
if dead_id == XXXX or if dead_id == XXXX or if dead_id == XXXX then

 

if dead_id == XXXX or dead_id == XXXX or dead_id == XXXX then
 -- Give Items
end

 


Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Sign in to follow this  

×
×
  • Create New...