Jump to content
  • 0

Extra EXP / DROP Rewards from Monsters killed


Louis T Steinhil

Question


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  84
  • Reputation:   12
  • Joined:  06/22/13
  • Last Seen:  

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!

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

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

The exp u can't shorter. To do both in one. Maybe just something like:

BaseExp += (getmonsterinfo(killedrid,3) * 'bonuzExp);

 

Monster drop u can take a look at addmonsterdrop but u need to do this OnInit.

https://github.com/rathena/rathena/blob/379009b31f8b50443c5b3b489c55e8d27205557a/doc/script_commands.txt#L6875

 

Rynbef~

Edited by Rynbef
Added idea
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  232
  • Reputation:   86
  • Joined:  06/30/18
  • Last Seen:  

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