Jump to content

battleground system without waitingroom


AnnieRuru

Recommended Posts


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.02
  • Content Count:  429
  • Reputation:   60
  • Joined:  08/19/12
  • Last Seen:  

from eathena

Download:

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

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

-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

[spoiler=OLD method]

Download:

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

-----------------------------------------

remember these steps

  1. use OnInit with createbgid
  2. 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 ...

difference is quite a lot

although 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']

attachicon.gifbattleground_16819.diff

attachicon.gifbattleground_16873.diff

attachicon.gifbattleground_17101.diff

Hello Annie,

Can i request if you could provide a Sample script of this with your BG_EMP? i really appreciate your works :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

considering there's still a lot of my fans members still using rathena

might as well update this one

although, I'll be more focus at hercules one so over there will be more update unless being told by rathena users

1.4

-- fix getbgusers that's because bgd->members doesn't shift the index due to logout, needs to search whole array

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  187
  • Reputation:   7
  • Joined:  09/04/12
  • Last Seen:  

considering there's still a lot of my fans members still using rathena

might as well update this one

although, I'll be more focus at hercules one so over there will be more update unless being told by rathena users

1.4

-- fix getbgusers that's because bgd->members doesn't shift the index due to logout, needs to search whole array

Note: bg_kickall has been removed so no need to recycle the team ID

Does it mean used bg_destroy to instead bg_kickall (When the bg game end....) ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

yes, the old method which was

L_event_start:
	for ( .@i = 0; .@i < .total_register; .@i++ )
		setbgid ( .@i % 2 )? .red : .blue, .register_aid[.@i];
	...
	...
	end;
L_event_end:
	bg_kickall .red;
	bg_kickall .blue;
	end;
OnInit:
	.red = createbgid(...);
	.blue = createbgid(...);
	end;
is now

L_event_start:
	.red = createbgid(...);
	.blue = createbgid(...);
	for ( .@i = 0; .@i < .total_register; .@i++ )
		setbgid ( .@i % 2 )? .red : .blue, .register_aid[.@i];
	...
	...
	end;
L_event_end:
	bg_destroy .red;
	bg_destroy .blue;
	end;
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

Is it possible that on Battle Ground , you can use the SE WOE maps?

 

 

just asking.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

Is it possible that on Battle Ground , you can use the SE WOE maps?

you can use woe:se map for the battleground

however, you have to clone the map for it

because mf_battleground and mf_gvg will conflict

 

[Warning]: npc_parse_mapflag: You can't set GvG and BattleGround flags for the same map! Removing BattleGround flag from prontera in file 'npc/custom1/zzz.txt', line '340'.
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

 

Is it possible that on Battle Ground , you can use the SE WOE maps?

you can use woe:se map for the battleground

however, you have to clone the map for it

because mf_battleground and mf_gvg will conflict

 

[Warning]: npc_parse_mapflag: You can't set GvG and BattleGround flags for the same map! Removing BattleGround flag from prontera in file 'npc/custom1/zzz.txt', line '340'.

 

Good to hear that, are you up to making that kind of battleground? lol. if its paid its ok.

 

 

sorry for asking this on the wrong topic. 

Edited by Ginji
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

please do a search 'battleground' filter by name 'annieruru'

I don't want to keep repeating this already ....

and open a topic in script request section with detailed description on how you want it to be

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

please do a search 'battleground' filter by name 'annieruru'

I don't want to keep repeating this already ....

and open a topic in script request section with detailed description on how you want it to be

 

sorry. i will create a request regarding on my question.

Link to comment
Share on other sites

  • 2 years later...

  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  101
  • Reputation:   3
  • Joined:  09/15/16
  • Last Seen:  

Any update on this? i am having error with the 17102.diff

i am using the latest git

 

In file included from script.c:22164:0:
../custom/script.inc: In function ‘buildin_setbgid’:
../custom/script.inc:41:4: error: too few arguments to function ‘map_nick2sd’
    sd = map_nick2sd( script_getstr(st,3) );
    ^
In file included from script.c:31:0:
map.h:856:27: note: declared here
 struct map_session_data * map_nick2sd(const char* nick, bool allow_partial);
                           ^
make[1]: *** [obj/script.o] Error 1
 

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  12
  • Reputation:   0
  • Joined:  05/31/14
  • Last Seen:  

This works for me :D

but can i disable the auto respawn when dead?

because im doing a map with no restriction

and will use battleground for a faction system.

 

Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   0
  • Joined:  04/21/16
  • Last Seen:  

On 10/17/2012 at 8:07 AM, AnnieRuru said:

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 "[email protected] " holding all the player's account ID from the battleground team

and [email protected] is equal to bg_get_data(<battleground ID>, 0), just like [email protected]

-----------------------------------------

*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 < [email protected]; .@i++ )
setbgid ( .@i % 2 )? .red : .blue, [email protected][.@i];

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

-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 "[email protected] " holding all the player's account ID from the battleground team

and [email protected] 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 ...

difference is quite a lot

although 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

can i have the available link annie? thanks btw sorry to bother you 

Link to comment
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
Reply to this topic...

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

×
×
  • Create New...