Jump to content
  • 0
dfabsgwapings

Help in detecting party member

Question

hi everyone,

can anyone help me fixing this part of my script?

getpartymember(getcharid(1),0);
	getpartymember(getcharid(1),1);
	getpartymember(getcharid(1),2);
	for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
		set .@nb,query_sql("SELECT * FROM char_reg_num_db WHERE char_id = "+$@partymembercid[.@i]+"", .@charid,.@key$,.@index,.@value ); 
			if (( .@charid != $@partymembercid[.@i] ) && ( .@key$ != "BloodQuest" ) && ( .@value != 6 )){
				mes "I'm sorry but one or some of your party member is not allowed to participate in Blood Quest.";
				close;
			}
	}
	mes "Which battlefield will you attempt?";
		if ( BloodQuest == 6 ) { switch(select("It's Bloody Rain")){
			case 1:
				.@prty = getcharid(1);
				set .PQStatus,1;
				donpcevent "BloodyRain::OnStart";
				warpparty "hell", 112, 136, .@prty, "prontera";
				end;
			}
		}

what i am trying to do here is when the party leader click the npc and tried to start the quest the whole party will be warp to the quest map if the party meets the requirement of the NPC. 

 

The only requirement is if the members was able to talk to a pre-requisite npc and get the variable of ( BloodQuest == 6 ) the whole party will be able to begin the quest, however if some of the member did not meet the requirement the party will not be able to start the quest until the member will be able to talk to a pre-requisite npc or remove from the party.

 

I hope someone can help me..

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

What I usually do in cases like yours is to use attachrid() on every index of the info arrays, then do something for each player

In your case, I think that you will need to run this loop twice:
on the first time, you will
 

for(blablabla){
attachrid();
if(BloodQuest != 6){
announce strcharinfo(0)+" needs to talk to the NPC first";
end;
}
}

then in the second loop

for(blablabla){
attachrid();
warp "map", x, y;
}

That way you wont need to use SQL. Search in the forum/downloads for the addrid() script command (plugin?), it may help a bit.

Share this post


Link to post
Share on other sites
  • 0
	.@origin = getcharid(3); // save account id of player who talk to npc
	getpartymember(getcharid(1),0);
	getpartymember(getcharid(1),1);
	getpartymember(getcharid(1),2);
	for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
		if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { // check if they are online and..
			attachrid ($@partymemberaid[.@i]); // attach them to the script
			if (BloodQuest != 6) { // check your condition
				mes "I'm sorry but one or some of your party member is not allowed to participate in Blood Quest.";
				close;
			}
		}
	}
	attachrid(.@origin); // after all is done attach the npc back to player

may this help you

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

×
×
  • Create New...

Important Information

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