AnnieRuru Posted October 17, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted October 17, 2012 (edited) from eathena Download: [paste=7207eo0p96gx] new method and examples -> just visit the one in hercules forum .... lazy to copy and paste http://hercules.ws/board/topic/4570- Note: bg_kickall has been removed so no need to recycle the team ID ----------------------------------------- [spoiler=OLD method - eAthena period] Download: battleground_16873.diff ----------------------------------------- *createbgid <respawn map>, <respawn x>, <respawn y>, <On Quit event>, <On Death event>; create a specific battleground ID, for the rest .... refer to doc ----------------------------------------- *setbgid <battleground ID> {, <player name> }; player attached to the script will join the battleground team, but if a player name ( or account ID ) is specify, will let that player join the battleground team the command returns positive number ( > 0 ) if the function is successful if it return negative :- -1: the battleground team haven't create yet ... has to be create with createbgid -2: the team already full, it reached MAX_BG_MEMBERS = 30 which can increase at src\map\battleground.h -3: player not found ... happens when the input <player name> is not online or not found -4: invalid battleground ID ... currently only accept ID range within 1~1000 -5: the player already join the battleground ID that you specify if the player has joined battleground ID 500, and you use setbgid 700; this will force the player to leave battleground ID 500 and join battleground ID 700 without any notification only when the player joined bg ID 500, and use setbgid 500; then only the command return -5 <-- failed setbgid 0; is equal to bg_leave; and setbgid 0, "annie"; or setbgid 0, 2000000; will make the player "annie" ( or account id "]2000000 ) leave the battleground team without using attachrid + bg_leave ----------------------------------------- *getbgusers <battleground ID>; similar to getpartymember <party ID>, 2; // <-- return account ID this will create an array "$@arenamembers" holding all the player's account ID from the battleground team and $@arenamembersnum is equal to bg_get_data(<battleground ID>, 0), just like $@partymembercount ----------------------------------------- *bg_kickall <battleground ID>; kick every player out from the battleground team this command is counter-part from bg_destroy ----------------------------------------- . [spoiler=OLD method - rAthena period]----------------------------------------- *createbgid <respawn map>, <respawn x>, <respawn y>, <On Quit event>, <On Death event>; create a specific battleground ID, for the rest .... refer to doc .red = createbgid( "guild_vs3", 13,50, strnpcinfo(0)+"::Onredout", strnpcinfo(0)+"::Onreddead" ); .blue = createbgid( "guild_vs3", 86,50, strnpcinfo(0)+"::Onblueout", strnpcinfo(0)+"::Onbluedead" ); -----------------------------------------*setbgid <battleground ID> {, <player name> }; *setbgid <battleground ID> {, <player account ID> }; player attached to the script will join the battleground team, but if a player name ( or account ID ) is specify, will let that player join the battleground team warpwaitingpc "guild_vs3", 0,0; for ( .@i = 0; .@i < $@warpwaitingpcnum; .@i++ ) setbgid ( .@i % 2 )? .red : .blue, $@warpwaitingpc[.@i]; the command returns positive number ( > 0 ) if the function is successfulif it return negative :- -1: the battleground team haven't create yet ... has to be create with createbgid -2: the team already full, it reached MAX_BG_MEMBERS = 30 which can increase at src\map\battleground.h -3: player not found ... happens when the input <player name> is not online or not found -5: the player already join the battleground ID that you specify if the player has joined battleground ID 500, and you use setbgid 700; this will force the player to leave battleground ID 500 and join battleground ID 700 without any notification ( player who same group will receive a message mention that "player xxx leaving battlefield" ) only when the player joined bg ID 500, and use setbgid 500; then only the command return -5 but the script will still continue running without posting any error, so don't worry setbgid 0; is equal to bg_leave; and setbgid 0, "annie"; or setbgid 0, 2000000; will make the player "annie" ( or account id 2000000 ) leave the battleground team without using attachrid + bg_leave ----------------------------------------- *getbgusers <battleground ID>; similar to getpartymember <party ID>, 2; // <-- return account ID this will create an array "$@arenamembers" holding all the player's account ID from the battleground team and $@arenamembersnum is equal to bg_get_data(<battleground ID>, 0), just like $@partymembercount getbgusers .red; for ( .@i = 0; .@i < $@arenamembersnum; .@i++ ) getitem 501, 1, $@arenamembers[.@i]; -----------------------------------------*bg_kickall <battleground ID>; kick every player out from the battleground team this command is counter-part from bg_destroy ----------------------------------------- currently don't have enough samples for this new method, because I've done a few battleground script ... and it seems members are prefer not to use source modification ... o.o remember these steps use OnInit with createbgid use setbgid to let player join don't use bg_destroy command, but use bg_kickall command instead remember different script use different teams, there's a limit of 30 players on each team only <- can increase at src/map/battleground.h#L10 eg: this battleground script use bg id 1 & 2, next battleground script use bg id 3 & 4 ( bg id is self generated in ascending order )Example ... npc "aaa" doesn't use any custom script command npc "bbb" is the one that using these script commands difference is quite a lotalthough both also can achieve the battleground team creation, but its obvious the 2nd one is much much cleaner and more feature Example : use OnInit + createbgid, then use setbgid to attach 2 teams on the event controller npc if your script assigned bg_id 1 & 2, then your script use bg_warp 1 ... and bg_warp 2 ... EDITED SCRIPT : prontera,155,181,5 script Sample 100,{ mes "Battlegound"; if ( select ( "join/leave", "warp all bg members to you" ) == 1 ) if( getcharid(4) ){ bg_leave; dispbottom "Leave BG"; }else{ setbgid .bg_id; dispbottom "Joined BG"; } else if ( getcharid(4) == 0 ) dispbottom "you didn't join a battleground team"; else { getmapxy .@map$, .@x, .@y, 0; bg_warp .bg_id, .@map$, .@x, .@y; } close; OnInit: getmapxy .@map$, .@x, .@y, 1; .bg_id = createbgid( .@map$, .@x, .@y, "", "" ); end; } the current sample script should be look like this now .... battleground will auto generate the Battle Group ID , you cant assign the ID. tested and work fine in rev 17532 ... [spoiler=Archive] battleground_16819.diff battleground_16873.diff battleground_17101.diff battleground_17102.diff Edited August 29, 2014 by AnnieRuru Updated Contents. 4 Quote Link to comment Share on other sites More sharing options...
GmOcean Posted October 17, 2012 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share Posted October 17, 2012 Oh.. This looks very useful. I'd make a new BG, using several existing commands as well as these new ones. Quote Link to comment Share on other sites More sharing options...
Famous Posted December 15, 2012 Group: Members Topic Count: 145 Topics Per Day: 0.03 Content Count: 455 Reputation: 3 Joined: 06/19/12 Last Seen: February 26, 2018 Share Posted December 15, 2012 Hi can I ask question is it posible to use Battle ground without battle ground equips? Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted January 1, 2013 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Author Share Posted January 1, 2013 Hi can I ask question is it posible to use Battle ground without battle ground equips? I don't understand your question ...do you mean cannot bring certain equipments into battleground maps ? ... Quote Link to comment Share on other sites More sharing options...
brunoshp Posted February 10, 2013 Group: Members Topic Count: 64 Topics Per Day: 0.01 Content Count: 180 Reputation: 7 Joined: 12/19/12 Last Seen: November 21, 2024 Share Posted February 10, 2013 i can pm you for about this? i need to understand! Quote Link to comment Share on other sites More sharing options...
zmref Posted February 10, 2013 Group: Members Topic Count: 148 Topics Per Day: 0.03 Content Count: 299 Reputation: 6 Joined: 06/14/12 Last Seen: March 30, 2013 Share Posted February 10, 2013 Hi can I ask question is it posible to use Battle ground without battle ground equips? you don't need a battleground equips to join a battleground event Quote Link to comment Share on other sites More sharing options...
brunoshp Posted February 13, 2013 Group: Members Topic Count: 64 Topics Per Day: 0.01 Content Count: 180 Reputation: 7 Joined: 12/19/12 Last Seen: November 21, 2024 Share Posted February 13, 2013 I can use this Queue for party vs party? Quote Link to comment Share on other sites More sharing options...
Shakto Posted March 14, 2013 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 416 Reputation: 96 Joined: 02/07/13 Last Seen: 18 hours ago Share Posted March 14, 2013 There is trouble when using createbgid When the npc is loading, rathena windows say : [Error]: script error on npc/custom/bg.txt line 48 parse_line: need ';' 43 : } 44 : close; 45 : OnInit: 46 : getmapxy .@map$, .@x, .@y, 1; * 48 : createbgid 1, .@map$, .@x, .@y, ""',' ""; 49 : end; 50 : } Quote Link to comment Share on other sites More sharing options...
mrlongshen Posted March 21, 2013 Group: Members Topic Count: 98 Topics Per Day: 0.02 Content Count: 1302 Reputation: 79 Joined: 12/04/12 Last Seen: September 26, 2019 Share Posted March 21, 2013 can this use for latest svn ? Quote Link to comment Share on other sites More sharing options...
Erba Posted September 25, 2013 Group: Members Topic Count: 84 Topics Per Day: 0.02 Content Count: 550 Reputation: 9 Joined: 11/06/12 Last Seen: August 14, 2014 Share Posted September 25, 2013 can this be used in r16797? Quote Link to comment Share on other sites More sharing options...
Emistry Posted September 25, 2013 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10017 Reputation: 2369 Joined: 10/28/11 Last Seen: 18 hours ago Share Posted September 25, 2013 @brunoshp it's possible ... @shakto you didnt add the source mod given .... there are 3 new script commands in the source mod made by annie. @mrlongshen and erba there should be no problem for any version to add a custom script commands. Quote Link to comment Share on other sites More sharing options...
nexus1528 Posted October 4, 2013 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 20 Reputation: 0 Joined: 07/15/13 Last Seen: November 25, 2014 Share Posted October 4, 2013 sorry about this .. but i cant understand how it works .. can u please give a step by step instructions .. please i realy need this .. Quote Link to comment Share on other sites More sharing options...
Emistry Posted October 5, 2013 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10017 Reputation: 2369 Joined: 10/28/11 Last Seen: 18 hours ago Share Posted October 5, 2013 @Shakto / others who have error. this is the updated sample script prontera,155,181,5 script Sample 100,{ mes "Battlegound"; if ( select ( "join/leave", "warp all bg members to you" ) == 1 ) if( getcharid(4) ){ bg_leave; dispbottom "Leave BG"; }else{ setbgid .bg_id; dispbottom "Joined BG"; } else if ( getcharid(4) == 0 ) dispbottom "you didn't join a battleground team"; else { getmapxy .@map$, .@x, .@y, 0; bg_warp .bg_id, .@map$, .@x, .@y; } close; OnInit: getmapxy .@map$, .@x, .@y, 1; .bg_id = createbgid( .@map$, .@x, .@y, "", "" ); end; } we cant assign battleground id when we create it because the server will auto generate one. current patch is tested and still working in rev 17532 .... beside, you can now simply add these source mod with this 2 file. src/custom/script.inc and src/custom/script_def.inc should be no problem for newbie to add these source mod now. Quote Link to comment Share on other sites More sharing options...
Daegaladh Posted November 28, 2013 Group: Developer Topic Count: 30 Topics Per Day: 0.01 Content Count: 238 Reputation: 147 Joined: 11/21/11 Last Seen: Friday at 08:31 AM Share Posted November 28, 2013 remember these steps use OnInit with createbgid use setbgid to let player join don't use bg_destroy command, but use bg_kickall command instead remember different script use different teams, there's a limit of 30 players on each team only <- can increase at src/map/battleground.h#L10 eg: this battleground script use bg id 1 & 2, next battleground script use bg id 3 & 4 ( bg id is self generated in ascending order ) What's the point of recycling team ids? 1 Quote Link to comment Share on other sites More sharing options...
Emistry Posted November 29, 2013 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10017 Reputation: 2369 Joined: 10/28/11 Last Seen: 18 hours ago Share Posted November 29, 2013 remember these steps use OnInit with createbgid use setbgid to let player join don't use bg_destroy command, but use bg_kickall command instead remember different script use different teams, there's a limit of 30 players on each team only <- can increase at src/map/battleground.h#L10 eg: this battleground script use bg id 1 & 2, next battleground script use bg id 3 & 4 ( bg id is self generated in ascending order ) What's the point of recycling team ids? i believe it's up to you... if you didnt use the bg_destroy , the previous battleground group will be saved...so you dont need to create a new battleground id using the createbgid() otherwise, the bg_kickall() seem like useless if you intend to re-create the battleground group id everytime your script run.. anyway it's still depend on how you want your script to work... O__O Quote Link to comment Share on other sites More sharing options...
Yuka Posted March 5, 2014 Group: Members Topic Count: 100 Topics Per Day: 0.02 Content Count: 333 Reputation: 7 Joined: 03/01/14 Last Seen: May 6, 2020 Share Posted March 5, 2014 Is this still working? How do I install it on my Linux server? D: Quote Link to comment Share on other sites More sharing options...
noxty Posted March 19, 2014 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 28 Reputation: 1 Joined: 04/22/12 Last Seen: August 29, 2019 Share Posted March 19, 2014 (edited) Hello every body, i have an problem check, this is my console error. [Error]: Loading NPC file: npc/custom/phow/bgregistro.txt script error on npc/custom/phow/bgregistro.txt line 5 parse_line: expect command, missing function name or calling undeclared function 1 : { 2 : //prontera,154,185,5 script bbb 100,{ 3 : switch ( select( "join", "watch", "manual set", "kick all" ) ) { 4 : case 1: * 5 : 's'etbgid 1; 6 : close; 7 : case 2: 8 : getbgusers 1; 9 : for ( set .@i, 0; .@i < $@arenamembersnum; set .@i, .@i +1 ) 10 : dispbottom ( .@i +1 )+". "+ rid2name( $@arenamembers[.@i] ); i put the patch diff in Script.c and compile my svn version is 17703 rAthena srry for my bad english x.x help me please. Edited March 19, 2014 by noxty Quote Link to comment Share on other sites More sharing options...
Zell Posted April 17, 2014 Group: Members Topic Count: 53 Topics Per Day: 0.01 Content Count: 412 Reputation: 266 Joined: 04/25/12 Last Seen: 12 hours ago Share Posted April 17, 2014 I think: 's'etbgid 1; is set bgid,1; Quote Link to comment Share on other sites More sharing options...
Yuka Posted April 19, 2014 Group: Members Topic Count: 100 Topics Per Day: 0.02 Content Count: 333 Reputation: 7 Joined: 03/01/14 Last Seen: May 6, 2020 Share Posted April 19, 2014 I get this error: *************** *** 17323,17328 **** return 0; } // declarations that were supposed to be exported from npc_chat.c #ifdef PCRE_SUPPORT BUILDIN_FUNC(defpattern); --- 17323,17402 ---- return 0; } + // createbgid <respawn map>, <respawn x>, <respawn y>, <On Quit event>, <On Death event>; + BUILDIN_FUNC(createbgid) { + unsigned int bg_id; + if ( ( bg_id = bg_create( mapindex_name2id( script_getstr(st,2) ), script_getnum(st,3), script_getnum(st,4), script_getstr(st,5), script_getstr(st,6) ) ) > 0 ) + script_pushint( st, bg_id ); + else + script_pushint( st, 0 ); + return 0; + } + + // setbgid <battleground ID> {, <player name> }; + // setbgid <battleground ID> {, <player account ID> }; + BUILDIN_FUNC(setbgid) { + unsigned int bg_id = script_getnum(st,2); + struct battleground_data *bg = bg_team_search( bg_id ); + struct map_session_data *sd; + if ( script_hasdata( st, 3 ) ) { + if ( data_isstring( script_getdata(st,3) ) ) + sd = map_nick2sd( script_getstr(st,3) ); + else + sd = map_id2sd( script_getnum(st,3) ); + } else + sd = script_rid2sd(st); + if ( !sd ) { + script_pushint( st, -3 ); // player no attach + return 0; + } + if ( !bg && bg_id > 0 ) { + script_pushint( st, -1 ); // battleground team haven't created + return 0; + } + if ( bg_id && sd->bg_id == bg_id ) { + script_pushint( st, -5 ); // the player has already join this battleground team + return 0; + } + if ( sd->bg_id ) + bg_team_leave( sd, 0 ); + if ( bg_id == 0 ) { + script_pushint( st, 0 ); + return 0; + } + if ( !bg_team_join( bg_id, sd ) ) + script_pushint( st, -2 ); // cannot join anymore, because has reached MAX_BG_MEMBERS + else + script_pushint( st, bg_id ); + return 0; + } + + // getbgusers <battleground ID>; + BUILDIN_FUNC(getbgusers) { + struct battleground_data *bg = bg_team_search( script_getnum(st,2) ); + int i; + if ( !bg ) { + script_pushint( st, -1 ); + return 0; + } + for ( i = 0; bg->members[i].sd; i++ ) + mapreg_setreg( reference_uid( add_str("$@arenamembers"), i ), bg->members[i].sd->bl.id ); + mapreg_setreg( add_str("$@arenamembersnum"), i ); + script_pushint( st, i ); + return 0; + } + + // bg_kickall <battleground ID>; + BUILDIN_FUNC(bg_kickall) { + struct battleground_data *bg = bg_team_search( script_getnum(st,2) ); + int i; + if ( bg ) { + for ( i = 0; bg->members[i].sd; i++ ) + bg_team_leave( bg->members[i].sd , 0 ); + } + return 0; + } + // declarations that were supposed to be exported from npc_chat.c #ifdef PCRE_SUPPORT BUILDIN_FUNC(defpattern); *************** *** 17780,17784 **** BUILDIN_DEF(checkquest, "i?"), BUILDIN_DEF(changequest, "ii"), BUILDIN_DEF(showevent, "ii"), {NULL,NULL,NULL}, }; --- 17854,17863 ---- BUILDIN_DEF(checkquest, "i?"), BUILDIN_DEF(changequest, "ii"), BUILDIN_DEF(showevent, "ii"), + + BUILDIN_DEF(createbgid,"siiss"), + BUILDIN_DEF(setbgid,"i?"), + BUILDIN_DEF(getbgusers,"i"), + BUILDIN_DEF(bg_kickall,"i"), {NULL,NULL,NULL}, }; Quote Link to comment Share on other sites More sharing options...
Yuka Posted April 25, 2014 Group: Members Topic Count: 100 Topics Per Day: 0.02 Content Count: 333 Reputation: 7 Joined: 03/01/14 Last Seen: May 6, 2020 Share Posted April 25, 2014 Bump. Still the same problem. Quote Link to comment Share on other sites More sharing options...
Emistry Posted April 26, 2014 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10017 Reputation: 2369 Joined: 10/28/11 Last Seen: 18 hours ago Share Posted April 26, 2014 @yuka/noxty/zell three of you didnt apply the source mod properly ... reapply the changes... Quote Link to comment Share on other sites More sharing options...
noxty Posted April 26, 2014 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 28 Reputation: 1 Joined: 04/22/12 Last Seen: August 29, 2019 Share Posted April 26, 2014 Hello amm i now have an error parse_line: expect command, missing function name or calling undeclared func tion 2 : switch ( select( "join", "watch", "manual set", "kick all" ) ) { 3 : case 1: 4 : set bgid,1; 5 : close; 6 : case 2: * 7 : 'g'etbgusers, 1; 8 : for ( set .@i, 0; .@i < $@arenamembersnum; set . @i, .@i +1 ) 9 : dispbottom ( .@i +1 )+". "+ rid2name( $@ arenamembers[.@i] ); 10 : close; 11 : case 3: 12 : mes "input a team"; Help me please Quote Link to comment Share on other sites More sharing options...
Emistry Posted April 27, 2014 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10017 Reputation: 2369 Joined: 10/28/11 Last Seen: 18 hours ago Share Posted April 27, 2014 already told you =='' You didnt apply the source mod correctly You didnt recompile your server unsolved error during compilation take a break and start learning how to diff instead of keep spam same questions over and over again. Quote Link to comment Share on other sites More sharing options...
noxty Posted April 28, 2014 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 28 Reputation: 1 Joined: 04/22/12 Last Seen: August 29, 2019 Share Posted April 28, 2014 Hello Emistry Check this my script.c i put the patch and compile my server, and i dont have any error in compilation. https://www.mediafire.com/?bfvjgkyb6vsy0y2 Quote Link to comment Share on other sites More sharing options...
Yuka Posted April 29, 2014 Group: Members Topic Count: 100 Topics Per Day: 0.02 Content Count: 333 Reputation: 7 Joined: 03/01/14 Last Seen: May 6, 2020 Share Posted April 29, 2014 already told you =='' You didnt apply the source mod correctly You didnt recompile your server unsolved error during compilation take a break and start learning how to diff instead of keep spam same questions over and over again. This is what I've done: 1. shut server down 2. cd /root/rAthena/ yum install patch patch -p1 < battleground_17102.diff 3. recompile 4. start server Didn't work for me, what did I do wrong? :/ I'm using Centos 5.9 32 bit Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.