Jump to content
Break

Стенка на стенку

Recommended Posts

Дело в том, что когда нечетное кол-во игроков на карте, то разделение идет между четным кол-вом, а нечетный остается в центре карты не попадая ни в одну из пати, что в таком случае нужно сделать?

function script nashest36 {
mapusersid("pvp_n_1-5");
leaveparty([email protected][0],getarraysize([email protected]));
set [email protected]_member,(getmapusers("pvp_n_1-5")/2);
copyarray [email protected]_group1[0],[email protected][0],[email protected]_member;
copyarray [email protected]_group2[0],[email protected][[email protected]_member],[email protected]_member;

sleep 2000;

set [email protected],rand(1,100);
createparty("Blue "[email protected],[email protected]_group1);
set [email protected]_pt1,getarraysize([email protected]_group1);
createparty("Red "[email protected],[email protected]_group2);
set [email protected]_pt2,getarraysize([email protected]_group2);

sleep 2000;

if(getmapusers("pvp_n_1-5")>2 && getmapusers("pvp_n_1-5")<4) {
inviteparty([email protected]_group2[0],[email protected]_member);}

else if (getmapusers("pvp_n_1-5")>3) {
inviteparty([email protected]_group1[0],[email protected]_member);
inviteparty([email protected]_group2[0],[email protected]_member);}

for (set .i, 0; .i < [email protected]_member; set .i, .i+1) {
warpchar "pvp_n_1-5",66,100,[email protected]_group1[.i];
warpchar "pvp_n_1-5",136,100,[email protected]_group2[.i];}
pvpon "pvp_n_1-5";
}

pvp_n_1-5,99,103,5 script Stenka_test 800,{
callfunc "nashest36";
close;
}

Edited by mrboob
Link to comment
Share on other sites

Ещё раз - что? )

На примере объясни.

Что тут непонятного? Распределение игроков на карте идёт по ровну в две пати, если же игроков нечетное кол-во, то один всегда остаётся без пати... Допустим на карте 5 человек, из них 4 распределяет по 2 человека в каждую пати и 1 в пролёте получается =/

Edited by mrboob
Link to comment
Share on other sites

Эм, ну так и

что в таком случае нужно сделать?

Формулируй вопросы конкретно.

К тому же, команды

mapusersid("pvp_n_1-5");

leaveparty([email protected][0],getarraysize([email protected]));

не являются стандартными в rA, какие функции и каким образом они их выполняют нам не известно =\

Edited by Lilith
Link to comment
Share on other sites

Обьяснить не могу что они выполняют, т.к не я эти скриптовые команды писал, лишь догадки только...

Вот сам код, если разберетесь

BUILDIN_FUNC(mapusersid)
{
int m = map_mapname2mapid(script_getstr(st,2)),users = 0;
struct s_mapiterator* iter;
TBL_PC *sd;

if (m < 0)
{ script_pushint(st,-1); return 0; }

iter = mapit_getallusers();

for (sd = (TBL_PC*)mapit_first(iter);mapit_exists(iter);sd = (TBL_PC*)mapit_next(iter))
if ((sd->bl.m == m) && (!pc_isdead(sd))) {
mapreg_setreg(add_str("[email protected]") + (users<<24), sd->status.char_id);
mapreg_setregstr(add_str("[email protected]$")+(users<<24),sd->status.name);
users++;}

mapit_free(iter);
return 0;
}


BUILDIN_FUNC(leaveparty)
{
struct script_data* data;
int32 id;
int32 idx;
int32 i;
int32 n;
int32 arr[256];

struct map_session_data *sd;

data = script_getdata(st, 2);

id = reference_getid(data);
idx = reference_getindex(data);

n = script_getnum(st, 3);

for( i = 0; i < n; ++i )
{
arr[i]=(int32)get_val2(st, reference_uid(id, idx + i), reference_getref(data));
script_removetop(st, -1, 0);
if (((sd=map_charid2sd(arr[i])) != NULL ) && sd->status.party_id) { party_leave(sd); }
}

return 0;
}
BUILDIN_DEF(mapusersid,"s"), //NetherRO
BUILDIN_DEF(leaveparty,"ri"), //YXAZA

Edited by mrboob
Link to comment
Share on other sites

Пробуй по такому примеру распределить ID персонажей в массивы:

[email protected] = 0;
for([email protected]=0; [email protected]< getarraysize([email protected]); [email protected]+=2)
{
[email protected]_group1[[email protected]] = [email protected][[email protected]];
[email protected]_group2[[email protected]] = [email protected][[email protected]+1];
[email protected]++;
}

Только этим не отделаешься и скриптик придётся подредактировать.

EDIT:

Как то так...

function script nashest36 {
mapusersid("pvp_n_1-5");
leaveparty([email protected][0],getarraysize([email protected]));
[email protected] = 0;
for([email protected]=0; [email protected]<getarraysize([email protected]); [email protected]+=2)
{
[email protected]_group1[[email protected]] = [email protected][[email protected]];
[email protected]_group2[[email protected]] = [email protected][[email protected]+1];
[email protected]++;
}

sleep 2000;

set [email protected],rand(1,100);
createparty("Blue "[email protected],[email protected]_group1);
set [email protected]_pt1,getarraysize([email protected]_group1);
createparty("Red "[email protected],[email protected]_group2);
set [email protected]_pt2,getarraysize([email protected]_group2);

sleep 2000;

if (getmapusers("pvp_n_1-5")>3)
{
inviteparty([email protected]_group1[0],getarraysize([email protected]_group1);
inviteparty([email protected]_group2[0],getarraysize([email protected]_group2);
}

for ([email protected]=0; [email protected] < getarraysize([email protected]_group1); [email protected]++)
{
warpchar "pvp_n_1-5",66,100,[email protected]_group1[.i];
warpchar "pvp_n_1-5",136,100,[email protected]_group2[.i];
}
pvpon "pvp_n_1-5";
}

pvp_n_1-5,99,103,5 script Stenka_test 800,{
callfunc "nashest36";
close;
}

Исходников команд inviteparty и createparty у меня нет, поэтому правил интуитивно.

Edited by Lilith
  • Upvote 1
Link to comment
Share on other sites

За старания конечно спасибо, но к сожалению не работает :(

Вот остальные исходники, может помогут)

BUILDIN_FUNC(createparty)
{
char* nombre; //Genera un warning C4090
int cid;
TBL_PC* sd;

nombre = script_getstr(st,2);
cid = script_getnum(st,3);

sd = map_charid2sd(cid); //Obtiene el map_session_data del char_id
if( sd == NULL )
{
script_pushint(st, -1);
return 0; //No estб enganchado a un usuario
}

if( sd->status.party_id > 0 || sd->party_joining || sd->party_creating )
{// already associated with a party
script_pushint(st, 0);
return 0;
}

party_create(sd, nombre, 0, 0); //Manda a crear la Party

script_pushint(st, 1);
return 0;
}

BUILDIN_FUNC(inviteparty)
{
struct script_data* data;
int32 id;
int32 idx;
int32 i;
int32 n;
int32 arr[256];

struct map_session_data *sd, *tsd;

data = script_getdata(st, 2);

id = reference_getid(data);
idx = reference_getindex(data);

n = script_getnum(st, 3);

for( i = 0; i < n; ++i )
{
arr[i]=(int32)get_val2(st, reference_uid(id, idx + i), reference_getref(data));
script_removetop(st, -1, 0);
}

sd=map_charid2sd(arr[0]);
if (sd == NULL) { return 0; }

for( i = 1; i < n; ++i )
{
tsd=map_charid2sd(arr[i]);
if (tsd == NULL) { continue; }

if (party_invite(sd,tsd)) { party_reply_invite(tsd,sd->status.account_id,1); };
}

return 0;
}
BUILDIN_DEF(inviteparty,"ri"), //YXAZA
BUILDIN_DEF(createparty,"si"),

Кстати возникла ещё одна проблема. Подскажите как правильно проверить принадлежит ли игрок одному из списков, и после этого вычитать его. Мой вариант не хочет работать.

Нужный кусок выделил тегом

prontera,0,0,0 script pvpLadder2 -1,{
OnPCDieEvent:
if (getmapxy([email protected]_map$,@mapx,@mapy,0,strcharinfo(0))!=0) end;
if ( ([email protected]_map$=="pvp_n_1-5") ){
warp "prontera",180,160;
[b]if([email protected]_group1[0]){
set [email protected]_pt1,[email protected]_pt1-1;}
if([email protected]_group2[0]){
set [email protected]_pt2,[email protected]_pt2-1;}[/b]
if([email protected]_pt1 == 0 && [email protected]_pt2 == 0) {
mapannounce "pvp_n_1-5","[Стенка на Стенку] бой завершен!!!",17;
enablenpc "SNS Prize";
set [email protected], 0;
cleararray [email protected][0],0,getarraysize([email protected]);
cleararray [email protected]_group1[0],0,getarraysize([email protected]_group1);
cleararray [email protected]_group2[0],0,getarraysize([email protected]_group2);
set [email protected]_member,0;
end;
}
mapannounce "pvp_n_1-5","Выживших - Команда Синих: "[email protected]_pt1+" Команда Красных: "[email protected]_pt2,1;
end;
}
}

Edited by mrboob
Link to comment
Share on other sites

для проверки наверно поможет это:

BUILDIN_FUNC(getpartyid)
{
   const char* nombre;
   struct party_data* pd;
   TBL_PC* sd;

   nombre = script_getstr(st,2);
   sd = script_rid2sd(st);
   if( sd == NULL )
    return 0;    //No est� enganchado a un usuario
   pd = party_searchname(nombre);    //Obtiene el party_data de la party de nombre "nombre"
   if( pd == NULL )
   {
    script_pushint(st, 0);
    return 0;    //No encontr� la party
   }
   script_pushint(st, pd->party.party_id);
   return 0;
}

Link to comment
Share on other sites

Сделал через цикл, вроде бы работает. Осталось теперь разобраться с нечетным кол-вом игроков на карте...

И да ув. Lilith просьба пишите под eAthena если вас конечно это не затруднит, а то тот код что вы выложили не работает и его пришлось переписывать под свой эмуль)

Edited by mrboob
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...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.