Add a Global Function to bring generical checkweight where needed

Ragno

Retired Staff
Messages
133
Points
0
Github
AtlantisRO
Emulator
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.

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


 
Last edited by a moderator:
sometime, I just don't understand why must official server check for Knife or 1000 weight but not the target item/weight 
default_biggrin.png
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.

 
callfunc( "F_CheckWeight", Knife, 1, 1000 );

Code:
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 );

Code:
function	F_CheckWeight2	{
	.@weight = getarg(2, 1000);
	
	return (checkweight2(getarg(0), getarg(1)) && MaxWeight - Weight < .@weight);
}
something like these i guess...

 
Back
Top