Set Variable HELP!

dfabsgwapings

New member
Messages
165
Points
0
Github
dfabsgwapings
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 < $@partymembercount; .@i++ ) {
if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {
attachrid $@partymembercid[.@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 

 
try moving sleep and warpparty out from loop.

should be right after your last curlys you posted above.

 
@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 < $@partymembercount; .@i++ ) {
if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {
attachrid $@partymemberaid[.@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.

 
Last edited by a moderator:
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 < $@partymembercount; .@a++) {
if (isloggedin($@partymemberaid[.@a], $@partymembercid[.@a])) {
attachrid $@partymemberaid[.@a];
testing123++;
dispbottom "Current Count: "+testing123; // DEBUG PURPOSE
}
}
detachrid;
end;
}


Feel free to use that as reference.

 
Last edited by a moderator:
Thankfully I added a new buildin for that: getvariableofpc()

Try this: 

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


With your code it would give:

Code:
getpartymember(getcharid(CHAR_ID_PARTY), 2);

for (.@i = 0; .@i < $@partymembercount; ++.@i) {
	.@acc = $@partymemberaid[.@i];

	if (isloggedin(.@acc) && strcharinfo(PC_MAP, .@acc) == "poring_w03") {
		set(getvariableofpc(Flower, .@acc), 1);
	}
}
 
Last edited by a moderator:
Back
Top