Party Member Base Levels

jupeto

New member
Messages
39
Points
0
Github
jupeto
Is there a way to determine base and job levels in a party? given the party id or the invoking character?

using getpartymember(getcharid(CHAR_ID_PARTY));

 
Not sure if there's a better way, but one way you could do it is using attachrid.

I didn't test, kinda working on logic. The way it works is:

1. Fetch party ID.

2. Check if party member is online. If yes, continue. If no, loop again to next array and check.

3. attachrid of the online AID, collect their BaseLevel and put it in an array (.@blvl[]).

4. detachrid; display name + base level

Code:
-    script    Party Member Base Level    FAKE_NPC,{

    getpartymember(getcharid(CHAR_ID_PARTY));

    for (.@i = 0; .@i < $@partymembercount; ++.@i)
    {
        if (isloggedin($@partymemberaid[.@i]))
        {
            attachrid($@partymemberaid[.@i]);
            .@blvl[.@i] = BaseLevel;
            detachrid;
            dispbottom("" + $@partymembername$[.@i] + ": Level " + .@blvl[.@i] + "");
        }
    }

    end;

}
 
[Error]: script_rid2sd: fatal error ! player not attached!

[Debug]: Function: dispbottom (1 parameter):

[Debug]: Data: string value="Jupeto: Level 99"

[Debug]: Source (NPC): Teaching Manager at prontera (144,282)

 
[Error]: script_rid2sd: fatal error ! player not attached!
[Debug]: Function: __setr (2 parameters):
[Debug]: Data: variable name='.@blvl' index=0
[Debug]: Data: param name='BaseLevel' type=11
[Debug]: Source (NPC): SamplePartyBaseLevel at prontera (144,282)
[Warning]: script_get_val: cannot access player variable 'BaseLevel', defaulting to 0


I only use this code

getpartymember(getcharid(CHAR_ID_PARTY));

for (.@i = 0; .@i < $@partymembercount; ++.@i)
{
dispbottom($@partymemberaid[.@i] + " : " + $@partymembercid[.@i] + " (" + $@partymembername$[.@i]) + ")";
}
close;

the result of each account id and character id is 0, maybe that's why your code doesn't work... but the member name is OK

EDIT 2:

I wonder why the code below works, I need to specify all 3 types to get the account id, character id, and character names

Code:
        getpartymember(getcharid(CHAR_ID_PARTY), 0);
        getpartymember(getcharid(CHAR_ID_PARTY), 1);
        getpartymember(getcharid(CHAR_ID_PARTY), 2);
        .@aid = getcharid(CHAR_ID_ACCOUNT);

        for (.@i = 0; .@i < $@partymembercount; ++.@i)
        {
            if (isloggedin($@partymemberaid[.@i], $@partymembercid[.@i]))
            {
                detachrid;
                attachrid($@partymemberaid[.@i]);
                .@blvl[.@i] = BaseLevel;
                detachrid;
                attachrid(.@aid);
                dispbottom("" + $@partymembername$[.@i] + ": Level " + .@blvl[.@i] + "");
            }
        }
        close;
 
Last edited by a moderator:
Is it good now? Actually I didn't read the script_commands.txt doc properly haha didn't notice you need to specify type. If you are still having issues I will try to test tomorrow.

 
Thank you for your support, I did manage to get those 3 types already...
default_biggrin.png


 
Back
Top