• 0
Sign in to follow this  
Followers 0
dfabsgwapings

Set Variable HELP!

Question

Can anyone fix this for me please.. 

What I am doing is when the whole party killed a boss quest all of the member will have 

set Flower,1;

and my current script that I have is 

.@party_id = getcharid(1);
	getpartymember .@party_id, 1;
		for ( .@i = 0; .@i < [email protected]; .@i++ ) {
			if ( isloggedin( [email protected][.@i], [email protected][.@i] ) ) {
				attachrid [email protected][.@i];
				if ( strcharinfo(3) == "poring_w03" )
					set Flower,7;
					sleep 5000;
					warpparty "prontera", 152, 150, .@party_id, "poring_w03";
			}
		}
end;

and what my script doing is only the one who killed the boss is the one was able to get the 

set Flower,1;

What I need is all of the party members should have 

set Flower,1;

 

Please help me guys.. Thanks in advance 

Share this post


Link to post
Share on other sites

4 answers to this question

  • 0

try moving sleep and warpparty out from loop.

should be right after your last curlys you posted above.

Share this post


Link to post
Share on other sites
  • 0

Posted (edited)

@Legend

I tried to do it however it only give the Variable on 1 player and once they do the quest again it gives the others the variable automatically while they are not yet done doing the quest.
 
This is the part of my script wherein the Boss is summoned and how the script work once the Boss is killed. Hope this one can help you solve the problem.
 
OnFinalRound:
	monster "poring_w02",97,96,"--ja--",3003,1,"BloodyRain::OnMyFinalBossDead";
	end;

OnMyFinalBossDead:
	mapannounce "poring_w02","Satan: Nooooooooooo.", bc_map,0xFF0000;
	.@party_id = getcharid(1);
		getpartymember .@party_id, 1;
		for ( .@i = 0; .@i < [email protected]; .@i++ ) {
			if ( isloggedin( [email protected][.@i], [email protected][.@i] ) ) {
				attachrid [email protected][.@i];
				if ( strcharinfo(3) == "poring_w02" )
					set BloodyQuest,7;
					set .MobPetDead,0;
					set .PR_Round,0;
					set getvariableofnpc(.PQStatus,"Tree of Blood"),getvariableofnpc(.PQStatus,"Tree of Blood") - 1;
			}
		}
	detachrid;
	sleep 5000;
	warpparty "prontera", 152, 150, .@party_id, "poring_w02";
	end;

What I am doing is when the whole party killed a boss quest, all of the member will set the BloodyQuest to 7.

 

 

Edited by dfabsgwapings

Share this post


Link to post
Share on other sites
  • 0

Posted (edited)

you might as well add

getpartymember .@party_id, 2;

for the thorough explanation about getpartymember: https://github.com/HerculesWS/Hercules/blob/master/doc/script_commands.txt#L2599


Here you go,

// =============================================
prontera,170,171,4	script	Support#2	4_F_SURA,{
	getpartymember getcharid(1), 1;
	getpartymember getcharid(1), 2;
		for (.@a = 0; .@a < [email protected]; .@a++) {
			if (isloggedin([email protected][.@a], [email protected][.@a])) {
				attachrid [email protected][.@a];
				testing123++;
				dispbottom "Current Count: "+testing123; // DEBUG PURPOSE
			}
		}
	detachrid;
	end;
}

 

Feel free to use that as reference.

Edited by Legend

Share this post


Link to post
Share on other sites
  • 0

Posted (edited)

Thankfully I added a new buildin for that: getvariableofpc()

 

Try this: 

set(getvariableofpc(<variable>, <account id>), <value>);

 

With your code it would give:

getpartymember(getcharid(CHAR_ID_PARTY), 2);

for (.@i = 0; .@i < [email protected]; ++.@i) {
	.@acc = [email protected][.@i];

	if (isloggedin(.@acc) && strcharinfo(PC_MAP, .@acc) == "poring_w03") {
		set(getvariableofpc(Flower, .@acc), 1);
	}
}
Edited by meko

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0