Hi.
//members id
getpartymember(getcharid(CHAR_ID_PARTY), 1);
You have to use type 2 instead of 1 to get the account ID of all party members instead of their char IDs.
(The getunits() command will collect the GID of found units, which is the account ID for player type units. (BL_PC))
Additionally you should immediately save the IDs and the member count to prevent other scripts from interfering with your data.
// Get party data.
getpartymember(getcharid(CHAR_ID_PARTY), 2);
.@p_mem_cnt = $@partymembercount;
copyarray(.@p_mem_aid[0], $@partymemberaid[0], .@p_mem_cnt);
.@range= 10;
This should be 5 for a 10x10 area. When setting this to 10, your area is 20x20.
.@count = getunits((BL_MOB | BL_PC), .@units, -1, .@m$, max(0, .@x - .@range), max(0, .@y - .@range), .@x + .@range, .@y + .@range);
Any reason to get monster type units (BL_MOB), too? 😯 If you only want to heal party members you should only collect player type units (BL_PC).
Also better use false for <limit>. -1 works, too, but is less readable.
.@count = getunits(BL_PC, .@units, false, .@m$, max(0, .@x - .@range), max(0, .@y - .@range), .@x + .@range, .@y + .@range);
And finally you have to add a nested loop to your loop to compare the account IDs. (Loop through found units and for each iteration loop through party members.)
for (.@i = 0; .@i < .@count; .@i++) {
dispbottom(".@units[" + .@i + "]: " + .@units[.@i]); //debug - print the user id (getunits)
for (.@j = 0; .@j < .@p_mem_cnt; .@j++) {
dispbottom(".@p_mem_aid[" + .@j + "]: " + .@p_mem_aid[.@j]); //debug - print the user id (getpartymember)
if (.@units[.@i] == .@p_mem_aid[.@j]) {
dispbottom("Party member found. Try healing!"); //debug - party member found
if (attachrid(.@p_mem_aid[.@j])) {
percentheal(.@porcent, .@porcent);
specialeffect(310, AREA, playerattached());
}
}
}
}
That's just a quick draft. Syntax errors are for free. 😋
~Kenpachi