Jump to content
  • 0

Extra EXP / DROP Rewards from Monsters killed


Question

Posted

This code I made based on some posts I saw and just attached this onmymobdead. I killed a Drops and it will already give me exp and by adding this code will another line of exp. Is there a way to combine those two and just give me one liner with the total of both?

// Exp Reward
//============================================================
function	script	F_Tower_Exp	{
	setarray .@bonusExp[1],10,20,40,80,100;
	'bonuzExp = .@bonusExp['level_mode];
	set BaseExp, BaseExp + (getmonsterinfo(killedrid,3) * 'bonuzExp);
	set JobExp, JobExp + (getmonsterinfo(killedrid,4) * 'bonuzExp);	
return;
}

image.thumb.png.8c2b3f4d05150a855c1660d40d864ea4.png

Almost same thing for monsters drop although I want it to make the monsters legit drop it not just makeitem script command them.

// Drops Reward
//============================================================
function	script	F_Tower_Drop	{
	setarray .@bonusDrop[1], 20, 40, 60, 80, 100;
	set .@bonus, .@bonusDrop['level_mode];
	set .@map$, getarg(0);
	
		getmapxy .@map$, .@x, .@y;
		getmobdrops(killedrid);
		set .@mc, $@MobDrop_count;
		copyarray .@mi, $@MobDrop_item, .@mc;
		copyarray .@mr, $@MobDrop_rate, .@mc;

			for (set .@i, 0; .@i < .@mc; set .@i, .@i + 1) {
				set .@dropChance, .@mr[.@i] + .@bonus;
				if (rand(1, 100) <= .@dropChance) {
					setarray .@items[getarraysize(.@items)], .@mi[.@i];
				}
			}

			set .@d, getarraysize(.@items);

			if (.@d) {
				for (set .@j, 0; .@j < .@d; set .@j, .@j + 1) {
					makeitem .@items[.@j], 1, .@map$, .@x, .@y;
				}
			}
return;
}

All the help I can get. Thanks in advance!

3 answers to this question

Recommended Posts

  • 0
Posted (edited)
On 5/26/2023 at 10:53 PM, Louis T Steinhil said:

This code I made based on some posts I saw and just attached this onmymobdead. I killed a Drops and it will already give me exp and by adding this code will another line of exp. Is there a way to combine those two and just give me one liner with the total of both?

// Exp Reward
//============================================================
function	script	F_Tower_Exp	{
	setarray .@bonusExp[1],10,20,40,80,100;
	'bonuzExp = .@bonusExp['level_mode];
	set BaseExp, BaseExp + (getmonsterinfo(killedrid,3) * 'bonuzExp);
	set JobExp, JobExp + (getmonsterinfo(killedrid,4) * 'bonuzExp);	
return;
}

To shorten this code, you can use these commands:
 

*getexp <base_exp>,<job_exp>{,<char_id>};

This command will give the invoking character a specified number of base and job
experience points. Used for a quest reward. Negative values won't work.

The EXP values are adjustted by 'quest_exp_rate' config value, VIP bonus, Guild
Tax and EXP boost items such Battle Manual, Bubble Gum, or items that have
SC_EXPBOOST or SC_ITEMBOOST.

	getexp 10000,5000;

---------------------------------------

*getexp2 <base_exp>,<job_exp>{,<char_id>};

This command is safety version of 'set' command for BaseExp and JobExp. If using
'set' while the BaseExp or JobExp value is more than 2,147,483,647 (INT_MAX) will
causing overflow error.

Unlike 'getexp', this command ignores the adjustment factors!

So using getexp2 you could shorten your function, while keeping the same effect as the original:
 

function	script	F_Tower_Exp	{
	setarray(.@bonusExp[1], 10, 20, 40, 80, 100);
	'bonuzExp = .@bonusExp['level_mode];
	
	getexp2(getmonsterinfo(killedrid, 3) * 'bonuzExp, getmonsterinfo(killedrid, 4) * 'bonuzExp))
	
	return;
}

 

Edited by Winterfox

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