Annieruru chatroom BG, how to give exp reward?

Helena

New member
Messages
238
Points
0
Emulator
rAthena
Hello Hercules
default_smile.png


I am using AnnieRuru's awesome BG script that works with chatroom entrance. 

What I have difficulties with is giving players an additional exp reward when they warp out (for both winning and losing team), if I use the getexp command it gives me a player not attached message in the mapserver.

Could anyone help me? ^^

Code:
-	script	custom_bg#control	-1,{OnInit:    set .minplayer2start, 3; // minimum player to start    setarray .rewarditem,        501, 10, // reward to the winning team        501, 5; // reward to the losing team    set .startingscore, 25; // score at start    set .eventlasting, 1800; // event last 30 mins    donpcevent "Team Eagle [Lv. 40-60]::OnStart";    donpcevent "Team Lion [Lv. 40-60]::OnStart";    end;OnStart:    if ( getwaitingroomstate( 0, "Team Lion [Lv. 40-60]" ) < .minplayer2start || getwaitingroomstate( 0, "Team Eagle [Lv. 40-60]" ) < .minplayer2start ) end;    set .Eagle, waitingroom2bg( "bgarena", 72,112, strnpcinfo(0)+"::OnEagleQuit", strnpcinfo(0)+"::OnEagleDead", "Team Eagle [Lv. 40-60]" );    copyarray .team1aid[.@i], $@arenamembers[.@i], $@arenamembersnum;    set .Lion, waitingroom2bg( "bgarena", 72,23, strnpcinfo(0)+"::OnLionQuit", strnpcinfo(0)+"::OnLionDead", "Team Lion [Lv. 40-60]" );    copyarray .team2aid[.@i], $@arenamembers[.@i], $@arenamembersnum;    delwaitingroom "Team Eagle [Lv. 40-60]";    delwaitingroom "Team Lion [Lv. 40-60]";    bg_warp .Eagle, "bgarena", 72,112;    bg_warp .Lion, "bgarena", 71,23;    set .score[1], .startingscore;    set .score[2], .startingscore;    bg_updatescore "bgarena", .score[1], .score[2];    sleep .eventlasting * 1000;    if ( .score[1] == .score[2] )        mapannounce "bgarena", "Battlegrounds: The Battlegrounds was has ended with an equal score!", 0;    else if ( .score[1] > .score[2] ) {        mapannounce "bgarena", "Battlegrounds: Team Lion has won this Battlegrounds match!", 0;        callsub L_reward, 1, 0;        callsub L_reward, 2, 2;    }    else if ( .score[1] < .score[2] ) {        mapannounce "bgarena", "Battlegrounds: Team Eagle has won this Battlegrounds match!", 0;        callsub L_reward, 2, 0;        callsub L_reward, 1, 2;    }sleep2 500;    bg_warp .Eagle, "prontera", 128,204;    bg_warp .Lion, "prontera", 138,204;    bg_destroy .Eagle;    bg_destroy .Lion;    donpcevent "Team Eagle [Lv. 40-60]::OnStart";    donpcevent "Team Lion [Lv. 40-60]::OnStart";    end;L_reward:    set .@size, getarraysize( getd(".team"+ getarg(0) +"aid") );    for ( set .@i, 0; .@i < .@size; set .@i, .@i +1 )        if ( isloggedin( getd(".team"+ getarg(0) +"aid["+ .@i +"]" ) ) )            getitem .rewarditem[ getarg(1) ], .rewarditem[ getarg(1) +1 ], getd(".team"+ getarg(0) +"aid["+ .@i +"]" );    return;OnEagleDead: callsub L_dead, 1;OnLionDead: callsub L_dead, 2;L_dead:    set .score[ getarg(0) ], .score[ getarg(0) ] -1;    bg_updatescore "bgarena", .score[1], .score[2];    if ( .score[ getarg(0) ] == 0 )        awake strnpcinfo(0);	percentheal 100,100;    end;OnEagleQuit: callsub L_quit, 1, .Eagle;OnLionQuit: callsub L_quit, 2, .Lion;L_quit:    if ( bg_get_data( getarg(1), 0) ) end;    set .score[ getarg(0) ], 0;    awake strnpcinfo(0);	percentheal 100,100;    end;}job_knt,144,167,5	script	Team Lion [Lv. 40-60]	100,{    end;OnStart:    waitingroom "Team Eagle [Lv. 40-60]", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );    end;}job_sage,115,111,5	script	Team Eagle [Lv. 40-60]	100,{     end;OnStart:    waitingroom "Team Lion [Lv. 40-60]", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );    end;}
 
Code:
L_reward:    set .@size, getarraysize( getd(".team"+ getarg(0) +"aid") );    for ( set .@i, 0; .@i < .@size; set .@i, .@i +1 )        if ( isloggedin( getd(".team"+ getarg(0) +"aid["+ .@i +"]" ) ) )  {            getitem .rewarditem[ getarg(1) ], .rewarditem[ getarg(1) +1 ], getd(".team"+ getarg(0) +"aid["+ .@i +"]" );            getexp 200000,200000;        }    return;
 
Last edited by a moderator:
L_reward: set .@size, getarraysize( getd(".team"+ getarg(0) +"aid") ); for ( set .@i, 0; .@i < .@size; set .@i, .@i +1 ) if ( isloggedin( getd(".team"+ getarg(0) +"aid["+ .@i +"]" ) ) ) { getitem .rewarditem[ getarg(1) ], .rewarditem[ getarg(1) +1 ], getd(".team"+ getarg(0) +"aid["+ .@i +"]" ); getexp 200000,200000; } return;
The same error. Player not attached.
default_sad.png


 
Ah, didn't see that it's not attaching rid. Sorry.

Code:
L_reward:    set .@size, getarraysize( getd(".team"+ getarg(0) +"aid") );    for ( set .@i, 0; .@i < .@size; set .@i, .@i +1 )        if ( isloggedin( getd(".team"+ getarg(0) +"aid["+ .@i +"]" ) ) )  {            getitem .rewarditem[ getarg(1) ], .rewarditem[ getarg(1) +1 ], getd(".team"+ getarg(0) +"aid["+ .@i +"]" );            attachrid getd(".team"+ getarg(0) +"aid["+ .@i +"]" );            getexp 200000,200000;            detachrid;        }    return;
 
Ah, didn't see that it's not attaching rid. Sorry.

L_reward: set .@size, getarraysize( getd(".team"+ getarg(0) +"aid") ); for ( set .@i, 0; .@i < .@size; set .@i, .@i +1 ) if ( isloggedin( getd(".team"+ getarg(0) +"aid["+ .@i +"]" ) ) ) { getitem .rewarditem[ getarg(1) ], .rewarditem[ getarg(1) +1 ], getd(".team"+ getarg(0) +"aid["+ .@i +"]" ); attachrid getd(".team"+ getarg(0) +"aid["+ .@i +"]" ); getexp 200000,200000; detachrid; } return;
For some reason it still tells me not attached.
default_sad.png


*edit* my bad it doesn't. it says "script:getarg: no callfunc or callsub"

 
Last edited by a moderator:
Back
Top