Castle Guild Member Limit

Kuroyama

New member
Messages
128
Points
0
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.

 
- 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

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

- 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:

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

 
Last edited by a moderator:
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 ?

 
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.

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.



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.

 
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

 
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

 
not tested by u can try

 

Code:
-	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;
}
 
Last edited by a moderator:
Back
Top