Jump to content
  • 0
Sign in to follow this  
Triedge

attached a random party member online.

Question

Lately I'm working on a script party.
But I need the bounty on its members are very fair.
I have no problem with the traditional method.
But I would be more useful if you could attach a party member at random, but hey seen that if the member is not online the script practically stops.
What options do I have?

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0
prontera,150,150,0	script	Sample	100,{	if ( getcharid( 1 ) ) {		getpartymember getcharid( 1 ), 1;		getpartymember getcharid( 1 ), 2;		do {			.index = rand( $@partymembercount );			.random_member$ = rid2name( $@partymemberaid[ .index ] );		} while ( !isloggedin( $@partymemberaid[ .index ], $@partymembercid[ .index ] ) );		mes "Random member : " +.random_member$;	}	close;}

A template

Share this post


Link to post
Share on other sites
  • 0

 

prontera,150,150,0	script	Sample	100,{	if ( getcharid( 1 ) ) {		getpartymember getcharid( 1 ), 1;		getpartymember getcharid( 1 ), 2;		do {			.index = rand( $@partymembercount );			.random_member$ = rid2name( $@partymemberaid[ .index ] );		} while ( !isloggedin( $@partymemberaid[ .index ], $@partymembercid[ .index ] ) );		mes "Random member : " +.random_member$;	}	close;}

A template

thx very much :3

Share this post


Link to post
Share on other sites
  • 0

I wonder why I miss this topic

 

anyways, I rather build up a temp array to hold the online party members rather to keep randomizing ...

prontera,155,185,0	script	Sample	100,{	if ( !getcharid(1) ) end;	getpartymember getcharid(1), 1;	getpartymember getcharid(1), 2;	for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {		if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {			.@aid[.@c] = $@partymemberaid[.@i];			.@c++;		}	}	mes "Random member :"+ rid2name( .@aid[ rand( .@c ) ] );	close;}

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...
Sign in to follow this  

×
×
  • Create New...

Important Information

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