Jump to content
Sign in to follow this  
Ragno

Add a Global Function to bring generical checkweight where needed

Recommended Posts

Almost all the npcs makes checkweight checks prior to give items to players, but there are still some others that misses this checkquest and produces error in player's quest.

 

As an example, not too long it was added a custom checkweight to quest_13_2.txt script to avoid issues in player's quest when inventory is full.

 

So, what about introducing a global function to bring a generical checkweight to add to npcs with this problems? Generical message is this:

 

	if (checkweight(Knife,1) == 0 || MaxWeight - Weight < 1000) {
		mes "- Currently you're carrying -";
		mes "- too many items with you. -";
		mes "- Please try again after you -";
		mes "- lose some weight. -";
		close;
	}

And it also can be added an aditional argument to set specific weight values to check. This way it could bring easily those checks and also have a quick reference to know that check is custom.

Share this post


Link to post
Share on other sites

sometime, I just don't understand why must official server check for Knife or 1000 weight but not the target item/weight  :D

Share this post


Link to post
Share on other sites

sometime, I just don't understand why must official server check for Knife or 1000 weight but not the target item/weight  :D

 

Maybe they just have the template for it or it may be hard to search for specific values.

 

I'm actually working on this, mostly because the sign quest, we always have players who doesn't receive some quest items because inventory is full.

Share this post


Link to post
Share on other sites
callfunc( "F_CheckWeight", Knife, 1, 1000 );
function	F_CheckWeight	{
	.@itemid = getarg(0, Knife);
	.@amount = getarg(1, 1);
	.@weight = getarg(2, 1000);
	
	return (checkweight(.@itemid, .@amount) && MaxWeight - Weight < .@weight);
}

and

callfunc( "F_CheckWeight2", .@array_nameid, .@array_amount, 1000 );
function	F_CheckWeight2	{
	.@weight = getarg(2, 1000);
	
	return (checkweight2(getarg(0), getarg(1)) && MaxWeight - Weight < .@weight);
}

something like these i guess...

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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.