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

Adam

New member
Messages
66
Points
0
Github
Adam
Emulator
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
default_smile.png


- 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;
}
 
Last edited by a moderator:
Code:
-	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;}
 
Last edited by a moderator:
Thanks Patskie.

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

 
Last edited by a moderator:
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.

 
Last edited by a moderator:
First one. Did i seriously misread the word anyone to everyone? T_T

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


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.

 
Last edited by a moderator:
Patskie's script uses Scenario #1

for Scenario #2, its even easier

Code:
-	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;}
 
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
default_tongue.png
) 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 !

 
Code:
-	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;}
 
- 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!.

 
Last edited by a moderator:
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. 
 
Nice variation of annie's original script, and interesting request.

 
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 :

Code:
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;
 
Last edited by a moderator:
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! 

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

 
Back
Top