Jump to content
  • 0

custom_bg script not working


caspa

Question


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

	-    script    custom_bg#control    -1,{
OnInit:
    set .minplayer2start, 2; // minimum player to start
    setarray .rewarditem,
        23108,20, // reward to the winning team
        23108,10; // reward to the losing team
    set .startingscore, 99; // score at start
    set .eventlasting, 120; // event last 100 seconds
    end;
	OnStart:
    if ( getwaitingroomstate( 0, ".red1npcname$" ) < .minplayer2start || getwaitingroomstate( 0, ".blue1npcname$" ) < .minplayer2start ) end;
    set .red1, waitingroom2bg( "endless_war",64,86, strnpcinfo(0)+"::OnredQuit", strnpcinfo(0)+"::OnredDead", ".red1npcname$" );
    copyarray .team11aid[.@i], $@arenamembers[.@i], $@arenamembersnum;
    set .blue1, waitingroom2bg( "endless_war",191,86, strnpcinfo(0)+"::OnblueQuit", strnpcinfo(0)+"::OnblueDead", ".blue1npcname$" );
    copyarray .team22aid[.@i], $@arenamembers[.@i], $@arenamembersnum;
    delwaitingroom ".red1npcname$";
    delwaitingroom ".blue1npcname$";
    disablenpc .red1npcname$;
    disablenpc .blue1npcname$;
    bg_warp .red1, "endless_war", 64,86;
    bg_warp .blue1, "endless_war", 191,86;
    sleep2 3000;
    mapannounce "endless_war", "[Clan War] : Clan with most kills within 2 mins wins!",0;
    set .score[1], .startingscore;
    set .score[2], .startingscore;
    bg_updatescore "endless_war", .score[1], .score[2];
    sleep .eventlasting * 1000;
    if ( .score[1] == .score[2] )
        mapannounce "endless_war", "[Clan War] : The war has been declared draw!",0;
    else if ( .score[1] > .score[2] ) {
        mapannounce "endless_war", "[Clan War] : The Troll Clan has won the war!", 0;
        callsub L_reward, 1, 0;
        callsub L_reward, 2, 2;
    }
    else if ( .score[1] < .score[2] ) {
        mapannounce "endless_war", "[Clan War] : The Fairy Clan has won the war!", 0;
        callsub L_reward, 2, 0;
        callsub L_reward, 1, 2;
    }
    bg_warp .red1, "crystilia" ,68,77;
    bg_warp .blue1, "mellina", 70,72;
    bg_destroy .red1;
    bg_destroy .blue1;
    enablenpc .red1npcname$;
    enablenpc .blue1npcname$;
    donpcevent ".red1npcname$::OnStart";
    donpcevent ".blue1npcname$::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;
	OnredDead: callsub L_dead, 1;
OnblueDead: callsub L_dead, 2;
L_dead:
    set .score[ getarg(0) ], .score[ getarg(0) ] -1;
    bg_updatescore "endless_war", .score[1], .score[2];
    if ( .score[ getarg(0) ] == 0 )
    awake strnpcinfo(0);
    end;
	OnredQuit: callsub L_quit, 1, .red1;
OnblueQuit: callsub L_quit, 2, .blue1;
	L_quit:
    if ( bg_get_data( getarg(1), 0) ) end;
    set .score[ getarg(0) ], 0;
    awake strnpcinfo(0);
    end;
}
	crystilia,62,87,5    script    Troll Clan #custom_bg    468,{
    end;
	OnInit:
    sleep 1;
    set getvariableofnpc( .red1npcname$, "custom_bg#control" ), strnpcinfo(0);
	OnStart:
    waitingroom "Kill War", getvariableofnpc( .minplayer2start, "custom_bg#control" ), strnpcinfo(0)+"::OnJoin",1;
    end;
	OnJoin:
announce "[Clan War] : Troll Clan side has ["+ getwaitingroomstate(0) +"/"+ getvariableofnpc( .minplayer2start, "custom_bg#control" ) +"] Users. ( Kill War )",0;
    donpcevent "custom_bg#control::OnStart";
    end;
	//OnInit:
//    waitingroom "Kill War", getvariableofnpc( .minplayer2start, "custom_bg#control" ), "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );
//    end;
}
mellina,63,74,5    script    Fairy Clan #custom_bg    435,{
    end;
	OnInit:
    sleep 1;
    set getvariableofnpc( .blue1npcname$, "custom_bg#control" ), strnpcinfo(0);
	OnStart:
    waitingroom "Kill War", getvariableofnpc( .minplayer2start, "custom_bg#control" ), strnpcinfo(0)+"::OnJoin",1;
    end;
	OnJoin:
announce "[Clan War] : Fairy Clan side has ["+ getwaitingroomstate(0) +"/"+ getvariableofnpc( .minplayer2start, "custom_bg#control" ) +"] Users. ( Kill War )",0;
    donpcevent "custom_bg#control::OnStart";
    end;
//OnInit:
//    waitingroom "Kill War", getvariableofnpc( .minplayer2start, "custom_bg#control" ), "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );
//    end;
}
endless_war    mapflag    battleground    2
endless_war    mapflag    nosave    SavePoint
endless_war    mapflag    nowarp
endless_war    mapflag    nowarpto
endless_war    mapflag    noteleport
endless_war    mapflag    nomemo
endless_war    mapflag    nopenalty
endless_war    mapflag    nobranch
endless_war    mapflag    noicewall



does anybody have any idea why this script it not working? or is there any some kind of mistake here? when the minimum required player is set like 2/2 and the other side has 2/2 also... it doesnt do anything.. like the it doesn't warp me to the endless_war area?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  618
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

Not an expert in waiting rooms... but it could have something to do with the quotes around the npc names... ".test$" it ".test$" not "value of .test$" ...

Just a thought ? There are SEVERAL instances of that everywhere...

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

hmm ... I totally forgotten where this script came from, I can barely remember I did made this, but forgotten the search keywords already

btw although you PM me asked you to help solve this ... which I don't mind because I love making battleground scripts

but the topic you post on hercules forum and this topic seems entirely different

in other words, you are asking for 2 battleground scripts ? well fine by me, might as well just go fix both

 

let's see ... yes Z3R0 is correct

if ( getwaitingroomstate( 0, ".red1npcname$" ) < .minplayer2start || getwaitingroomstate( 0, ".blue1npcname$" ) < .minplayer2start ) end;

the ".red1npcname$" there shouldn't have double quotation mark

this should be read as an npc variable, not as a string

 

anyways, let me fix this, and as a bonus, I also add showdigit to all the players

http://upaste.me/ed8a496052650ef0a

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