Jump to content
  • 0
Kuroyama

Castle Guild Member Limit

Question

Does anyone know how to limit guild members entering a castle during woe? For example my guild cap is 76 but i only want 25 or 30 members can enter a castle during woe. I did try this https://upaste.me/raw/691b80 script, but its kicking all of the members on Ecall. Please help me find any other way to refine this script to make them stay for alteast 25 members and not allowing to enter the castle for excess members.

Share this post


Link to post
Share on other sites

15 answers to this question

Recommended Posts

  • 1

oh ok, you are partially right when it kick excess guild members

but it isn't the way you claimed that it count from other guild members

 

upon close inspection, @astralprojection script has 2 problems which is

1. if the player has multiple characters from the same account join the same guild, it count multiple times instead of 1, it doesn't extend the isloggedin into $@guildmembercid check

2. it checks as long as the guild member enter ANY CASTLE map, not that particular castle map

 

try this one

https://gist.github.com/AnnieRuru/339e268a8be5370fa7ae1aa2f856ca28

Share this post


Link to post
Share on other sites
  • 0
3 hours ago, astralprojection said:

maybe limit your guild capacity?

I already implement 72 guild cap, whenever I tried to lowered it down. It cause major bugs and errors. That's why, I choose script as an alternative to avoid that major error.

Share this post


Link to post
Share on other sites
  • 0

-	script	woelimit	HIDDEN_NPC,{
end;

OnPCLoadMapEvent:
	.@rid = playerattached();
	if ( !compare(strcharinfo(PC_MAP), "g_cas") || !agitcheck() ) end;
	getguildmember getcharid(CHAR_ID_GUILD), 1;
	getguildmember getcharid(CHAR_ID_GUILD), 2;
	.@count = 0;
	for ( .@i = 0; .@i < $@guildmembercount; .@i++ ) {
		if (attachrid($@guildmemberaid[.@i])) {
			if( compare(strcharinfo(PC_MAP), "g_cas") ) .@count++;
		}
	}
	if ( .@rid )
      		attachrid(.@rid);
	else
        	detachrid;

	if(.@count > .max){
		message strcharinfo(0), "WARNING: Max of "+.max+" members can simultaneously join the WOE.";
		warp "SavePoint",0,0;
	}
	end;

OnInit:
	.max = 25;
	end;
}

try this

Share this post


Link to post
Share on other sites
  • 0
-	script	Guild Limiter	-1,{
	
	// This part ejects players when they are in the map 
	OnPCLoadMapEvent:
	if( getcharid(2) == $App_Guilds[.@i] ){
	.count = 0;
	.@origin = getcharid(3);
	getmapguildusers( .@checkmap$, getcharid(2));
	if ( strcharinfo(3) == .@checkmap$ )
		.count++;
	if ( !.@origin ) end;
	if ( .count ) > 3 { // 5 means only 5 players per guild allowed in a map.
		message strcharinfo(0), "Your guild members are over the limit";
		sleep2 2000;
		warp "SavePoint", 0,0;
	}
	}
	end;
OnInit:
	setarray .@checkmap$, "guild_vs1", "arug_cas01", "arug_cas02", "arug_cas03", "arug_cas04", "arug_cas05", "schg_cas01", "schg_cas02", "schg_cas03", "schg_cas04", "schg_cas05";
	.@len = getarraysize( .@checkmap$ );
	for ( .@i = 0; .@i < .@size; .@i++ ) {
		setmapflag .@checkmap$[.@i], mf_loadevent;
		setd "."+ .@checkmap$[.@i], 1;
	}
	end;
}

Currently modifying this, it takes no error but it doesn't work.

Just now, astralprojection said:

- script woelimit HIDDEN_NPC,{ end; OnPCLoadMapEvent: .@rid = playerattached(); if ( !compare(strcharinfo(PC_MAP), "g_cas") || !agitcheck() ) end; getguildmember getcharid(CHAR_ID_GUILD), 1; getguildmember getcharid(CHAR_ID_GUILD), 2; .@count = 0; for ( .@i = 0; .@i < $@guildmembercount; .@i++ ) { if (attachrid($@guildmemberaid[.@i])) { if( compare(strcharinfo(PC_MAP), "g_cas") ) .@count++; } } if ( .@rid ) attachrid(.@rid); else detachrid; if(.@count > .max){ message strcharinfo(0), "WARNING: Max of "+.max+" members can simultaneously join the WOE."; warp "SavePoint",0,0; } end; OnInit: .max = 25; end; }


-	script	woelimit	HIDDEN_NPC,{
end;

OnPCLoadMapEvent:
	.@rid = playerattached();
	if ( !compare(strcharinfo(PC_MAP), "g_cas") || !agitcheck() ) end;
	getguildmember getcharid(CHAR_ID_GUILD), 1;
	getguildmember getcharid(CHAR_ID_GUILD), 2;
	.@count = 0;
	for ( .@i = 0; .@i < $@guildmembercount; .@i++ ) {
		if (attachrid($@guildmemberaid[.@i])) {
			if( compare(strcharinfo(PC_MAP), "g_cas") ) .@count++;
		}
	}
	if ( .@rid )
      		attachrid(.@rid);
	else
        	detachrid;

	if(.@count > .max){
		message strcharinfo(0), "WARNING: Max of "+.max+" members can simultaneously join the WOE.";
		warp "SavePoint",0,0;
	}
	end;

OnInit:
	.max = 25;
	end;
}

try this

Oh thanks, wait let me try this.

It works @astralprojection! I repeat it works perfectly!  Thank you so much! :sob:

Share this post


Link to post
Share on other sites
  • 0
On 9/16/2020 at 11:29 AM, astralprojection said:

- script woelimit HIDDEN_NPC,{ end; OnPCLoadMapEvent: .@rid = playerattached(); if ( !compare(strcharinfo(PC_MAP), "g_cas") || !agitcheck() ) end; getguildmember getcharid(CHAR_ID_GUILD), 1; getguildmember getcharid(CHAR_ID_GUILD), 2; .@count = 0; for ( .@i = 0; .@i < $@guildmembercount; .@i++ ) { if (attachrid($@guildmemberaid[.@i])) { if( compare(strcharinfo(PC_MAP), "g_cas") ) .@count++; } } if ( .@rid ) attachrid(.@rid); else detachrid; if(.@count > .max){ message strcharinfo(0), "WARNING: Max of "+.max+" members can simultaneously join the WOE."; warp "SavePoint",0,0; } end; OnInit: .max = 25; end; }



-	script	woelimit	HIDDEN_NPC,{
end;

OnPCLoadMapEvent:
	.@rid = playerattached();
	if ( !compare(strcharinfo(PC_MAP), "g_cas") || !agitcheck() ) end;
	getguildmember getcharid(CHAR_ID_GUILD), 1;
	getguildmember getcharid(CHAR_ID_GUILD), 2;
	.@count = 0;
	for ( .@i = 0; .@i < $@guildmembercount; .@i++ ) {
		if (attachrid($@guildmemberaid[.@i])) {
			if( compare(strcharinfo(PC_MAP), "g_cas") ) .@count++;
		}
	}
	if ( .@rid )
      		attachrid(.@rid);
	else
        	detachrid;

	if(.@count > .max){
		message strcharinfo(0), "WARNING: Max of "+.max+" members can simultaneously join the WOE.";
		warp "SavePoint",0,0;
	}
	end;

OnInit:
	.max = 25;
	end;
}

try this

Hello sir @astralprojection, just a little update here. So I'd use this on live server and the result is good but it affects overall counts of the guild inside the map, not just "per" guild.

For example: so I set the max cap to 30, guild 1 enter the castle and they already have 17 players there and guild 2 was entering too with 15 members. The script was counting the overall guildmember cap inside the castle, not per member of the separate guilds so even though the guild 1 and guild 2 aren't 30 members inside, the script will kick the excess.

Edited by Kuroyama
Additional Info

Share this post


Link to post
Share on other sites
  • 0

https://upaste.me/691b80

emistry's script should work though ...

 

-	script	Sample	FAKE_NPC,{
OnPCLoadMapEvent:
	.@map$ = strcharinfo(PC_MAP);
	.@guild_id = getcharid(CHAR_ID_GUILD);

	if (getmapflag(.@map$, MF_GVG_CASTLE) && .@guild_id) {
		if (getmapguildusers( .@map$,.@guild_id ) > 2){
			mes "Max Guild Member can stay on this map exceed.";
			close2;
			warp "prontera",155,181;
		}
	}
	end;
}

aldeg_cas01	mapflag	gvg_castle
aldeg_cas01	mapflag	loadevent

 

now astralprojection's script

.... also works when set .max, 2; ...

 

... I have no idea why doesn't work for you,

- I open 6 client, 3 client join guild A, other 3 client join guild B

- guild A only can only enter 2 guild members, guild B also only can enter 2 guild members, always 1 getting kick

 

if it doesn't work this way, then what is the behavior you want ?

Share this post


Link to post
Share on other sites
  • 0
10 hours ago, AnnieRuru said:

https://upaste.me/691b80

emistry's script should work though ...

 

- script Sample FAKE_NPC,{ OnPCLoadMapEvent: .@map$ = strcharinfo(PC_MAP); .@guild_id = getcharid(CHAR_ID_GUILD); if (getmapflag(.@map$, MF_GVG_CASTLE) && .@guild_id) { if (getmapguildusers( .@map$,.@guild_id ) > 2){ mes "Max Guild Member can stay on this map exceed."; close2; warp "prontera",155,181; } } end; } aldeg_cas01 mapflag gvg_castle aldeg_cas01 mapflag loadevent


-	script	Sample	FAKE_NPC,{
OnPCLoadMapEvent:
	.@map$ = strcharinfo(PC_MAP);
	.@guild_id = getcharid(CHAR_ID_GUILD);

	if (getmapflag(.@map$, MF_GVG_CASTLE) && .@guild_id) {
		if (getmapguildusers( .@map$,.@guild_id ) > 2){
			mes "Max Guild Member can stay on this map exceed.";
			close2;
			warp "prontera",155,181;
		}
	}
	end;
}

aldeg_cas01	mapflag	gvg_castle
aldeg_cas01	mapflag	loadevent

 

now astralprojection's script

.... also works when set .max, 2; ...

 

... I have no idea why doesn't work for you,

- I open 6 client, 3 client join guild A, other 3 client join guild B

- guild A only can only enter 2 guild members, guild B also only can enter 2 guild members, always 1 getting kick

 

if it doesn't work this way, then what is the behavior you want ?

I already tried this, and it's affecting (kicking) all the guild members when you Ecall them. Once recalled, all the members are affected by limit and they will be warped out even you set the limit to large number.

 

 

Sir @astralprojection script works and exclude the ecall issue, but the problem is the script is counting the overall guildmember cap inside the castle/koe map, not per member of the separate guilds so even though the guild A and guild B aren't 3 (or 30) members inside, the script will kick the excess as long as its reach the limit inside the map. It counts all the guild members inside the map.

Share this post


Link to post
Share on other sites
  • 0
On 9/22/2020 at 2:40 AM, AnnieRuru said:

https://upaste.me/691b80

emistry's script should work though ...

 

- script Sample FAKE_NPC,{ OnPCLoadMapEvent: .@map$ = strcharinfo(PC_MAP); .@guild_id = getcharid(CHAR_ID_GUILD); if (getmapflag(.@map$, MF_GVG_CASTLE) && .@guild_id) { if (getmapguildusers( .@map$,.@guild_id ) > 2){ mes "Max Guild Member can stay on this map exceed."; close2; warp "prontera",155,181; } } end; } aldeg_cas01 mapflag gvg_castle aldeg_cas01 mapflag loadevent


-	script	Sample	FAKE_NPC,{
OnPCLoadMapEvent:
	.@map$ = strcharinfo(PC_MAP);
	.@guild_id = getcharid(CHAR_ID_GUILD);

	if (getmapflag(.@map$, MF_GVG_CASTLE) && .@guild_id) {
		if (getmapguildusers( .@map$,.@guild_id ) > 2){
			mes "Max Guild Member can stay on this map exceed.";
			close2;
			warp "prontera",155,181;
		}
	}
	end;
}

aldeg_cas01	mapflag	gvg_castle
aldeg_cas01	mapflag	loadevent

 

now astralprojection's script

.... also works when set .max, 2; ...

 

... I have no idea why doesn't work for you,

- I open 6 client, 3 client join guild A, other 3 client join guild B

- guild A only can only enter 2 guild members, guild B also only can enter 2 guild members, always 1 getting kick

 

if it doesn't work this way, then what is the behavior you want ?

Could Emistry's script be modified to limit a certain job class instead of  the whole guild limite? EX. Limit wizards to 5 only upon entering the map and warps the exceeded job classes to savepoint? or maybe yours @astralprojection

Share this post


Link to post
Share on other sites
  • 0

not tested by u can try

 

-	script	woe_joblimit	FAKE_NPC,{
end;

OnPCLoadMapEvent:
	.@guild_id = getcharid(CHAR_ID_GUILD);
	if (!.@guild_id || !getmapflag(strcharinfo(PC_MAP), MF_GVG_CASTLE) || !agitcheck() || !agitcheck2() ) end;
	if(.joblimit){
		.@origin = playerattached();
		.@class = Class;
		.@map$ = strcharinfo(PC_MAP);
		.@climit = 0;
		getguildmember getcharid(CHAR_ID_GUILD), 1;
		getguildmember getcharid(CHAR_ID_GUILD), 2;
		for ( .@i = 0; .@i < $@guildmembercount; ++.@i ) {
			if (isloggedin( $@guildmemberaid[.@i], $@guildmembercid[.@i] ) == 0) {
					continue;
			} else {
				if (attachrid($@guildmemberaid[.@i])) {
					if( .@class == Class && strcharinfo(PC_MAP) == .@map$ ) {
						++.@climit;
					}
				}
			}
		}
		if ( .@origin ) {
			attachrid(.@origin);
			if(.@climit > .joblimit){
				message strcharinfo(0), "REGULATION: Your guild reached the max of ( "+.joblimit+" ) "+jobname(Class)+" that can join the siege.";
				warp "SavePoint",0,0;
			}
		} else {
			detachrid;
		}
	}
	end;
    
OnInit:
	.joblimit = 6;
	setarray .castle$[0],
		"aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05",
		"gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05",
		"payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05",
		"prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05",
		"arug_cas01","arug_cas02","arug_cas03","arug_cas04","arug_cas05",
		"schg_cas01","schg_cas02","schg_cas03","schg_cas04","schg_cas05";
	for (.@i = 0; .@i < 30; ++.@i) {
		setmapflag .castle$[.@i], MF_GVG_CASTLE;
		setmapflag .castle$[.@i], MF_LOADEVENT;
	}
	end;
}

 

Edited by astralprojection

Share this post


Link to post
Share on other sites

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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.