Jump to content
AnnieRuru

[Outdated] battleground system without waitingroom

Recommended Posts

This plugin has outdated

Haru has already fixed queue iterator script command

this plugin is no longer needed

 

sample battleground script using queue iterator

http://upaste.me/ab3022385d0127b7f

 


 

outdated topics from eathena or rathena

this one is more update

 

Download: 1.5

plugin

 

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

 

*createbgid , , , , ;

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 {, };

*setbgid {, };

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

 

for debugging purposes

this command can return 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 srcmapbattleground.h

-3: player not found ... happens when the input is not online or not found

-5: the player already join the battleground ID that you specify

 

if the player has joined battleground ID 3, and you use setbgid 5;

this will force the player to leave battleground ID 3 and join battleground ID 5 without any notification

( player who same group will receive a message mention that "player xxx leaving battlefield" )

only when the player joined bg ID 9, and use setbgid 9; 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

warpwaitingpc "guild_vs3", 0,0;for ( .@i = 0; .@i < $@warpwaitingpcnum; .@i++ )setbgid ( .@i % 2 )? .red : .blue, $@warpwaitingpc[.@i];
.

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

 

*getbgusers ;

similar to getpartymember , 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(, 0), just like $@partymembercount

getbgusers .red;for ( .@i = 0; .@i < $@arenamembersnum; .@i++ )getitem 501, 1, $@arenamembers[.@i];
.

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

 

sample script

http://upaste.me/7de710709dbb6fa17

 

example script for reference material

default battleground system using waitingroom, works in clean rathena/hercules

http://upaste.me/497010755d3295805

this script using this custom script commands

http://upaste.me/b2781075699b0f8d9

you can tell it really does make the script shorter

 

 

1.3

plugin

patch

 

1.4

plugin

patch

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

 

1.5

plugin

-- update to latest hercules plugin format

 

Edited by AnnieRuru

Share this post


Link to post
Share on other sites

I'm having a very tricky error here, sometimes (not always) the variable: $@arenamembersnum returns 0, but I'm sure it was to return a value greater than 0, as it is not a frequent mistake is playing hard to get, but it happens randomly, is there any way to fix this?
 
Grateful.

Share this post


Link to post
Share on other sites

sometimes (not always) the variable: $@arenamembersnum returns 0, but I'm sure it was to return a value greater than 0, as it is not a frequent mistake is playing hard to get, but it happens randomly, is there any way to fix this?

I have never encounter this issue

though most likely its your script issue ...

try post the script or send into my PM

Share this post


Link to post
Share on other sites

apparently this is indeed a bug in the source which I have no idea how to fix'em

 

http://upaste.me/6fb3d0

I multi 4 clients

2 players in team Red, 2 players in team Blue

now try to log off one of them, let's say team Red

the team Red will have bg_get_data as 1, which is correct, but $@arenamembersnum as 0 which is wrong

 

don't tell me this is another bug produced from battleground queue system

Share this post


Link to post
Share on other sites

If I understood your code right problem should be here:

for ( i = 0; bgd->members[i].sd; i++ )                mapreg->setreg( reference_uid( script->add_str("$@arenamembers"), i ), bgd->members[i].sd->bl.id );

As I understood it's supposed to add in members until there'll be no id in next member, the problem is:

int bg_team_leave(struct map_session_data *sd, enum bg_team_leave_type flag) {...	ARR_FIND(0, MAX_BG_MEMBERS, i, bgd->members[i].sd == sd);	if( i < MAX_BG_MEMBERS ) { // Removes member from BG		if( sd->bg_queue.arena ) {			bg->queue_pc_cleanup(sd);			pc->setpos(sd,bgd->members[i].source.map, bgd->members[i].source.x, bgd->members[i].source.y, CLR_OUTSIGHT);		}		memset(&bgd->members[i], 0, sizeof(bgd->members[0]));	}...}

The leaving member can have any index in array, including index 0, which will result in $@arenamembersnum staying 0.

 

Oor I may be completely wrong since I never even learned C++ and playing with server code is my first attempt ever >.>

Share this post


Link to post
Share on other sites

yes thanks to both of you

its my source code that's bug

2 players in team Red, 2 players in team Blue

now try to log off one of them, let's say team Red

the team Red will have bg_get_data as 1, which is correct, but $@arenamembersnum as 0 which is wrong

let's say team Red has 2 players which is AnnieRuru and EnnyRuru

1. AnnieRuru

2. EnnyRuru

when AnnieRuru logs out it will be

1.

2. EnnyRuru

 

it doesn't automatically shift the index

so my getbgusers has to search the whole array and count them 1 by 1

Share this post


Link to post
Share on other sites

This topic now mark as outdated
Haru fixed the queue iterator script commands
so its no longer needed for this kind of modification

sample battleground queue script
http://upaste.me/ab3022385d0127b7f
.


.
@@Quazi
I just noticed you changed .score[1] into .score[10]
no wonder you got that error
OnRedDead:  callsub L_Dead, 1;OnBlueDead: callsub L_Dead, 2;L_Dead:	....	.score[ getarg(0) ]--;

if you want to change into 10, then the callsub should also has the argument change to 10

Share this post


Link to post
Share on other sites

Would we have how to put KVM in this script?
I thought it was beautiful.

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

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