Jump to content
  • 0
Adam

Need this script applied to the party, not only the killer in the party

Question

Hello,

Can anyone modify this script so it concerns not only the killer but anyone in the whole party (IF the killer is in one)

That sounds more fair for support classes, right ?

Thanks :)

 

- script custom_drop -1,{

OnNPCKillEvent:

// Global Monster Kill Rewards
set .@rand_gc_drop, rand(1,4000);
if (.@rand_gc_drop <= 25) getitem 512, 1;

set .@rand_sc_drop, rand(1,2000);
if (.@rand_sc_drop <= 5) getitem 513, 1;

set .@rand_bc_drop, rand(1,1000);
if (.@rand_bc_drop <= 1) getitem 511, 1;
}

 

Edited by Adam

Share this post


Link to post
Share on other sites

19 answers to this question

Recommended Posts

  • 0

Patskie's script uses Scenario #1

 

for Scenario #2, its even easier

-	script	custom_drop	-1,{OnNPCKillEvent:	if ( !getcharid(1) ) {		if ( rand(4000) < 25 ) // .@rand_gc_drop ... 25/4000 = 1/160			getitem 512,1;		if ( rand(2000) < 5 ) // .@rand_sc_drop .... 5/2000 = 1/400			getitem 513,1;		if ( rand(1000) < 1 ) // .@rand_gc_drop .... 1/1000			getitem 511,1;	}	else {		getpartymember getcharid(1), 1;		getpartymember getcharid(1), 2;		for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {			if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {				if ( rand(4000) < 25 ) // .@rand_gc_drop ... 25/4000 = 1/160					getitem 512,1, $@partymemberaid[.@i];				if ( rand(2000) < 5 ) // .@rand_sc_drop .... 5/2000 = 1/400					getitem 513,1, $@partymemberaid[.@i];				if ( rand(1000) < 1 ) // .@rand_gc_drop .... 1/1000					getitem 511,1, $@partymemberaid[.@i];			}		}	}	end;}

Share this post


Link to post
Share on other sites
  • 0
-	script	custom_drop	-1,{	OnNPCKillEvent:		// Global Monster Kill Rewards		set .@rand_gc_drop, rand(1,4000);		if (.@rand_gc_drop <= 25) {			if ( !getcharid( 1 ) )				getitem 512, 1;			else {				getpartymember getcharid( 1 ), 1;				getpartymember getcharid( 1 ), 2;				for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {					if ( isloggedin( $@partymemberaid[ .@i ], $@partymembercid[ .@i ] ) ) {						if ( attachrid( $@partymemberaid[ .@i ] ) )							getitem 512, 1;					}				}			}		}		set .@rand_sc_drop, rand(1,2000);		if (.@rand_sc_drop <= 5) {			if ( !getcharid( 1 ) )				getitem 513, 1;			else {				getpartymember getcharid( 1 ), 1;				getpartymember getcharid( 1 ), 2;				for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {					if ( isloggedin( $@partymemberaid[ .@i ], $@partymembercid[ .@i ] ) ) {						if ( attachrid( $@partymemberaid[ .@i ] ) )							getitem 513, 1;					}				}			}		}		set .@rand_bc_drop, rand(1,1000);		if (.@rand_bc_drop <= 1) {			if ( !getcharid( 1 ) )				getitem 511, 1;			else {				getpartymember getcharid( 1 ), 1;				getpartymember getcharid( 1 ), 2;				for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {					if ( isloggedin( $@partymemberaid[ .@i ], $@partymembercid[ .@i ] ) ) {						if ( attachrid( $@partymemberaid[ .@i ] ) )							getitem 511, 1;					}				}			}		}		end;}
Edited by Patskie

Share this post


Link to post
Share on other sites
  • 0

Thanks Patskie.

 

The script still works even if the killer isn't in a party, right ? He -alone- will still randomly get item ?

Edited by Adam

Share this post


Link to post
Share on other sites
  • 0

Ok, good.

 

Last question to make things 100% clear: How does it exactly work the way you've written it ?

Little scenario:

(K, S1, S2 and s3 are partying; K is the main killer, S are support classes.)

 

Scenario #1: Anytime K gets randomly rewarded for killing a monster, everyone in the party also is (S1, S2 and S3)

Or

Scenario #2: Any of K, S1, S2 and S3 can randomly and individually (not everyone get rewarded but just one partymember) get rewarded for a kill made by K

 

Thanks.

Edited by Adam

Share this post


Link to post
Share on other sites
  • 0

Did i seriously misread the word anyone to everyone? T_T

Well Patskie, both scenarios are cool anyways; I just want to make sure I know exactly how things run on the server :)

Just out of curiosity; is the 2nd scenario even script-able? Like the random reward gets randomly to someone in the party? 

 

Thank you for the help, greatly appreciated.

Edited by Adam

Share this post


Link to post
Share on other sites
  • 0

 

Patskie's script uses Scenario #1

 

for Scenario #2, its even easier

-	script	custom_drop	-1,{OnNPCKillEvent:	if ( !getcharid(1) ) {		if ( rand(4000) < 25 ) // .@rand_gc_drop ... 25/4000 = 1/160			getitem 512,1;		if ( rand(2000) < 5 ) // .@rand_sc_drop .... 5/2000 = 1/400			getitem 513,1;		if ( rand(1000) < 1 ) // .@rand_gc_drop .... 1/1000			getitem 511,1;	}	else {		getpartymember getcharid(1), 1;		getpartymember getcharid(1), 2;		for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {			if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {				if ( rand(4000) < 25 ) // .@rand_gc_drop ... 25/4000 = 1/160					getitem 512,1, $@partymemberaid[.@i];				if ( rand(2000) < 5 ) // .@rand_sc_drop .... 5/2000 = 1/400					getitem 513,1, $@partymemberaid[.@i];				if ( rand(1000) < 1 ) // .@rand_gc_drop .... 1/1000					getitem 511,1, $@partymemberaid[.@i];			}		}	}	end;}

Hey Annie, hi all,

 

So I'm finally using your script (scenario #2 :P) and I was wondering if we could add an idle check to it (can easily be abused by Alchemist/Creators with homunculus otherwise) which would "cancel" the custom drop if the player is flagged AFK.

 

Thanks !

Share this post


Link to post
Share on other sites
  • 0
-	script	custom_drop	-1,{OnNPCKillEvent:	if ( !getcharid(1) ) {		if ( checkidle() > 10 ) // 10 seconds			end;		if ( rand(4000) < 25 ) // .@rand_gc_drop ... 25/4000 = 1/160			getitem 512,1;		if ( rand(2000) < 5 ) // .@rand_sc_drop .... 5/2000 = 1/400			getitem 513,1;		if ( rand(1000) < 1 ) // .@rand_gc_drop .... 1/1000			getitem 511,1;	}	else {		.@map$ = strcharinfo(3); // added a map check		getpartymember getcharid(1), 1;		getpartymember getcharid(1), 2;		for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {			if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {				attachrid $@partymemberaid[.@i];				if ( strcharinfo(3) != .@map$ || checkidle() > 10 )					continue;				if ( rand(4000) < 25 ) // .@rand_gc_drop ... 25/4000 = 1/160					getitem 512,1;				if ( rand(2000) < 5 ) // .@rand_sc_drop .... 5/2000 = 1/400					getitem 513,1;				if ( rand(1000) < 1 ) // .@rand_gc_drop .... 1/1000					getitem 511,1;			}		}	}	end;}

Share this post


Link to post
Share on other sites
  • 0

 

-	script	custom_drop	-1,{OnNPCKillEvent:	if ( !getcharid(1) ) {		if ( checkidle() > 10 ) // 10 seconds			end;		if ( rand(4000) < 25 ) // .@rand_gc_drop ... 25/4000 = 1/160			getitem 512,1;		if ( rand(2000) < 5 ) // .@rand_sc_drop .... 5/2000 = 1/400			getitem 513,1;		if ( rand(1000) < 1 ) // .@rand_gc_drop .... 1/1000			getitem 511,1;	}	else {		.@map$ = strcharinfo(3); // added a map check		getpartymember getcharid(1), 1;		getpartymember getcharid(1), 2;		for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {			if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {				attachrid $@partymemberaid[.@i];				if ( strcharinfo(3) != .@map$ || checkidle() > 10 )					continue;				if ( rand(4000) < 25 ) // .@rand_gc_drop ... 25/4000 = 1/160					getitem 512,1;				if ( rand(2000) < 5 ) // .@rand_sc_drop .... 5/2000 = 1/400					getitem 513,1;				if ( rand(1000) < 1 ) // .@rand_gc_drop .... 1/1000					getitem 511,1;			}		}	}	end;}

Made my day. Thanks for this adam, patskie and Annie!.

Edited by Hadeszeus

Share this post


Link to post
Share on other sites
  • 0

I'm just wondering how to prevent the user from getting items if he's alone in the party or the members of his party are offline?

 

Let say if you are in the party you get more item compared to solo or doesn't have a party. 

 

In here, I can filter it using &@partymembercount if he's alone in the party.           

   if ( strcharinfo(3) != .@map$ || checkidle() > 10  || $@partymembercount < 2)    continue;

The problem is if there's any offline member in his party the script is not checking it and continue the amount drops set for party. 

Share this post


Link to post
Share on other sites
  • 0

Replace : 

for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {	if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {		attachrid $@partymemberaid[.@i];		if ( strcharinfo(3) != .@map$ || checkidle() > 10 )			continue;		if ( rand(4000) < 25 ) // .@rand_gc_drop ... 25/4000 = 1/160			getitem 512,1;		if ( rand(2000) < 5 ) // .@rand_sc_drop .... 5/2000 = 1/400			getitem 513,1;		if ( rand(1000) < 1 ) // .@rand_gc_drop .... 1/1000			getitem 511,1;	}}

by :

for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {	if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) )		.c++;}for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {	if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {		attachrid $@partymemberaid[.@i];		if ( strcharinfo(3) != .@map$ || checkidle() > 10 || .c < 2 )			continue;		if ( rand(4000) < 25 ) // .@rand_gc_drop ... 25/4000 = 1/160			getitem 512,1;		if ( rand(2000) < 5 ) // .@rand_sc_drop .... 5/2000 = 1/400			getitem 513,1;		if ( rand(1000) < 1 ) // .@rand_gc_drop .... 1/1000			getitem 511,1;	}}.c = 0;
Edited by Patskie

Share this post


Link to post
Share on other sites
  • 0

 

Replace : 

for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {	if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {		attachrid $@partymemberaid[.@i];		if ( strcharinfo(3) != .@map$ || checkidle() > 10 )			continue;		if ( rand(4000) < 25 ) // .@rand_gc_drop ... 25/4000 = 1/160			getitem 512,1;		if ( rand(2000) < 5 ) // .@rand_sc_drop .... 5/2000 = 1/400			getitem 513,1;		if ( rand(1000) < 1 ) // .@rand_gc_drop .... 1/1000			getitem 511,1;	}}

by :

for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {	if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) )		.c++;}for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {	if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {		attachrid $@partymemberaid[.@i];		if ( strcharinfo(3) != .@map$ || checkidle() > 10 || .c < 2 )			continue;		if ( rand(4000) < 25 ) // .@rand_gc_drop ... 25/4000 = 1/160			getitem 512,1;		if ( rand(2000) < 5 ) // .@rand_sc_drop .... 5/2000 = 1/400			getitem 513,1;		if ( rand(1000) < 1 ) // .@rand_gc_drop .... 1/1000			getitem 511,1;	}}.c = 0;

Thank you Patskie! 

Share this post


Link to post
Share on other sites
  • 0
-	script	custom_drop	-1,{OnNPCKillEvent:	if ( !getcharid(1) ) {		if ( checkidle() > 10 ) // 10 seconds			end;		if ( rand(4000) < 25 ) // .@rand_gc_drop ... 25/4000 = 1/160			getitem 512,1;		if ( rand(2000) < 5 ) // .@rand_sc_drop .... 5/2000 = 1/400			getitem 513,1;		if ( rand(1000) < 1 ) // .@rand_gc_drop .... 1/1000			getitem 511,1;	}	else {		.@map$ = strcharinfo(3); // added a map check		getpartymember getcharid(1), 1;		getpartymember getcharid(1), 2;		for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {			if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {				attachrid $@partymemberaid[.@i];				if ( strcharinfo(3) != .@map$ || checkidle() > 10 )					continue;				if ( rand(4000) < 25 ) // .@rand_gc_drop ... 25/4000 = 1/160					getitem 512,1;				if ( rand(2000) < 5 ) // .@rand_sc_drop .... 5/2000 = 1/400					getitem 513,1;				if ( rand(1000) < 1 ) // .@rand_gc_drop .... 1/1000					getitem 511,1;			}		}	}	end;}

I have a quick question about this script. 

 

If I'm not mistaken this line  strcharinfo(3) != .@map$

checks if all members of the party are in the same map?

 

But it doesn't work like that. Can I request a line of code that checks if the party members are not in the same map they will not get anything from the mobs.

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
Answer this question...

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

×
×
  • Create New...

Important Information

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