Jump to content
  • 0
Sign in to follow this  
Helena

Annieruru chatroom BG, how to give exp reward?

Question

Hello Hercules :)

 

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? ^^

 

 

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

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0
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;
Edited by Garr

Share this post


Link to post
Share on other sites
  • 0

 

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

Share this post


Link to post
Share on other sites
  • 0

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;

Share this post


Link to post
Share on other sites
  • 0

 

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

 

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

Edited by Helena

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

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