Jump to content
  • 0

How to make mob only gives item for party in the same screen? [SOLVED]


Rizz

Question


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  72
  • Reputation:   0
  • Joined:  07/29/17
  • Last Seen:  

Hello, is there any script or configuration making every the party member within the screen range has similar chance to get an item from a monster eventhough they arent the killer. I mean if poring has a chance to drop 10% knife, and being killed by the DPS, the Healer/Supports have 10% chance to get the same item..

Link to comment
Share on other sites

17 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

OnNPCKillEvent:
	if ( killedrid == 1002 ) {
		getmapxy (.@map$, .@x, .@y, BL_PC);
		getpartymember getcharid(1), 1;
		getpartymember getcharid(1), 2;
		for ( .@i = 0; .@i < $@partymembercount; ++.@i ) 
		if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {
			attachrid ( $@partymemberaid[.@i]);
			getmapxy ( @map$, @x, @y, BL_PC );
			if ( distance(.@x, .@y, @x, @y) < 15 && @map$ == .@map$ ) { // reduced the distance to 15 cells
				.@partymemberaid[.@c] = $@partymemberaid[.@i];
				.@c++;
			}
		}
		sleep 1;
		getitem 607, 1, .@partymemberaid[rand(.@c)]; 
	}
	end;

@Rizz still untested

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  737
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

30 minutes ago, Rizz said:

Hello, is there any script or configuration making every the party member within the screen range has similar chance to get an item from a monster eventhough they arent the killer. I mean if poring has a chance to drop 10% knife, and being killed by the DPS, the Healer/Supports have 10% chance to get the same item..

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  72
  • Reputation:   0
  • Joined:  07/29/17
  • Last Seen:  

Thanks for the response, but it is possible if the party loot applies in regular monster which is spawned normally in field or dun?. I mean it is not only for an instance or the event one.

Edited by Rizz
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  737
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

17 minutes ago, Rizz said:

Thanks for the response, but it is possible if the party loot applies in regular monster which is spawned normally in field or dun?. I mean it is not only for an instance or the event one.

yes check this link

https://rathena.org/board/topic/75875-mvp-kill-reward-npc/

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  72
  • Reputation:   0
  • Joined:  07/29/17
  • Last Seen:  

Woa, thanks alot, I just need to modify it a little ?

for specific mob i just changed the the MOB_MVPEXP into specific mob id ?

-	script	PartyLoot	-1,{
OnNPCKillEvent:
if ( getmonsterinfo( killedrid, 1014 ) && rand(100) < 40 ) {
	if ( getcharid(1) ) {
		getpartymember getcharid(1), 1;
		getpartymember getcharid(1), 2;
		for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
			if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { // what happens if someone in the party member is offline =/
				.@partymemberaid[.@c] = $@partymemberaid[.@i];
				.@c++;
			}

Hello, someone gave me a link about a script which can give a party member similar chance to get specific item from a mob even they are not the killer.
However, I would like to make it only work on certain mob for example, Spore. But when I killed other mob, the script also being activated.

-	script	PartyLoot	-1,{
OnNPCKillEvent:
if ( getmonsterinfo( killedrid, 1014 ) && rand(100) < 40 ) {
	if ( getcharid(1) ) {
		getpartymember getcharid(1), 1;
		getpartymember getcharid(1), 2;
		for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
			if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { // what happens if someone in the party member is offline =/
				.@partymemberaid[.@c] = $@partymemberaid[.@i];
				.@c++;
			}

I would appreciate if anyone telling me how to make this script only worked on specific mob..

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  23
  • Reputation:   2
  • Joined:  08/15/19
  • Last Seen:  

Hi,

Did you mean this?

...\conf\battle\party.conf

Quote

// Method of distribution when item party share is enabled in a party:
// 
// 0: Normal (item goes to a random party member)
// 1: Item Share is disabled for non-mob drops (player/pet drops)
// 2: Round Robin (items are distributed evenly and in order among members)
// 3: 1+2
party_item_share_type: 2

EDIT:
Sorry I misread your question, wait a moment.

EDIT:
Maybe by the usage of array?

Quote

    setarray .@moblist,    1014, 1015; // LIST OF MOB ID
    set .@mobsize,getarraysize(.@moblist);
    set .@val,0;

    while (.@val <= .@mobsize) {
        set .@val,.@val+1;
        set .@moblist[.@val];

And change:

if ( getmonsterinfo( killedrid, 1014 )

to 

if( killedrid == .@moblist[.@val] )

It's not tested and I am not sure yet as my brain is a bit frozen by now (it's almost midnight here), and that script you've given is incomplete.

My apologise if there is any mistake.

 

Edited by Diospectre
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  72
  • Reputation:   0
  • Joined:  07/29/17
  • Last Seen:  

11 hours ago, Diospectre said:

    setarray .@moblist,    1014, 1015; // LIST OF MOB ID
    set .@mobsize,getarraysize(.@moblist);
    set .@val,0;

    while (.@val <= .@mobsize) {
        set .@val,.@val+1;
        set .@moblist[.@val];

Where should I put this sir?

Sry, what I meant is, I tried to make a party member got similar chance to get an item from a monster even though they dont kill it.
Ex: DPS kill poring and has 10% to get a knife, the supports also have 10% chance as well (pure communism :D)

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  23
  • Reputation:   2
  • Joined:  08/15/19
  • Last Seen:  

What I wrote intended to make that script triggers when you kill monsters which IDs written in the array.

setarray .@moblist,    1014, 1015, <MOB ID>, <MOB ID>, <MOB ID and so on>;

You put the whole these:

    setarray .@moblist,    1014, 1015; // LIST OF MOB ID
    set .@mobsize,getarraysize(.@moblist);
    set .@val,0;

    while (.@val <= .@mobsize) {
        set .@val,.@val+1;
        set .@moblist[.@val];

below: 

-	script	PartyLoot	-1,{
OnNPCKillEvent:

But it's not tested yet, and I don't know how to test it since you gave an incomplete script.

Edited by Diospectre
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  72
  • Reputation:   0
  • Joined:  07/29/17
  • Last Seen:  

Ah my bad, this is the complete script

-	script	PartyLoot	-1,{
OnNPCKillEvent:
if ( getmonsterinfo( killedrid, 1014 ) && rand(100) < 40 ) {
	if ( getcharid(1) ) {
		getpartymember getcharid(1), 1;
		getpartymember getcharid(1), 2;
		for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
			if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { // what happens if someone in the party member is offline =/
				.@partymemberaid[.@c] = $@partymemberaid[.@i];
				.@c++;
			}
		}
		getitem 607, 3, .@partymemberaid[ rand( .@c ) ];
		getitem 616, 3, .@partymemberaid[ rand( .@c ) ];
	}
	else {
		getitem 607, 3;
		getitem 607, 3;
	}
}
end;
}

ill test the config you've provided.., I will tell you later if it works

EDIT: It would not work for me man 

EDIT: I managed to make it work. But You may inspect it first, I am afraid if I made a mistake which can be exploited.

EDIT: It seems the other party members still get the item even they are in different map. I killed the spore in pay fild08, other member in prontera also get the drop. Any suggestion for fixing this issue?
 

-	script	PartyLoot	-1,{
OnNPCKillEvent:
if( killedrid == 1014 ){
	if ( getcharid(1) ) {
		getpartymember getcharid(1), 1;
		getpartymember getcharid(1), 2;
		for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
			if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { // what happens if someone in the party member is offline =/
				.@partymemberaid[.@c] = $@partymemberaid[.@i];
				.@c++;
			}
		}
		if(rand(100)<10)	getitem 607, 3, .@partymemberaid[ rand( .@c ) ]; //it gives pt member 3 Ygg berry and 3 OCA for 10%
		if(rand(100)<10)	getitem 616, 3, .@partymemberaid[ rand( .@c ) ];
	}
	else {
		if(rand(100)<10)	getitem 607, 3;
		if(rand(100)<10)	getitem 607, 3;
	}
}
end;
}

Previously I tried to edit a script from contributor regarding MVP share loot script. I want to make this script only gives an item to party member in the same area. However, I failed and when member A killed Z monster, member outside the screen still got the item prize. Please give me an insight..

-	script	partyshare	-1,{
OnNPCKillEvent:
if( killedrid == 1014 ){
    if ( getcharid(1) ) {
        getpartymember getcharid(1), 1;
        getpartymember getcharid(1), 2;
        getmapxy(.@mapname$,.@mapx,.@mapy,BL_PC);
            for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
                if ( !isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ||  // what happens if someone in the party member is offline =/
                    strcharinfo(3,$@partymembercid[.@i]) != .@mapname$ ) // If the party member is not on the same map of the killer
                    continue;
        if(rand(100)<10)	getitem 607, 1, $@partymemberaid[.@i];
        }
        announce "Wow! A party named [ "+ strcharinfo(1) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3) +"! Awesome work guys!",bc_all,0x6666CC;
    }
    else {
        if(rand(100)<10)	getitem 607,1;
        announce "Amazing! A lone wolf named [ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" himself at "+ strcharinfo(3) +"! Reckless, but still, good work!",bc_all,0x6666CC;
    }
}
end;
}

EDIT: Dead member still get the item, please tell me how to limit the drop so Only the surviving party members can get the item.

EDIT: Already answered in the other thread.

Edited by Rizz
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  23
  • Reputation:   2
  • Joined:  08/15/19
  • Last Seen:  

15 hours ago, Rizz said:

EDIT: It seems the other party members still get the item even they are in different map. I killed the spore in pay fild08, other member in prontera also get the drop. Any suggestion for fixing this issue?

All I can do so far:

-	script	PartyLoot	-1,{

OnNPCKillEvent:
L_RESCAN:
set .@map$,strcharinfo(3);
if( killedrid == 1002 )||( killedrid == 1063 ){ // PORING & LUNATIC for the sake of easier testing.
	if ( getcharid(1) ) {
		getpartymember getcharid(1), 1;
		getpartymember getcharid(1), 2;
		for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
			if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { // what happens if someone in the party member is offline =/
				.@partymemberaid[.@c] = $@partymemberaid[.@i];
				.@c++;
			}
		}	
		set .@randc, rand(.@c);
		if(attachrid($@partymemberaid[.@randc])) {
			if(strcharinfo(3) == .@map$){
				if(rand(100)<25)	getitem 25276, 1, .@partymemberaid[.@randc]; //CLEAN BONE, something that Porings wont ever have.
				if(rand(100)<25)	getitem 7564, 1, .@partymemberaid[.@randc]; // ROTTEN MEAT, something that Porings wont ever have.
				detachrid;
			}
		}
		else if (attachrid($@partymemberaid[.@randc])) {
			if(strcharinfo(3) != .@map$){
				detachrid;
				goto L_RESCAN;
			}
		}
	}
	else {
		if(rand(100)<10)	getitem 607, 3;
		if(rand(100)<10)	getitem 607, 3;
	}
}
end;
}

Details of the script above:

- It doesn't work when you're in a party, but you're alone. x That's why the script is called "PartyLoot" ?

- It triggers when you kill Poring or Lunatic.

- It shares items by the percentage (25%),  2 items to one lucky chosen member by random.

- If the member is not at the same map as the killer, he will get skipped.

And, at the moment, if you want more monsters to trigger, just add more ||( killedrid == <MONSTER ID> ) 

example:

set .@map$,strcharinfo(3);
if( killedrid == 1002 )||( killedrid == 1063 )||( killedrid == 1064 )||( killedrid == 1065 ) {
	if ( getcharid(1) ) {
		getpartymember getcharid(1), 1;

The "||" means "or", so that script means "If somebody kill 1002 or 1063 or 1064 or 1065, then do ...."

Just don't miss the any curly opening bracket at the end of it "{"

Of course if you get any error, just reply again this post.

If it works, just edit the monster IDs and the item IDs.

Edited by Diospectre
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

OnNPCKillEvent:
	if ( killedrid == 1002 ) {
		getmapxy (.@map$, .@x, .@y, BL_PC);
		getpartymember getcharid(1), 1;
		getpartymember getcharid(1), 2;
		for ( .@i = 0; .@i < $@partymembercount; ++.@i ) 
		if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {
			attachrid ( $@partymemberaid[.@i]);
			getmapxy ( @map$, @x, @y, BL_PC );
			if ( distance(.@x, .@y, @x, @y) > 20 && @map$ != .@map$ ) continue;
			else  {
				.@partymemberaid[.@c] = $@partymemberaid[.@i];
				.@c++;
			}
		}
		sleep 1;
		getitem 607, 1, .@partymemberaid[rand(.@c)]; 
	}
	end;

Untested

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  23
  • Reputation:   2
  • Joined:  08/15/19
  • Last Seen:  

22 minutes ago, Mabuhay said:

OnNPCKillEvent:
	if ( killedrid == 1002 ) {
		getmapxy (.@map$, .@x, .@y, BL_PC);
		getpartymember getcharid(1), 1;
		getpartymember getcharid(1), 2;
		for ( .@i = 0; .@i < $@partymembercount; ++.@i ) 
		if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {
			attachrid ( $@partymemberaid[.@i]);
			getmapxy ( @map$, @x, @y, BL_PC );
			if ( distance(.@x, .@y, @x, @y) > 20 && @map$ != .@map$ ) continue;
			else  {
				.@partymemberaid[.@c] = $@partymemberaid[.@i];
				.@c++;
			}
		}
		sleep 1;
		getitem 607, 1, .@partymemberaid[rand(.@c)]; 
	}
	end;

Untested

That might work and simpler, ? but no possibility percentage for the item and it triggers even when you're alone (exploitable?). ?

Can just change the if ( killedrid == 1002 ) { like my previous post above to make it triggers by more than one monster. ?

EDIT:

For the possibility, maybe we can change 

getitem 607, 1, .@partymemberaid[rand(.@c)];

TO:

if(rand(100)<25) getitem 607, 1, .@partymemberaid[rand(.@c)]; // 25% of possibility

Edited by Diospectre
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

If you want to use multiple mobs, just put them in array and run a loop. 

As for probability, do as you wish. 

I am only on mobile and i dont have any test server. So it is quite impossible for me to test if the code i wrote would work as per only party members around or within the screen will be rewarded. 

Afaik, there is no way in default rathena to retrieve if the player is currently dead. So it still might trigger if the party member who's dead would get the items long as he is within the mvp killer range (20 cells) 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  72
  • Reputation:   0
  • Joined:  07/29/17
  • Last Seen:  

On 10/21/2019 at 10:37 PM, Diospectre said:

- If the member is not at the same map as the killer, he will get skipped.

Thanks your script worked well when I tested it but one feature isn't worked properly. The other member still get the item even they are died or in different screen.
I got this notification in the emulator:
[Error]: buildin_getitem: Nonexistant item 25276 requested.
[Debug]: Source (NPC): PartyLoot (invisible/not on a map)

On 10/21/2019 at 10:59 PM, Mabuhay said:

Untested

I have tested, yours also worked well but Ifound that the other party member in different screen/died member stilll get the item. ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  23
  • Reputation:   2
  • Joined:  08/15/19
  • Last Seen:  

2 hours ago, Rizz said:

Thanks your script worked well when I tested it but one feature isn't worked properly. The other member still get the item even they are died or in different screen.
I got this notification in the emulator:
[Error]: buildin_getitem: Nonexistant item 25276 requested.
[Debug]: Source (NPC): PartyLoot (invisible/not on a map)

You didn't say that you needed it when the members are close together (not in different screen). ?

Mabuhay's script might work for you because he uses getmapxy and distance. ?

About the console error, it means there is no Clean Bone (Item ID 25276) in your server, something you must check except if it's intentional.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  72
  • Reputation:   0
  • Joined:  07/29/17
  • Last Seen:  

Thanks @Mabuhay , the configuration within 15x15 cell is worked.. and thank you @Diospectre for always helping me

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  79
  • Reputation:   2
  • Joined:  04/27/16
  • Last Seen:  

@Mabuhay

 

how about this scenario 
- when a player created a party without member, if an MVP has been killed getitem will not triggered

- when there is only two member in the party and one member is away from the party getitem will not get triggered

- when there is only two member in the party and one member is offline getitem will not get triggered

 

getitem will only get triggered if :

-party has >=2 within 15 cell 

 

OnNPCKillEvent:
if ( getmonsterinfo( killedrid, MOB_MVPEXP ) ) {
		getmapxy (.@map$, .@x, .@y, BL_PC);
		getpartymember getcharid(1), 1;
		getpartymember getcharid(1), 2;
		for ( .@i = 0; .@i < $@partymembercount; ++.@i ) 
		if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {
			attachrid ( $@partymemberaid[.@i]);
			getmapxy ( @map$, @x, @y, BL_PC );
			if ( distance(.@x, .@y, @x, @y) > 20 && @map$ != .@map$ ) continue;
			else  {
				.@partymemberaid[.@c] = $@partymemberaid[.@i];
				.@c++;
				
			}
		}
		sleep 1;
		getitem 501, rand(1,5), .@partymemberaid[ rand( .@c ) ];
	}
	end;

 

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