Skip to content

Instantly share code, notes, and snippets.

@AnnieRuru
Last active September 22, 2020 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AnnieRuru/339e268a8be5370fa7ae1aa2f856ca28 to your computer and use it in GitHub Desktop.
Save AnnieRuru/339e268a8be5370fa7ae1aa2f856ca28 to your computer and use it in GitHub Desktop.
- script woelimit HIDDEN_NPC,{
end;
OnPCLoadMapEvent:
.@guild_id = getcharid(CHAR_ID_GUILD);
if (!.@guild_id || !getmapflag(strcharinfo(PC_MAP), MF_GVG_CASTLE) || !agitcheck())
end;
.@origin = getcharid(CHAR_ID_ACCOUNT);
getguildmember .@guild_id, 1;
getguildmember .@guild_id, 2;
for (.@i = 0; .@i < $@guildmembercount; ++.@i) {
if (isloggedin($@guildmemberaid[.@i], $@guildmembercid[.@i])) {
attachrid $@guildmemberaid[.@i];
.@map$ = strcharinfo(PC_MAP);
.@j = 0;
while (.@j < 30 && .@map$ != .castle$[.@j])
++.@j;
// announce strcharinfo(PC_NAME) +" in "+ .castle$[.@j] +"["+ .@j +"]", bc_all, C_PINK; // DEBUG
if (.@j == 30)
continue;
++.@count[.@j];
// announce "so far "+ .@count[.@j] +" is in castle map "+ .castle$[.@j], bc_all, C_PINK; // DEBUG
if (.@count[.@j] > .max) {
attachrid .@origin;
message .@origin, "WARNING: Max of "+ .max +" members can simultaneously join the WOE.";
warp "Save", 0,0;
end;
}
}
}
end;
OnInit:
.max = 2;
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment