Jump to content
  • 0

R> All party members on the map get exp and item


Question

Posted (edited)

Hello, I need a guidance on how to create a proper script when one party member kills a specific mob, every party member which inside the instance map will get exp and item. I have created  one based on the some examples that I have found in this forum but I am still confused.

Here:

OnMyBossDead:  // boss
    getpartymember getcharid(1),2;
    for( .@i = 0; .@i < $@partymembercount; .@i++ )
    getitem 607,1,$@partymemberaid[.@i];

    // next events
    .@map$   = instance_mapname("dew_dun02");
    .@label$ = instance_npcname(strnpcinfo(0))+"::OnMyMobDead";
    killmonster .@map$,.@label$;
    mapannounce .@map$,"Shady Guy: Good work warriror! Please speak to me as soon as possible.",bc_all;
    donpcevent instance_npcname("Shady Guy#finish")+"::OnEnable";
    end;
}

thanks..

Edited by Rizz

7 answers to this question

Recommended Posts

  • 0
Posted

What are u confused about it looks pretty straight forward

 

// Untested

-	script	PartyExp	-1,{

	OnPartyExpKilled:
		// Clear the Server Party Variables
		set($ @ partymembercount, 0);
		deletearray($ @ partymemberaid, getarraysize( $ @partymemberaid));
		
		// Get the Corresponding Party Information
		getpartymember(getcharid(1));

		// Loop Through Party Members
		for(.@i = 0; .@i < $ @ partymembercount; .@i++) {

			// Attach the player id
			attachrid($ @ partymemberaid[.@i]);

			set(BaseExp, BaseExp + 1000); // Give Base Exp
			set(JobExp, JobExp + 1000); // Give Job Exp

			getitem(501,1); // Give Item

			// Unattach Player from the Script
			detachrid;
			
		}

		announce("Wootzers! You Done It!", bc_map, C_YELLOW);
		end;	
		
}

 

  • Upvote 1
  • 0
Posted (edited)
On 03/08/2017 at 8:59 AM, Rizz said:

kills a specific mob

check for the mob id.

	if (killedrid == 1002) {
		// scripts...
	}

but since this is an instance script, you could have just attach a unique event to this monster to trigger the event to assigns the rewards to players.

 

On 03/08/2017 at 8:59 AM, Rizz said:

every party member which inside the instance map will get exp and item

...
	.@current_map$ = instance_mapname("dew_dun02");
	getpartymember getcharid(1),2;
	for( .@i = 0; .@i < $@partymembercount; .@i++ ) {
		if (attachrid($@partymemberaid[.@i])) {
			if (strcharinfo(3) == .@current_map$) {
				getitem 607,1;
				getexp 1000,1000;
			}
			detachrid;
		}
	}

you need to loop each of the party member and check for their location.

 

* this damn IPS4 editor just love to erase all the contents when i paste new things into the codebox. 

Edited by Emistry
Fix getpartymember
  • Upvote 1
  • 0
Posted
1 hour ago, Z3R0 said:

What are u confused about it looks pretty straight forward

 


// Untested

-	script	PartyExp	-1,{

	OnPartyExpKilled:
		// Clear the Server Party Variables
		set($ @ partymembercount, 0);
		deletearray($ @ partymemberaid, getarraysize( $ @partymemberaid));
		
		// Get the Corresponding Party Information
		getpartymember(getcharid(1));

		// Loop Through Party Members
		for(.@i = 0; .@i < $ @ partymembercount; .@i++) {

			// Attach the player id
			attachrid($ @ partymemberaid[.@i]);

			set(BaseExp, BaseExp + 1000); // Give Base Exp
			set(JobExp, JobExp + 1000); // Give Job Exp

			getitem(501,1); // Give Item

			// Unattach Player from the Script
			detachrid;
			
		}

		announce("Wootzers! You Done It!", bc_map, C_YELLOW);
		end;	
		
}

 

Thanks for your help. And I am sorry cuz I forgot to mention about the script that I had posted. The problem is when player kill the mob, the party member located outside the instance still get the item and exp. It makes me confused. I apologize cuz I am still inexperience in making a script. 

 

20 minutes ago, Emistry said:

check for the mob id.


	if (killedrid == 1002) {
		// scripts...
	}

but since this is an instance script, you could have just attach a unique event to this monster to trigger the event to assigns the rewards to players.

 


...
	.@current_map$ = instance_mapname("dew_dun02");
	getpartymember getcharid(1);
	for( .@i = 0; .@i < $@partymembercount; .@i++ ) {
		if (attachrid($@partymemberaid[.@i])) {
			if (strcharinfo(3) == .@current_map$) {
				getitem 607,1;
				getexp 1000,1000;
			}
			detachrid;
		}
	}

you need to loop each of the party member and check for their location.

 

* this damn IPS4 editor just love to erase all the contents when i paste new things into the codebox. 

 Thank you very much sir. I do appreciate your suggestion, I'll try it :)

  • 0
Posted
dew_dun02,0,0,0	script	Reward	-1,{

OnInstanceInit:
	disablenpc strnpcinfo(0);
	end;
OnEnable:
	.@current_map$ = instance_mapname("dew_dun02");
	getpartymember getcharid(1);
	for( .@i = 0; .@i < $@partymembercount; .@i++ ) {
		if (attachrid($@partymemberaid[.@i])) {
			if (strcharinfo(3) == .@current_map$) {
				getitem 607,1;
				set(BaseExp, BaseExp + 1000); // Give Base Exp
				set(JobExp, JobExp + 1000); // Give Job Exp
			}
			detachrid;
		}
	}
	end;
}

I tried to apply both of your suggestions, but I found a trouble. It said that the emulator fails to attachrid moreover it gives the party member no item and exp. I hope someone can explain about this 

  • 0
Posted

That's because emistry goofed! haha... you need to getpartymember(getcharid(1), 2); so that it gets account id :D

  • 0
Posted
9 hours ago, Z3R0 said:

getpartymember(getcharid(1), 2);

thanks for your concern :), but I still dont get it, where to put this script commands, moreover it's still failed. I am sorry , I really need a guidance ..

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...