- 0
[resolved] I'm trying to create the command @joinbg, but I can't release the command for all maps
Asked by
Tdi123
-
Recently Browsing 0 members
- No registered users viewing this page.
Asked by
Tdi123
By using this site, you agree to our Terms of Use and Privacy Policy.
SCRIPT:
function script F_ShuffleNumbers { deletearray getarg(2); [email protected] = getarg(0); [email protected] = getarg(1) +1 - [email protected]; [email protected] = getarg(3, [email protected]); if ([email protected] <= 0 || [email protected] <= 0) return 0; if ([email protected] > [email protected]) [email protected] = [email protected]; for ([email protected] = 0; [email protected] < [email protected]; [email protected]) [email protected][[email protected]] = [email protected]; for ([email protected] = 0; [email protected] < [email protected]; [email protected]) { [email protected] = rand([email protected]); set getelementofarray( getarg(2), [email protected] ), [email protected][[email protected]] + [email protected]; [email protected][[email protected]] = [email protected][[email protected]]; } return [email protected]; } - script RegistroBG -1,{ OnJoinBG: [email protected]$ = strcharinfo(0); [email protected] = getvariableofnpc(.minplayer2start, "fortress#bg"); [email protected] = getvariableofnpc(.start, "fortress#bg"); if([email protected] == 1) { dispbottom "Batalha Campal : Desculpe, a bg está em andamento."; end; } while ( .aid[[email protected]] != getcharid(3) && [email protected] < .size ) [email protected]; if ( [email protected] < .size ) { dispbottom "Batalha Campal : Por favor, aguarde a batalha começar."; end; } if (BaseLevel < 300) { dispbottom "Batalha Campal : Apenas jogadores de nível 300 podem participar da Batalha Campal!"; end; } if( agitcheck() || agitcheck2() ){ dispbottom "Batalha Campal : Neste momento a Guerra do Emperium está ativa e não é possível se inscrever na Batalha Campal!"; end; } dispbottom "Batalha Campal : Por favor, permaneça no mapa atual para participar!"; .aid[ .size++ ] = getcharid(3); for ( [email protected] = 0; [email protected] < .size; [email protected] ) { if ( !isloggedin( .aid[[email protected]] ) ) { deletearray .aid[[email protected]], 1; [email protected]; --.size; } else { attachrid .aid[[email protected]]; if ( strcharinfo(3) != strnpcinfo(4) ) { deletearray .aid[[email protected]], 1; [email protected]; --.size; } } } detachrid; if ( .size == [email protected] * 2 ) { copyarray getvariableofnpc( .aid_, "fortress#bg" ), .aid, .size; donpcevent "fortress#bg::OnStart"; deletearray .aid; .size = 0; } else announce [email protected]$ +" se inscreveu na Batalha Campal... ainda restam "+ .size +"/"+ [email protected] * 2 +" vagas para começar.", bc_npc | bc_all; end; OnInit: bindatcmd("joinbg",strnpcinfo(0)+"::OnJoinBG",0,99); end; } - script fortress#bg -1,{ OnInit: // ============= // Game Settings // ============= // Minimum players per team to start // default : 5 ( 5v5 ) .minplayer2start = 1; // Event duration in minutes.. // default : 5 mins .duration = 5; // Reward settings setarray .rwd[0], 7773, 5, // win team reward 7773, 1; // lose team reward end; OnStart: .start = 1; .red = bg_create ( strnpcinfo(4), 58, 123, strnpcinfo(0)+"::OnRedQuit", strnpcinfo(0)+"::OnRedDie" ); .blue = bg_create ( strnpcinfo(4), 141, 60, strnpcinfo(0)+"::OnBlueQuit", strnpcinfo(0)+"::OnBlueDie" ); callfunc "F_ShuffleNumbers", 0, .minplayer2start *2 -1, [email protected]; for ( [email protected] = 0; [email protected] < .minplayer2start * 2; [email protected] ) { attachrid .aid_[[email protected][[email protected]]]; bg_join ( [email protected] % 2 )? .red : .blue; } detachrid; sleep 5000; announce "Destruam a Fortaleza Principal!", bc_npc | bc_map | bc_blue; sleep 5000; announce "A Batalha durará 5 minutos!", bc_npc | bc_map | bc_blue; bg_monster 0, "bat_c01", 99, 92, "Fortaleza Principal", 1911, strnpcinfo(3)+"::OnEmpDown"; sleep .duration * 60000; if(.owner) callsub L_reward, (.owner == .red) ? .red : .blue, (.owner == .red) ? .blue : .red, (.owner == .red) ? "Red" : "Blue"; else announce "A batalha terminou em empate!", bc_npc | bc_map | bc_blue; .owner = .start = 0; bg_destroy .red; bg_destroy .blue; mapwarp strnpcinfo(4),"prontera",150,150,0; end; L_reward: announce getarg(2) +" team venceu!", bc_npc | bc_map | bc_blue; bg_get_data getarg(0), 1; for ( [email protected] = 0; [email protected] < [email protected]; [email protected] ) getitem .rwd[0],.rwd[1], [email protected][[email protected]]; sleep 1; bg_get_data getarg(1), 1; for ( [email protected] = 0; [email protected] < [email protected]; [email protected] ) getitem .rwd[2],.rwd[3], [email protected][[email protected]]; return; OnEmpDown: .owner = getcharid(4); announce ((getcharid(4) == .red) ? "Red": "Blue") +" Team conquistou a Fortaleza Principal!", bc_npc | bc_map | bc_blue; bg_warp .red, strnpcinfo(4), 58, 123; bg_warp .blue, strnpcinfo(4), 141, 60; bg_monster .owner, "bat_c01", 99, 92, "Fortaleza Principal", (getcharid(4) == .red) ? 1912 : 1913, strnpcinfo(3)+"::OnEmpDown"; //setnpcdisplay("#mainfort", "Fortaleza Principal", (getcharid(4) == .red) ? 1912 : 1913 ); end; OnRedQuit: callsub L_Quit, .red, "Red"; OnBlueQuit: callsub L_Quit, .blue, "Blue"; L_Quit: if ( bg_get_data( getarg(0), 0 ) ) end; announce "Todos "+ getarg(2) +" team membros saíram!", bc_npc | bc_map | bc_blue; sleep 1000; callsub L_reward, ( getarg(0) == .red ) ? .red : .blue, ( getarg(0) == .red ) ? .blue : .red, ( getarg(0) == .red ) ? "Red" : "Blue"; awake instance_npcname( strnpcinfo(0) ); end; OnRedDie: OnBlueDie: sleep2 1250; percentheal 100, 100; end; } bat_c01,99,92,0 script #mainfort -1,5,5,{ end; OnTouch: getmapxy([email protected]$, [email protected], [email protected], BL_NPC, strnpcinfo(3)); setarray [email protected]_mapx[0], [email protected], [email protected]+5; setarray [email protected]_mapy[0], [email protected], [email protected]+5; @ontouch = 1; [email protected] = getvariableofnpc( .owner, "fortress#bg" ); while ( @ontouch && strcharinfo(3) == strnpcinfo(4) ) { if( [email protected] != getcharid(4) ) { if ( Hp > 1 ) percentheal -10, 0; else percentheal -100, 0; specialeffect2 49; } else if ( [email protected] == getcharid(4) ) { if ( Hp != MaxHP ) specialeffect2 EF_HEAL; percentheal 10, 10; } sleep2 1000; getmapxy(@mapname$, @mapx, @mapy, BL_PC); if ( @mapx < [email protected]_mapx[0] || @mapx > [email protected]_mapx[1] || @mapy < [email protected]_mapy[0] || @mapy > [email protected]_mapy[1]) { @ontouch = 0; } } end; } bat_c01,55,126,0 script #redminifort 1915,5,5,{ end; OnTouch: getmapxy([email protected]$, [email protected], [email protected], BL_NPC, strnpcinfo(3)); setarray [email protected]_mapx[0], [email protected], [email protected]+5; setarray [email protected]_mapy[0], [email protected], [email protected]+5; [email protected] = getvariableofnpc( .red, "fortress#bg" ); @ontouch = 1; while ( @ontouch && strcharinfo(3) == strnpcinfo(4) ) { if ( [email protected] != getcharid(4) ) { if ( Hp > 10 ) percentheal rand(-20,-40), 0; else percentheal -100, 0; specialeffect2 49; } else { if( HP != MaxHP ) specialeffect2 EF_HEAL; percentheal 10, 10; } sleep2 1000; getmapxy(@mapname$, @mapx, @mapy, BL_PC); if ( @mapx < [email protected]_mapx[0] || @mapx > [email protected]_mapx[1] || @mapy < [email protected]_mapy[0] || @mapy > [email protected]_mapy[1]) { @ontouch = 0; } } end; } bat_c01,144,57,0 script #blueminifort 1914,5,5,{ end; OnTouch: getmapxy([email protected]$, [email protected], [email protected], BL_NPC, strnpcinfo(3)); setarray [email protected]_mapx[0], [email protected], [email protected]+5; setarray [email protected]_mapy[0], [email protected], [email protected]+5; [email protected] = getvariableofnpc( .blue, "fortress#bg" ); @ontouch = 1; while ( @ontouch && strcharinfo(3) == strnpcinfo(4) ) { if ( [email protected] != getcharid(4) ) { if ( Hp > 10 ) percentheal rand(-20,-40), 0; else percentheal -100, 0; specialeffect2 49; } else { if( HP != MaxHP ) specialeffect2 EF_HEAL; percentheal 10, 10; } sleep2 1000; getmapxy(@mapname$, @mapx, @mapy, BL_PC); if ( @mapx < [email protected]_mapx[0] || @mapx > [email protected]_mapx[1] || @mapy < [email protected]_mapy[0] || @mapy > [email protected]_mapy[1]) { @ontouch = 0; } } end; } bat_c01 mapflag battleground 2 bat_c01 mapflag nosave SavePoint bat_c01 mapflag nowarp bat_c01 mapflag nowarpto bat_c01 mapflag noteleport bat_c01 mapflag nomemo bat_c01 mapflag nopenalty bat_c01 mapflag nobranch bat_c01 mapflag noicewallIf I put the map name + the coordinate, the npc works only on the npc map, example:
prontera,0,0,0 script RegistroBG 100,{
OnJoinBG:
So, it will only work on the prontera map
I wanted to release the command for all maps
Thank you for your help now!
Edited by Tdi123Link to comment
Share on other sites