Jump to content
  • 0

Help with a script


Yukaiii

Question


  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  110
  • Reputation:   9
  • Joined:  11/20/13
  • Last Seen:  

Guys, I wanted some tips or even some help from you...
I know this is rathena, in fact I use it and have a rathena server too..
but I'm trying to put another project of mine online, a very old project.
And I would like to ask for your help so I can fix this script.

Error: when both parties register, everything goes well in the first match, but then when you register again, instead of teleporting the entire party in case 3, you end up teleporting only 1 player, the leader.

Thank you very much for any help you may have!!

Quote

arena_room,105,93,5    script    3 vs 3 Party    822,{
    if (BaseLevel < 250 || Class==Job_Novice || Class==Job_Baby || Class==Job_Novice_High) {
    mes "[Arena Guide]";
    mes "Sorry, you need to be above level 250 or not be an Apredinz.";
close;
}
if (getpartyleader(getcharid(1),2) != getcharid(0)) {
mes "Only the Party leader can Register!"; 
close;


if (getpartymembercount(getcharid(1)) != 3 && getpartycount(getcharid(1)) != 3){
 mes "Sorry, you don't meet the requirements, check if your Party has 3 people and try again.";
close;
    }

 
getpartymember getcharid(1),0;
getpartymember getcharid(1),1;
getpartymember getcharid(1),2;
set .@count, $@partymembercount;
if(.@count < 3)
end; //Not enough members
copyarray .@charid[0],$@partymembercid[0],$@partymembercount;
//if($@partymembercount != ) end;
    for(set .@i,0; .@i < .@count; set .@i, .@i + 1){
    if( isloggedin($@partymemberaid[.@i],$@partymembercid[.@i]))
        set .@online, .@online + 1;
    }
    if(.@count != .@online){
mes" Some group member is not online!";
        close;
}    //Not all users on


mes "Welcome to 3 vs 3 Party!!!";
set .@i,0;
mes "Do you want to register?";
if ( select( "Sim", "Não" ) == 2 ) close;
else if ( .signup_count == 128 ) {
mes "Desculpe a fila está cheia";
        close;
    }
while ( .signup_aid[.@i] != getcharid(3) && .@i < .signup_count )
set .@i, .@i +1;
if ( .@i < .signup_count ) {
mes "Sua Party já está registrada.";
mes "You have ^FF0000"+(.signup_count-1)+"^000000 Parties in front of you.";
 
        close;
    }
set .signup_aid[ .signup_count ], getcharid(3);
set .signup_count, .signup_count +1;
mes "Congratulations, you are now on the waiting line for 3vs3 Party!";
mes "Your position is: ^FF0000"+(.signup_count-1)+"^000000";
dispbottom "You have  "+(.signup_count-1)+" Parties in front of you !";
    close2;
L_start:
if ( .signup_count < .min2start ) end;
for ( set .@i, 0; .@i < .signup_count; set .@i, .@i +1 ) {
if ( attachrid( .signup_aid[.@i] ) ) {
if ( getmapflag( strcharinfo(3), mf_nowarp ) ) { // player has went into another event
     deletearray .signup_aid[.@i], 1;
               set .signup_count, .signup_count -1;
                set .@i, .@i -1;
            }
        }
        else {
            deletearray .signup_aid[.@i], 1;
            set .signup_count, .signup_count -1;
            set .@i, .@i -1;
        }    
    }
if ( .start || .signup_count < .min2start ) end;
announce "A 3vs3 Match Started!", 0;
set .start, 1;
for ( set .@i, 0; .@i < .signup_count; set .@i, .@i +1 )
setbgid ( .@i %2 )? .red : .blue, .signup_aid[.@i];
deletearray .signup_aid, .min2start;
set .signup_count, .signup_count - .min2start;
bg_warp .red, "guild_vs1-1", 7,49;
bg_warp .blue, "guild_vs1-1", 92,49;
cleararray .score[1], .startingscore, 2;
bg_updatescore "guild_vs1-1", .score[1], .score[2];
sleep .eventlasting * 1000;
    if ( .start == 1 ) {
      if ( .score[1] == .score[2] )
           mapannounce "guild_vs1-1", "Empate !", 0;
        else if ( .score[1] > .score[2] ) {
            mapannounce "guild_vs1-1", " Red side wins !", 0;
            callsub L_reward, .red;
        }
        else if ( .score[1] < .score[2] ) {
            mapannounce "guild_vs1-1", " Blue side wins !", 0;
            callsub L_reward, .blue;
        }
    }
    bg_warp .red, "izlude", 128,117;
    bg_warp .blue, "izlude", 128,117;
    bg_kickall .red;
    bg_kickall .blue;
    set .start, 0;
    deletearray .score;
    goto L_start;


L_reward:
    getbgusers getarg(0);
    for ( set .@i, 0; .@i < $@arenamembersnum; set .@i, .@i +1 )
//    getitem 501, 1, $@arenamembers[.@i]; // item reward
    bg_kickall .red;
    bg_kickall .blue;
    set .start, 0;
    deletearray .score;
    warpparty "lhz_cube",66,192,getcharid(1);
    enablenpc "Partytwo";
    enablenpc "Partyone";
    goto L_start;
    return;

OnredDead: callsub L_dead, 1;
OnblueDead: callsub L_dead, 2;

L_dead:
    set .score[ getarg(0) ], .score[ getarg(0) ] -1;
    bg_updatescore "guild_vs1-1", .score[1], .score[2];
    if ( !.score[ getarg(0) ] )
        awake strnpcinfo(0);
    sleep2 1250;
    percentheal 100,100;
    end;
 
OnredQuit: callsub L_quit, 1, .red;
OnblueQuit: callsub L_quit, 2, .blue;
L_quit:
 
    if ( bg_get_data( getarg(1), 0 ) ) end;
    set .score[ getarg(0) ], 0;
    awake strnpcinfo(0);
end;
 
 
 
 
OnInit:
    set .eventlasting, 100 * 60; // how long would the event last or it auto-reset. 30 *60 = 30 mins
    set .min2start, 2; // minimum player to start
    set .startingscore, 6; // score at start
    set .red, createbgid( "guild_vs1-1", 7,49, strnpcinfo(0)+"::OnredQuit", strnpcinfo(0)+"::OnredDead" );
    set .blue, createbgid( "guild_vs1-1", 92,49, strnpcinfo(0)+"::OnblueQuit", strnpcinfo(0)+"::OnblueDead" );
    set $psvp_map$,"guild_vs1-1";
    set $pvsp_grupo1,0;
    set $pvsp_grupo2,0;
    set $pvsp_kill1,0;
    set $pvsp_kill2,0;
    end;
 

OnPCKillEvent:
if(strcharinfo(3) == $psvp_map$)
 {
         if(getcharid(1) == $pvsp_grupo1)
     {
           set $pvsp_kill1,$pvsp_kill1+1;
            mapannounce $psvp_map$,"Party  ["+getpartyname($pvsp_grupo1)+"] Matou "+$pvsp_kill1+"/3 Membros da  Party ["+getpartyname($pvsp_grupo2)+"]!",bc_all;

           }
 
        if(getcharid(1) == $pvsp_grupo2)
            {
            set $pvsp_kill2,$pvsp_kill2+1;
            mapannounce $psvp_map$,"Party ["+getpartyname($pvsp_grupo2)+"] Matou "+$pvsp_kill2+"/3 Membros da Party ["+getpartyname($pvsp_grupo1)+"]!",bc_all;

       }
        if($pvsp_kill1 == 3)
            {
            announce "[3 vs 3] Party ["+getpartyname($pvsp_grupo1)+"] è a vencedora !",bc_all;
sleep 3000;
mapwarp "guild_vs1-1","lhz_cube",66,192;
    callsub L_reward, .red;
        }
 
        if($pvsp_kill2 == 3)
            {
           announce "[3 vs 3] Party ["+getpartyname($pvsp_grupo2)+"] é a vencedora !",bc_all;
sleep 3000;
mapwarp "guild_vs1-1","lhz_cube",66,192;
    callsub L_reward, .blue;
        }
end;
    }
}
guild_vs1-1,7,49,0    script    Partyone    139,5,5,{
 
warpparty "guild_vs1-1",7,49,getcharid(1);
set $pvsp_grupo1,0;
set $pvsp_kill1,0;
if($pvsp_grupo1 == 0) set $pvsp_grupo1,getcharid(1);
sleep 1000;
disablenpc "Partyone";
end;
}
guild_vs1-1,92,49,0    script    Partytwo    139,5,5,{
set $pvsp_grupo2,0;
set $pvsp_kill2,0;
warpparty "guild_vs1-1",92,49,getcharid(1);
if($pvsp_grupo2 == 0) set $pvsp_grupo2,getcharid(1);
sleep 1000;
disablenpc "Partytwo";
end;
}

lhz_cube,66,192,3    script    partyvsparty0    139,5,5,{

if(getcharid(1) == $pvsp_grupo1)
               {
getitem 20043,3;
warp "arena_room",99,88;


    close;
     }
 
if(getcharid(1) == $pvsp_grupo2)
            {
getitem 20043,3;
warp "arena_room",99,88;

close;
      }

}

-    script    Remove_Buffs3    -1,{

OnPCLoadMapEvent:

if(strcharinfo(2) == "guild_vs1-1" || strcharinfo(2) == "guild_vs1-2" ){
sc_end -1;
}
end;

OnPCDieEvent:
    getmapxy(@map$,$@x,$@y,0);
    if (@map$ == "guild_vs1-1") {
    sleep2 1;
    atcommand "@alive";
    warp "prontera",156,191;
    end;
}
}

guild_vs1-1    mapflag    nosave    SavePoint
guild_vs1-1    mapflag    nowarp
guild_vs1-1    mapflag    nowarpto
guild_vs1-1    mapflag    noteleport
guild_vs1-1    mapflag    nomemo
guild_vs1-1    mapflag    nopenalty
guild_vs1-1    mapflag    nobranch
guild_vs1-1    mapflag    noicewall
guild_vs1-1    mapflag    pvp

guild_vs1-1    mapflag    noexp
guild_vs1-1    mapflag    noreturn
guild_vs1-1    mapflag    pvp_noguild

 

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

I'm just now seeing this and don't have the time to test things out, but I've had problems warping players with similar BG scripts. I can't exactly remember what the problem was because its been years, but you should try collecting all of the players cids/aids for each team and then warping them individually instead of mapwarp/partywarp.

 

 

  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  110
  • Reputation:   9
  • Joined:  11/20/13
  • Last Seen:  

10 hours ago, Skorm said:

I'm just now seeing this and don't have the time to test things out, but I've had problems warping players with similar BG scripts. I can't exactly remember what the problem was because its been years, but you should try collecting all of the players cids/aids for each team and then warping them individually instead of mapwarp/partywarp.

 

 

I'll be testing it later, thanks for the tip friend.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  110
  • Reputation:   9
  • Joined:  11/20/13
  • Last Seen:  

On 3/25/2024 at 11:18 PM, Skorm said:

I'm just now seeing this and don't have the time to test things out, but I've had problems warping players with similar BG scripts. I can't exactly remember what the problem was because its been years, but you should try collecting all of the players cids/aids for each team and then warping them individually instead of mapwarp/partywarp.

 

 

I tried it without success my friend..

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  110
  • Reputation:   9
  • Joined:  11/20/13
  • Last Seen:  

[Erro]: script_rid2sd: erro fatal! no associated players!
[Depurar]: Function: getcharid (1 parametro):
[Depurar]: Dado: number value=1
[Depurar]: Source (NPC): 3 vs 3 Party on arena_room (105,93)

 

I'm having this error and these warnings as soon as a game ends...
Then when I register again, only the party leaders enter..

I added all the code to the sorce... everything is fine, the only problem I've been encountering is this...

 

 

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  896
  • Reputation:   117
  • Joined:  05/23/12
  • Last Seen:  

Why u don't use the instances?

 

Rynbef~

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  110
  • Reputation:   9
  • Joined:  11/20/13
  • Last Seen:  

4 hours ago, Rynbef said:

Why u don't use the instances?

 

Rynbef~

How would I do this to myself?
I don't have much knowledge..

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  896
  • Reputation:   117
  • Joined:  05/23/12
  • Last Seen:  

In doc or NPC folder u will find much examples.

 

Rynbef~

Edited by Rynbef
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
Answer this question...

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