Jump to content
  • 0

Free For All Script Help


topechi

Question


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  52
  • Reputation:   2
  • Joined:  11/13/16
  • Last Seen:  

Hi guys! I need some help with this FFA Script please. I was hoping if someone can edit it, players will have to register to the NPC and wait for a certain time for example 3mins before all registered players be warped to the FFA Arena? And if possible, to add a announcement of the winner and reset the npc after the match with announcement that the FFA is open for register. Thanks in advance! :)

// -------------------------------------//
// ----------- Free For All ------------//
// ------------- By: Butch -------------//
// ---------- Rewrite by: Bio ----------//
//      A simple Free for all script    //
// -------------------------------------//
// ------------- Changelog -------------//
// 1.0 - The one made by Butch.         //
// 2.0 - Rewrite by Bio:                //
//       Easy Configuration             //
//       Use of Event Labels            //
//       Added Min and Max Players      //
// -------------------------------------//
 
 
// -- FFA Core
-	script	::ffa_core	FAKE_NPC,{
	end();
OnInit:
 
	// -- Configuration
	.WAITINGROOM_TEXT$ = "[Free For All]"; // Text to be displayed on Waiting Room
	.MIN_PLAYER = 5; // How many Players are needed to start
	.MAX_PLAYER = 0; // Maximum number of Players allowed. Must be higher than '1' (0 to disable this limit)
	.REWARD_PLAYER = 1; // Reward Players? Use 0 or 1 (0: off / 1: on)
	.REWARD_NAMEID = 25002; // Reward ID
	.REWARD_AMOUNT = 1; // Reward Amount
	.ANNOUNCE_COLOR$ = "0x00b89d"; // FFA announce's color
	.WINNER_DISP_COLOR$ = "0x00FFFF"; // FFA winner announce's color
	.ATCMD_NAME$ = "startffa"; // @name of atcommand to force start announce.
	.ATCMD_LEVEL = 60; // Min GroupID which can use this command.
	.ATCMD_CHRLV = 99; // Min GroupID which can use this char command.
 
	// -- Initializing
	bindatcmd(.ATCMD_NAME$,"ffa_core::OnStartEvent",.ATCMD_LEVEL, .ATCMD_CHRLV);
	.STATUS = 0; // Info: 0 - Off | 1 - Waiting for start | 2 - Running
	waitingroom(.WAITINGROOM_TEXT$, 0);
	end();
 
OnStartEvent:
	.STATUS = 1;
	announce("Free for all will start in 1 minute.", bc_all, .ANNOUNCE_COLOR$);
	sleep(60000);
	if ( getmapusers("guild_vs5") >= .MIN_PLAYER ) {
		for ( .@i = 5; .@i > 0; .@i-- ) {
			mapannounce("guild_vs5", sprintf("FFA starts in [%d]", .@i), .ANNOUNCE_COLOR$);
		}
		announce("guild_vs5", "FFA has started!! Go kill'em all!!", bc_all, .ANNOUNCE_COLOR$);
		.STATUS = 2;
		setmapflag("guild_vs5", mf_gvg);
		removemapflag("guild_vs5", mf_noskill);
		initnpctimer(); // Time Limit of 30 minutes
		end();
	}
	// Else: Fall Through
 
OnStopEvent:
OnTimer1800000:
	stopnpctimer();
	.STATUS = 0;
	removemapflag("guild_vs5", mf_gvg);
	setmapflag("guild_vs5", mf_noskill);
	mapwarp("guild_vs5", "prontera", 156, 149);
	end();
 
OnPCKillEvent:
	if ( getmapusers("guild_vs5") != 1 )  {
		announce(sprintf("FFA Current players - %d.", getmapusers("guild_vs5")), bc_self, .ANNOUNCE_COLOR$);
	} else if ( getmapusers("guild_vs5") == 1 ) {
		dispbottom("You are a winner of Event Free for all. Congratz!", .WINNER_DISP_COLOR$);
		announce(sprintf("Free For All Winner: %s", strcharinfo(0)), bc_all, .WINNER_DISP_COLOR$);
		getitem(.REWARD_NAMEID, .REWARD_AMOUNT);
		mapwarp("guild_vs5", "prontera", 156, 149); // TODO: make dest map configurable (I'm too lazy to do it now haha)
		donpcevent("ffa_core::OnStopEvent");
	}
	end(); // Common end command for conditions above.
 
OnPCLoadMapEvent:
	if ( strcharinfo(3) == "guild_vs5" ) {
		if ( getmapusers("guild_vs5") >= .MIN_PLAYER && !.STATUS ) {
			donpcevent("ffa_core::OnStartEvent");
		}
	}
	end();
}
 
// ------ FFA Warper -------//        
prontera,147,149,6	script	Free For All	999,{
 
    .STATUS = getvariableofnpc(.STATUS, "ffa_core");
    .MAX_PLAYER = getvariableofnpc(.MAX_PLAYER, "ffa_core");
 
    mes("[^FF0000Agent Mil^000000]");
    mes("What do you want?");
    next();
 
    .@choice = select("Enter ^FFA500FFA Arena^000000", "Nothing");
 
    if ( .@choice == 2 ) {
        mes("[^FF0000Agent Mil^000000]");
        mes("Okay, see you next time.");
    } else if ( .STATUS > 1 ) {
        mes("[^FF0000Agent Mil^000000]");
        mes("Entrance for Free for all is not available at the moment");
    } else if ( .MAX_PLAYER > 1 && getmapusers("guild_vs5") >= .MAX_PLAYER ) {
        mes("[^FF0000Agent Mil^000000]");
        mes("Maximum number of players reached, try again in next match.");
    } else {
        if ( getcharid(1) ) {
            mes("^ff0000* Please leave your party.");
            close;
        } else if ( getcharid(2) ) {
            mes("^ff0000* Please leave your guild.");
            close;
        } else {
            // TODO: Why use this coordinates if we want to warp randomly?
            // Isn't better replace this switch and warp with just 'warp("guild_vs5", 0, 0);'?
            switch (rand(3)) {
                case 0: .@x = 18; .@y = 50; break;
                case 1: .@x = 50; .@y = 77; break;
                case 2: .@x = 81; .@y = 49; break;
                case 3: .@x = 49; .@y = 22; break;
            }
            warp("guild_vs5", .@x, .@y);
        }
    }
    close(); // Common close command for all conditions above.
}
 
// -- Mapflags
guild_vs5	mapflag	loadevent
guild_vs5	mapflag	partylock
guild_vs5	mapflag	guildlock
guild_vs5	mapflag	notrade
guild_vs5	mapflag	nodrop
Edited by topechi
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

	announce("Free for all will start in 1 minute.", bc_all, .ANNOUNCE_COLOR$);
	sleep(60000);

change to

	for ( .@i = 3; .@i > 0; .@i-- ) {
		announce("Free for all will start in "+.@i+" minute.", bc_all, .ANNOUNCE_COLOR$);
		sleep(60000);
	}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  52
  • Reputation:   2
  • Joined:  11/13/16
  • Last Seen:  

12 hours ago, Emistry said:

	announce("Free for all will start in 1 minute.", bc_all, .ANNOUNCE_COLOR$);
	sleep(60000);

change to


	for ( .@i = 3; .@i > 0; .@i-- ) {
		announce("Free for all will start in "+.@i+" minute.", bc_all, .ANNOUNCE_COLOR$);
		sleep(60000);
	}

 

Thanks sir. Ill try it out.

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