Jump to content
  • 0

Party Drop Random Item


cahadeyelo

Question


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   1
  • Joined:  11/13/14
  • Last Seen:  

A productive day rA community. I'm hoping that even on your busy day like now still you'll be able to help me on my script request.

IT SHOUD BE LIKE THIS:

- ONLY A PLAYER WITH PARTY MEMBERS OF 4 OR MORE HAVE TO GET THE RANDOM BONUS LOOTS. AND ELSE IF SOMEONE AT THAT PARTY BECAME OFFLINE, THE BONUS LOOTS WILL STOPS.

-	script	PARTY_DROP	FAKE_NPC,{
OnNPCKillEvent:
.@pid = getcharid(1);
	getpartymember .@pid,0;
	getpartymember .@pid,1;
	getpartymember .@pid,2;
	
	for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
		if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {
			.@rnd = rand(1,100);
			for( .@i = 0; .@i < getarraysize(.item_arrays); .@i += 3 ) {
				if( .@rnd <= .item_arrays[.@i+2] ) {
				getitem .item_arrays[.@i], .item_arrays[.@i+1];
			}
		}
	} else {
	message strcharinfo(0), "Some PARTY MEMBERS are offline.";
	end;
	}
}
OnInit:
	setarray .item_arrays[0],505,1,10,502,1,20,501,1,30;
	end;
}

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  233
  • Reputation:   87
  • Joined:  06/30/18
  • Last Seen:  

-	script	PARTY_DROP	FAKE_NPC,{
    OnInit:
        setarray(.items[0], 505, 1, 10, 502, 1, 20, 501, 1, 30);
        .min_online_partysize = 4;
        end;

    OnNPCKillEvent:
        .@pid = getcharid(1);
        if(.@pid == 0) end;

        getpartymember(.@pid, 1);
        getpartymember(.@pid, 2);

        for ( .@i = 0; .@i < $@partymembercount; .@i++ )
            if (isloggedin($@partymemberaid[.@i], $@partymembercid[.@i]))
                .@online_partymembers++;

        if($@partymembercount < .min_online_partysize || .@online_partymembers < .min_online_partysize) {
            dispbottom("Partybonus deactivated. To get the bonus there need to be atleast " + .min_online_partysize + " partymembers online.");
            end;
        }

        addrid(2, 0, .@pid);

        for(.@x = 0; .@x < getarraysize(.items_array); .@x += 3)
            if(rand(1,100) <= .items[.@x + 2]) getitem(.items[.@x], .items[.@x + 1]);
}

 

Edited by Winterfox
  • Upvote 2
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   1
  • Joined:  11/13/14
  • Last Seen:  

As always the rA community doesn't neglect to extend their assistance for those in needs.

AND HERE'S MY FINAL VERSION THAT I COPIED FROM YOUR CODES SIR Winterfox.

 

-	script	PARTY_DROP	-1,{
	end;
OnInit:
	.min_online_partysize = 4;
	setarray .item_arrays[0],505,1,10,502,1,20,501,1,30;
	end;
OnNPCKillEvent:
.@pid = getcharid(1);
if(.@pid == 0) end;

	getpartymember .@pid,1;
	getpartymember .@pid,2;
	
	for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
		if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {
			.@online_partymembers++;
					if($@partymembercount < .min_online_partysize && .@online_partymembers < .min_online_partysize) {
					end;
				}
				else {
			.@rnd = rand(1,100);
			for( .@i = 0; .@i < getarraysize(.item_arrays); .@i += 3 ) {
				if( .@rnd <= .item_arrays[.@i+2] ) {
				getitem .item_arrays[.@i], .item_arrays[.@i+1];
					}
				}
			}
		}
	}
}

 

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...