Jump to content
  • 0

Item party bonus


Question

7 answers to this question

Recommended Posts

  • 0
Posted

Something like this I guess?

-	script	bonus_party	-1,{

OnPCStatCalcEvent:

	.@item_id = 1201;
	.@pid = getcharid(1);
	if(isequipped(.@item_id) && .@pid) {
		getpartymember .@pid,1,.@party_cid;
		getpartymember .@pid,2,.@party_aid;
		.@size = $@partymembercount;
		for(;.@i < .@size;.@i++)
			.@n+= isloggedin(.@party_aid[.@i],.@party_cid[.@i]);
		bonus bStr,.@n;
	}
	end;
}

 

  • Love 1
  • 0
Posted (edited)
On 12/13/2018 at 2:16 AM, n0tttt said:

Something like this I guess?


-	script	bonus_party	-1,{

OnPCStatCalcEvent:

	.@item_id = 1201;
	.@pid = getcharid(1);
	if(isequipped(.@item_id) && .@pid) {
		getpartymember .@pid,1,.@party_cid;
		getpartymember .@pid,2,.@party_aid;
		.@size = $@partymembercount;
		for(;.@i < .@size;.@i++)
			.@n+= isloggedin(.@party_aid[.@i],.@party_cid[.@i]);
		bonus bStr,.@n;
	}
	end;
}

 

How about instead of giving a bonus from the Player who wear that Item, if the wearer has that item everyone on that party will give bonuses too.

e.g Allstats + 1 everyone on that party will have the bonus Allstats + 1 too. Possible? (A Player who has the item must be the Party Leader or else the bonus won't work)

Edited by Azeroth
  • 0
Posted
-	script	bonus_party	-1,{

OnPCStatCalcEvent:

	.@item_id = 1201;
	.@pid = getcharid(1);
	.@oid = getcharid(3);
	if(isequipped(.@item_id) && .@pid) {
		.@is_leader = is_party_leader();
		getpartymember .@pid,1,.@party_cid;
		getpartymember .@pid,2,.@party_aid;
		.@size = $@partymembercount;
		for(;.@i < .@size;.@i++) {
			if(isloggedin(.@party_aid[.@i],.@party_cid[.@i])) {
				.@n++;
				if(.@is_leader)
					if(attachrid(.@party_aid[.@i]))
						bonus bStr,1;
			}
		}
		attachrid .@oid;	
		bonus bStr,.@n;
	}
	end;
}

 

  • 0
Posted

@n0tttt

I've tried your script, but my test server throws error on me ...

[Error]:  Loading NPC file: npc/zzz.txt
script error on npc/zzz.txt line 8
    script:add_word: invalid word. A word consists of undercores and/or alphanum
eric characters, and valid variable prefixes/postfixes.
     3 : OnPCStatCalcEvent:
     4 :        .@item_id = 2301;
     5 :        .@pid = getcharid(1);
     6 :        .@oid = getcharid(3);
     7 :        if(isequipped(.@item_id) && .@pid) {
*    8 :                .@is_leader = is_party_leader(')';
     9 :                getpartymember .@pid,1,.@party_cid;
    10 :                getpartymember .@pid,2,.@party_aid;
    11 :                .@size = $@partymembercount;
    12 :                for(;.@i < .@size;.@i++) {
    13 :                        if(isloggedin(.@party_aid[.@i],.@party_cid[.@i])
) {

@Azeroth

I don't think your idea is possible, both methods doesn't work

-	script	sfdfkjshf	-1,{
OnInit:
	setitemscript 2301, "{"+
		".@pid = getcharid(1);"+
		"if ( !.@pid ) end;"+
		"if ( getpartyleader( .@pid, 2 ) != getcharid(0) ) end;"+
		"getpartymember .@pid, 1;"+
		"getpartymember .@pid, 2;"+
		"for ( .@i = 0; .@i < $@partymembercount; ++.@i ) {"+
		"	if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {"+
		"		attachrid $@partymemberaid[.@i];"+
		"		bonus bStr, 1;"+ // doesn't give other members
		"		dispbottom 1;"+
		"	}"+
		"}"+
	"}";
}
-	script	sfdfkjshf	-1,{
OnPCStatCalcEvent:
	if ( !isequipped(2301) ) end;
	.@pid = getcharid(1);
	if ( !.@pid ) end;
	if ( getpartyleader( .@pid, 2 ) != getcharid(0) ) end;
	getpartymember .@pid, 1;
	getpartymember .@pid, 2;
	for ( .@i = 0; .@i < $@partymembercount; ++.@i ) {
		if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {
			attachrid $@partymemberaid[.@i];
			bonus bAllstats, 1;
		//	recalculatestat();
			dispbottom 1;
		}
	}
	end;
}

the dispbottom part shows for the other party member, but the stats aren't updated
probably due to the fact the part where bonus us calculated, namely status_calc_pc function are badly coded
it was coded in the way only gives to the user, not for others

even *recalculatestat script command doesn't work

  • 0
Posted (edited)

It's a recent command: https://github.com/rathena/rathena/commit/78edf851a00d61dbf3a6668c6f21f1dd1cbb6c45

Thank you for testing my script. It's a shame the two methods you tested didn't work.

The only way I can think now is by using sc_start, but it would overlap with other buffs...

-	script	bonus_party	-1,{

OnPCStatCalcEvent:

	.@item_id = 1201;
	.@pid = getcharid(1);
	.@oid = getcharid(3);
	if(isequipped(.@item_id) && .@pid) {
		.@is_leader = is_party_leader();
		getpartymember .@pid,1,.@party_cid;
		getpartymember .@pid,2,.@party_aid;
		.@size = $@partymembercount;
		for(;.@i < .@size;.@i++) {
			if(isloggedin(.@party_aid[.@i],.@party_cid[.@i])) {
				.@n++;
				if(.@is_leader && .@party_aid[.@i] != .@oid) {
					if(attachrid(.@party_aid[.@i])) {
						.@time = getstatus(SC_INCALLSTATUS,5);
						if(.@time <= 10000) {
							sc_start SC_INCALLSTATUS,60000,max(1,getstatus(SC_INCALLSTATUS,1) + !@party_bonus);
							if(!.@time)
								@party_bonus = true;
						}
					}
				}

			}
		}
		attachrid .@oid;
		//sc_start SC_INCSTR,60000,.@n;
		bonus bStr,.@n;
	}
	end;
}

Edit: just did a little change (idk if it works) in case the player already had that buff, the script will sum +1 to avoid overwriting. Hope it works (can't test, I don't have a test server).

Edited by n0tttt
  • 0
Posted (edited)

in my opinion

I think there is to much going on in "OnPCStatCalcEvent"

 

this how I would do it

-	script	item_party_buff	-1,{

OnPCStatCalcEvent:
	if(getvar(@ITEMPARTYBUFF,getpartyleader(getcharid(1),2))){
		bonus bAllstats, 1;
	}
	end;
}

1201,Knife,Knife,5,50,,400,17,,1,3,0x3E9F7EEF,63,2,2,1,1,1,1,{},{ @ITEMPARTYBUFF = true; },{ @ITEMPARTYBUFF = false; }

 

ofc it's not perfect , the party members won't get the bonus before they hit the event(this event happen a lot but it might be a problem for some to not get the bonus immediately)

 

so if it's for my server , I won't do it and think of other ways , or maybe looking to the src to do it

 

Edited by sader1992
  • Love 1

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...