Jump to content

King of Emperium - Rewards for the Winning Guild


Recommended Posts


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.03
  • Content Count:  14
  • Reputation:   0
  • Joined:  07/17/24
  • Last Seen:  

Hello,

How can I convert this KOE script so that the winning guild won't need to talk to the NPC to get their rewards? (i think that is prone to abuse). 

I want the rewards to be automatically given to the players of the winning guild once the KOE is over.  Thanks in advance!

 

-	script	KoE	FAKE_NPC,{
OnInit:
	disablenpc "The King#KoE";
	disablenpc "Exit#KoE";
	bindatcmd "koe", strnpcinfo(0)+"::OnCommand", 99,100;
	end;
OnCommand:
	if ( compare( .@atcmd_parameters$, "on" ) ) goto L_start;
	else if ( compare( .@atcmd_parameters$, "off" ) ) goto L_end;
	else {
		dispbottom "type - '@koe on' to start the event";
		dispbottom "type - '@koe off' to end the event";
	}
	end;
L_start:
OnFri2326: // everyday 8pm starts
	if ( .start ) end;
	gvgon "guild_vs1";
	announce "The King of Emperium Hill has begun! Go to Geffen 114 64", bc_all;
	.start = true;
	enablenpc "The King#KoE";
	disablenpc "Exit#KoE";
	$koegid = 0;
	donpcevent "::OnRevKoE";
	maprespawnguildid "guild_vs1", $koegid, 3;
	killmonster "guild_vs1", "KoE::OnEmpDead";
	monster "guild_vs1",49,49, "EMPERIUM", 1288, 1, "KoE::OnEmpDead";
	end;
L_end:
OnFri2327: // everyday 8:30pm ends
	gvgoff "guild_vs1";
	announce "The King of Emperium Hill is over!", bc_all;
	.start = 0;
	enablenpc "Exit#KoE";
	disablenpc "The King#KoE";
	killmonster "guild_vs1", "KoE::OnEmpDead";
	maprespawnguildid "guild_vs1", $koegid, 2; // uncomment this line to kick non-owner off the map when event ends
    warpguild "guild_vs1",49,53,$koegid;
	end;

OnEmpDead:
	$koegid = getcharid(2);
	announce "The current King of Emperium Hill is the ["+ strcharinfo(2) +"] guild.", bc_all;
	donpcevent "::OnRevKoE";
	maprespawnguildid "guild_vs1", $koegid, 2;
	killmonster "guild_vs1", "KoE::OnEmpDead";
	sleep 500;
	if ( .start )
		monster "guild_vs1",49,49, "EMPERIUM", 1288, 1, "KoE::OnEmpDead";
	end;
}

// KoE Entrance
geffen,114,64,4	script	The King#KoE	403,{
	mes "[The King]";
	if ( !getcharid(2) ) {
		mes "You must have a guild to participate in the ^FF0000King of Emperium Hill Tournament^000000.";
		close;
	}
	mes "Hello.";
	mes "Would you like to participate in the ^FF0000King of Emperium Hill Tournament^000000?";
	if ( select ( "Yes", "No" ) == 2 ) close;
	if ( !getvariableofnpc( .start, "KoE" ) ) close;
	switch( rand(1,4) ){
	case 1:	warp "guild_vs1", 50, 88; end;
	case 2:	warp "guild_vs1", 88, 50; end;
	case 3:	warp "guild_vs1", 50, 11; end;
	case 4:	warp "guild_vs1", 11, 50; end;
	}
}

// KoE Exit
guild_vs1,49,56,5	script	Exit#KoE	1_M_BARD,{
	
    mes "[Exit]";
	mes "See ya.";
   	close2;
    getitem 35002,1;
	warp "Save",0,0;
    dispbottom "You got KoE Rewards !.",0xBC8F8F;
    end;

}

// Flags
guild_vs1,49,38,4	script	King of Emperium Hill#1::koe_flag	GUILD_FLAG,{
	if ( !$koegid ) end;
	mes "[King of Emperium Hill]";
	mes "The Current King of Emperium Hill is the ["+ getguildname($koegid) +"] guild.";
	close;
//OnInit: // Uncomment this line to make the emblem stay after @reloadscript
OnRevKoE:
	flagemblem $koegid;
	end;
}
guild_vs1,61,49,6	duplicate(koe_flag)	King of Emperium Hill#2	GUILD_FLAG
guild_vs1,38,49,2	duplicate(koe_flag)	King of Emperium Hill#3	GUILD_FLAG
guild_vs1,49,61,0	duplicate(koe_flag)	King of Emperium Hill#4	GUILD_FLAG

guild_vs1	mapflag	nobranch
guild_vs1	mapflag	nomemo
guild_vs1	mapflag	nopenalty
guild_vs1	mapflag	noreturn
guild_vs1	mapflag	nosave	SavePoint
guild_vs1	mapflag	noteleport
guild_vs1	mapflag	gvg_noparty
guild_vs1	mapflag	nowarp
guild_vs1	mapflag	nowarpto
guild_vs1	mapflag	guildlock

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  210
  • Reputation:   92
  • Joined:  06/02/12
  • Last Seen:  

Hello. You can use getmapunits and check for each player' guild to deliver the prize to winner guild members,

Find this:

warpguild "guild_vs1",49,53,$koegid;

And add the following lines below it:

getmapunits(BL_PC, "guild_vs1", .@gid);
	for(.@i = 0; .@i < getarraysize(.@gid); .@i++) {
		if (getcharid(2, convertpcinfo(.@gid[.@i],CPC_NAME)) == $koegid) {
			getitem 35002, 1, .@gid[.@i];
			dispbottom "You have been rewarded for conquering KoE.", 0x000000, convertpcinfo(.@gid[.@i],CPC_CHAR);
		}
	}

 

Also find and remove this line:

getitem 35002,1;

Save the file then use @reloadscript or restart the server.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.03
  • Content Count:  14
  • Reputation:   0
  • Joined:  07/17/24
  • Last Seen:  

21 hours ago, Racaae said:

Hello. You can use getmapunits and check for each player' guild to deliver the prize to winner guild members,

Find this:

warpguild "guild_vs1",49,53,$koegid;

And add the following lines below it:

getmapunits(BL_PC, "guild_vs1", .@gid);
	for(.@i = 0; .@i < getarraysize(.@gid); .@i++) {
		if (getcharid(2, convertpcinfo(.@gid[.@i],CPC_NAME)) == $koegid) {
			getitem 35002, 1, .@gid[.@i];
			dispbottom "You have been rewarded for conquering KoE.", 0x000000, convertpcinfo(.@gid[.@i],CPC_CHAR);
		}
	}

 

Also find and remove this line:

getitem 35002,1;

Save the file then use @reloadscript or restart the server.

Thanks @Racaae it worked. 

Also not sure if I can add it here but would you know how can I limit the guild members who can enter the koe map? I want to limit to only 12 members per guild. Maybe if they exceed, they will be warped out or the excess will be warped out?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  210
  • Reputation:   92
  • Joined:  06/02/12
  • Last Seen:  

17 hours ago, zemaj said:

Thanks @Racaae it worked. 

Also not sure if I can add it here but would you know how can I limit the guild members who can enter the koe map? I want to limit to only 12 members per guild. Maybe if they exceed, they will be warped out or the excess will be warped out?

Find OnInit and add these lines below it:

	setmapflag "guild_vs1", mf_loadevent;
	$@KoE_limit = 12; //how many guild members can participate

 

Then add this anywhere:

OnPCLoadMapEvent:
	if (strcharinfo(3) == "guild_vs1") {
		.@joined = getMapGuildUsers("guild_vs1",getcharid(2));
		if (.@joined > $@KoE_limit) {
			dispbottom "Sorry. Your Guild has reached the limit of " + $@KoE_limit + " people on KoE.";
			dispbottom "Teleporting you out now.";
			warp "SavePoint",0,0;
		}
	}
	end;

The OnPCLoadMapEvent will trigger when anyone enters the map, do a check on how many guild members are participating and then warp the player out if reached the limit.

 

Find:

if ( !getvariableofnpc( .start, "KoE" ) ) close;

And add below it:

	.@joined = getMapGuildUsers("guild_vs1",getcharid(2));
	if (.@joined >= $@KoE_limit) {
		clear;
		mes "[The King]";
		mes "^FF0000Sorry. Your Guild has reached the limit of " + $@KoE_limit + " people on KoE.^000000";
		close;
	}

This will make the entrance NPC also do the same check.

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.03
  • Content Count:  14
  • Reputation:   0
  • Joined:  07/17/24
  • Last Seen:  

On 10/13/2024 at 7:16 PM, Racaae said:

Find OnInit and add these lines below it:

	setmapflag "guild_vs1", mf_loadevent;
	$@KoE_limit = 12; //how many guild members can participate

 

Then add this anywhere:

OnPCLoadMapEvent:
	if (strcharinfo(3) == "guild_vs1") {
		.@joined = getMapGuildUsers("guild_vs1",getcharid(2));
		if (.@joined > $@KoE_limit) {
			dispbottom "Sorry. Your Guild has reached the limit of " + $@KoE_limit + " people on KoE.";
			dispbottom "Teleporting you out now.";
			warp "SavePoint",0,0;
		}
	}
	end;

The OnPCLoadMapEvent will trigger when anyone enters the map, do a check on how many guild members are participating and then warp the player out if reached the limit.

 

Find:

if ( !getvariableofnpc( .start, "KoE" ) ) close;

And add below it:

	.@joined = getMapGuildUsers("guild_vs1",getcharid(2));
	if (.@joined >= $@KoE_limit) {
		clear;
		mes "[The King]";
		mes "^FF0000Sorry. Your Guild has reached the limit of " + $@KoE_limit + " people on KoE.^000000";
		close;
	}

This will make the entrance NPC also do the same check.

Thank you @Racaae

You are really awesome. Can I ask one last question?

How can I make the emergency call in guild_vs1 to work? 

 

guild_vs1	mapflag	nobranch
guild_vs1	mapflag	gvg_castle
guild_vs1	mapflag	nomemo
guild_vs1	mapflag	nopenalty
guild_vs1	mapflag	noreturn
guild_vs1	mapflag	nosave	SavePoint
guild_vs1	mapflag	noteleport
//guild_vs1	mapflag	gvg_noparty
//guild_vs1	mapflag	nowarp
//guild_vs1	mapflag	nowarpto
guild_vs1	mapflag	guildlock

These are my mapflag in koe.txt

 

		case GD_EMERGENCYCALL:
		case GD_ITEMEMERGENCYCALL:
			if (
				//!(battle_config.emergency_call&((is_agit_start())?2:1)) ||
				//!(battle_config.emergency_call&(mapdata_flag_gvg2(mapdata)?8:4)) ||
				(battle_config.emergency_call&16 && mapdata->getMapFlag(MF_NOWARPTO) && !(mapdata->getMapFlag(MF_GVG_CASTLE) || mapdata->getMapFlag(MF_GVG_TE_CASTLE)))
			)	{
				clif_skill_fail( sd, skill_id );
				return true;
			}
			break;

These are my skill.cpp. I'm trying to understand but I think this is the best I can understand. Thank you for your help.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.03
  • Content Count:  14
  • Reputation:   0
  • Joined:  07/17/24
  • Last Seen:  

On 10/13/2024 at 8:16 PM, Racaae said:

Find OnInit and add these lines below it:

	setmapflag "guild_vs1", mf_loadevent;
	$@KoE_limit = 12; //how many guild members can participate

 

Then add this anywhere:

OnPCLoadMapEvent:
	if (strcharinfo(3) == "guild_vs1") {
		.@joined = getMapGuildUsers("guild_vs1",getcharid(2));
		if (.@joined > $@KoE_limit) {
			dispbottom "Sorry. Your Guild has reached the limit of " + $@KoE_limit + " people on KoE.";
			dispbottom "Teleporting you out now.";
			warp "SavePoint",0,0;
		}
	}
	end;

The OnPCLoadMapEvent will trigger when anyone enters the map, do a check on how many guild members are participating and then warp the player out if reached the limit.

 

Find:

if ( !getvariableofnpc( .start, "KoE" ) ) close;

And add below it:

	.@joined = getMapGuildUsers("guild_vs1",getcharid(2));
	if (.@joined >= $@KoE_limit) {
		clear;
		mes "[The King]";
		mes "^FF0000Sorry. Your Guild has reached the limit of " + $@KoE_limit + " people on KoE.^000000";
		close;
	}

This will make the entrance NPC also do the same check.

Hello @Racaae

Would you know how can I give consolation prize for all the guilds who participated?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  210
  • Reputation:   92
  • Joined:  06/02/12
  • Last Seen:  

On 10/14/2024 at 10:54 AM, zemaj said:

Thank you @Racaae
You are really awesome. Can I ask one last question?
How can I make the emergency call in guild_vs1 to work?

Don't know.

 

On 10/17/2024 at 8:04 AM, zemaj said:

Hello @Racaae

Would you know how can I give consolation prize for all the guilds who participated?

Find

		if (getcharid(2, convertpcinfo(.@gid[.@i],CPC_NAME)) == $koegid) {
			getitem 35002, 1, .@gid[.@i];
			dispbottom "You have been rewarded for conquering KoE.", 0x000000, convertpcinfo(.@gid[.@i],CPC_CHAR);
		}

Add below it:

		else {
			getitem 607, 1, .@gid[.@i]; //consolation prize
			dispbottom "You have been rewarded for participating KoE.", 0x000000, convertpcinfo(.@gid[.@i],CPC_CHAR);
		}

 

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  09/01/15
  • Last Seen:  

On 10/18/2024 at 11:23 AM, Racaae said:

Don't know.

 

Find

		if (getcharid(2, convertpcinfo(.@gid[.@i],CPC_NAME)) == $koegid) {
			getitem 35002, 1, .@gid[.@i];
			dispbottom "You have been rewarded for conquering KoE.", 0x000000, convertpcinfo(.@gid[.@i],CPC_CHAR);
		}

Add below it:

		else {
			getitem 607, 1, .@gid[.@i]; //consolation prize
			dispbottom "You have been rewarded for participating KoE.", 0x000000, convertpcinfo(.@gid[.@i],CPC_CHAR);
		}

 

Hello! How are you?

Help-me, plis?

The system is not delivering the consolation prize here :t Taking advantage of the opportunity, can you please help add a Ranking to this system? It would be great ❤️ thanks 

The ranking could be of kills and deaths and finally the number of times that guild managed to win the event.

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  09/01/15
  • Last Seen:  

On 10/18/2024 at 11:23 AM, Racaae said:

Don't know.

 

Find

		if (getcharid(2, convertpcinfo(.@gid[.@i],CPC_NAME)) == $koegid) {
			getitem 35002, 1, .@gid[.@i];
			dispbottom "You have been rewarded for conquering KoE.", 0x000000, convertpcinfo(.@gid[.@i],CPC_CHAR);
		}

Add below it:

		else {
			getitem 607, 1, .@gid[.@i]; //consolation prize
			dispbottom "You have been rewarded for participating KoE.", 0x000000, convertpcinfo(.@gid[.@i],CPC_CHAR);
		}

 

And is it common for the player to be able to break the EMP more than once? I broke it once, and I can still attack the EMP even though I was the one who destroyed it previously.

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
Reply to this topic...

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