Jump to content

Question

Posted

Hi everyone, I would like to know if you can help me with a World Boss script.
 

 1.I would like the world boss to appear every 6 hours.

2. I would like all participants to receive a reward and the person who gave the final blow a special reward.no double login please 
 

3. that the world boss has the time above the NPC

IMG_8574.jpeg

4 answers to this question

Recommended Posts

  • 0
Posted

Hi
 

//===== rAthena Script =======================================
//= World Boss Apparition
//===== By: ==================================================
//= Alayne
//===== Current Version: =====================================
//= 1.0 First version.
//= 2.0 Updated. [Racaae]
//============================================================

-	script	WorldBoss::alawboss	-1,{
OnInit:

//===== CONF
	.rewardMode = 2;	// 1:inventory - 2:mailed - 3:drop on floor

	// Rewards
	// setarray .reward_id[0],     <itemID>{,<itemID>,...}
	// setarray .reward_amount[0], <amount>{,<amount>,...}
	setarray .reward_id[0],969;
	setarray .reward_amount[0],1;

	.special_reward_id = 607;	//item id for person who gave the final blow 
	.special_reward_amount = 3;	//amount for person who gave the final blow
	.reward_zeny = 0;	// Zeny reward
	.rewardCount = -1;	//How many items to drop on floor? (rewardMode:3 Only)
	.ip_check = true;	//No rewards for double login
	set .bossAliveDuration, 30; //in minutes
	setarray .rebirthXY[0],120,202,202,120,119,37,37,119; //X, then Y. Only used if only one map is used
	set $lastPopMap$, "";
	set $wordBossPop, 0;
	setarray .wbMap$[0],
		"prontera";
	setarray .wbMapName$[0],
		"Prontera";
	setarray .wBossIds[0],
		2320,2483,1917,2942,2131;
	setarray .wBossHp[0],
		20000000,30000000,40000000,50000000,60000000;
	//Storm Gust, Meteor Storm, Lord of Vermillion, Bowling Bash, Kyrie Eleison
	setarray .wbSummonSkillId[0],
		89, 83, 85, 62, 73;
	setarray .wBossName$[0],
		"Hoktarrh","Giashim","Deathres","Cerbere","Citrak";
	setarray .wbSlaveMobsId[0], 1098, 2023, 2365, 2019, 2472;
	setarray .wbSlaveMobsCount[0], 25, 15, 10, 15, 5;
	setarray .deadMonstersId[0], 1865, 2603, 1870, 2473, 2474, 2283;
//===== CONF END

	set .timerCount, 0;
	.reward_id_size = getarraysize(.reward_id);
	bindatcmd "worldboss", strnpcinfo(3) + "::OnStartWBoss",90,90;
	end;

OnStartWBoss:
	.@force = 1;
OnMinute30:
OnStarted:
	if($WorldBoss_cd <= gettimetick(2) || .@force) {
		set .@chosenMap$, "[ ";
		set .@spawnRand, rand(0, getarraysize(.wbMap$)-1);
		set .lastRandId, rand(0, getarraysize(.wBossIds) - 1);
		//RATHENA
		monster .wbMap$[.@spawnRand],82,55,.wBossName$[.lastRandId],.wBossIds[.lastRandId],1,strnpcinfo(3) + "::OnWorldBossDied",2; 
		set .wBossId, $@mobId[0];
		setunitdata .wBossId, UMOB_MAXHP, .wBossHp[.@spawnRand];
		
		set .@chosenMap$, .@chosenMap$ + .wbMapName$[.@spawnRand] + "]";
		
		announce "[ System ] World Boss appeared in " + .@chosenMap$ + " !",bc_all,0xFF0000;
		set $WorldBoss_cd, gettimetick(2) + 21600; //next pop in 3 days, 60 for debug (1 min) - 21600 6hours
		
		set $lastPopMap$, .wbMap$[.@spawnRand];
		set $lastPopIdRank, .@spawnRand;
		deletearray $wbFighters[0], getarraysize($wbFighters);
		set $wordBossPop, 1;
		set .deadCount, 0;
		
		set .timerCount, 0;
		initnpctimer;
		donpcevent "World Boss#wb_board::OnEvent";
	}
	else {
		if(.debug == 1) {
			debugmes "Not ready yet.";		
		}
	}
	end;
	
OnTimer1000:
	.timerCount += 1;
	freeloop(1);
	if(.timerCount == .bossAliveDuration * 60) {
		stopnpctimer; 

		killmonster $lastPopMap$, strnpcinfo(3) + "::OnWorldBossDied";
		killmonster $lastPopMap$, strnpcinfo(3) + "::OnSaveDied";
		killmonster $lastPopMap$, strnpcinfo(3) + "::OnCloneDied";
		killmonster $lastPopMap$, strnpcinfo(3) + "::OnReducedBossDied";

		set $wordBossPop, 0;
		announce "[ System ] World Boss vanished without being killed...",bc_all,0x00FF00;
	}
	set .@cellRange, 25;
	switch(.timerCount)
	{
		case 60:
			//1 min
			mapannounce $lastPopMap$, "[ World Boss ] Raise! Raise, my army!", bc_map, 0xFF0000;
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@x, .@worldBossData[UMOB_X];
			set .@y, .@worldBossData[UMOB_Y];
			for(set .@i,0; .@i<getarraysize(.wbSlaveMobsId); set .@i,.@i+1)
			{
				for(set .@j,0; .@j<.wbSlaveMobsCount[.@i]; set .@j,.@j+1)
				{
					areamonster $lastPopMap$, .@x - .@cellRange, .@y - .@cellRange, .@x + .@cellRange, .@y + .@cellRange, "Slaves", .wbSlaveMobsId[.@i], 1, strnpcinfo(3) + "::OnSaveDied";  
				}
			}
			break;
		case 120:
			//2 min, all summon cast skills
			mapannounce $lastPopMap$, "[ World Boss ] You are all far beyond my control!", bc_map, 0xFF0000;
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@x, .@worldBossData[UMOB_X];
			set .@y, .@worldBossData[UMOB_Y];
			for(set .@i,0; .@i<getarraysize(.wbSlaveMobsId); set .@i,.@i+1)
			{
				areamobuseskill $lastPopMap$, .@x, .@y, .@cellRange * 2, .wbSlaveMobsId[.@i], .wbSummonSkillId[.lastRandId], 5, 3000,1,ET_KIK,3;
			}
			break;
		case 180:
			//3 min, pop 15 reduced clone of the mob
			mapannounce $lastPopMap$, "[ World Boss ] You won't go away with this, humans!", bc_map, 0xFF0000;
			monster $lastPopMap$,0,0,.wBossName$[.lastRandId],.wBossIds[.lastRandId],15,strnpcinfo(3) + "::OnReducedBossDied"; 
			copyarray .@tempMobId[0], $@mobId[0], 15;
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@hp, .@worldBossData[UMOB_HP];
			set .@tempHp, .@hp / 15;
			for(set .@i,0; .@i<getarraysize(.@tempMobId); set .@i,.@i+1)
			{	
				//RATHENA
				setunitdata .@tempMobId[.@i], UMOB_MAXHP, .@tempHp;
				setunitdata .@tempMobId[.@i], UMOB_HP, .@tempHp;
			}
			break;
		case 240:
			//4 min, raise dead bodies
			mapannounce $lastPopMap$, "[ World Boss ] Even the deads are on my side! You can't win!", bc_map, 0xFF0000;
			set .@deadSplit, .deadCount / getarraysize(.deadMonstersId);
			if(.@deadSplit <= 0)
			{
				set .@deadSplit, 2;
			}
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@x, .@worldBossData[UMOB_X];
			set .@y, .@worldBossData[UMOB_Y];
			for(set .@i,0; .@i<getarraysize(.deadMonstersId); set .@i,.@i+1)
			{
				areamonster $lastPopMap$, .@x - .@cellRange, .@y - .@cellRange, .@x + .@cellRange, .@y + .@cellRange, "Dead Corpses", .deadMonstersId[.@i], .@deadSplit, strnpcinfo(3) + "::OnSaveDied";  
			}
			break;
		case 300:
			//5 min, pop clone of each player
			mapannounce $lastPopMap$, "[ World Boss ] Fight against your own power you're so proud of, shall you?!", bc_map, 0xFF0000;
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@x, .@worldBossData[UMOB_X];
			set .@y, .@worldBossData[UMOB_Y];
			for(set .@i,0; .@i<getarraysize($wbFighters); set .@i,.@i+1)
			{
				if(attachrid($wbFighters[.@i]) == 1 && strcharinfo(3) == $lastPopMap$)
				{
					clone $lastPopMap$, rand(.@x - .@cellRange, .@x + .@cellRange), rand(.@y - .@cellRange, .@y + .@cellRange), strnpcinfo(3) + "::OnCloneDied", getcharid(0);
				}
				else
				{
					deletearray $wbFighters[.@i], 1;
				}
			}
			break;
		case 360:
			//6 min
			mapannounce $lastPopMap$, "[ World Boss ] Raise! Raise, my army!", bc_map, 0xFF0000;
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@x, .@worldBossData[UMOB_X];
			set .@y, .@worldBossData[UMOB_Y];
			for(set .@i,0; .@i<getarraysize(.wbSlaveMobsId); set .@i,.@i+1)
			{
				for(set .@j,0; .@j<.wbSlaveMobsCount[.@i]; set .@j,.@j+1)
				{
					areamonster $lastPopMap$, .@x - .@cellRange * 2, .@y - .@cellRange * 2, .@x + .@cellRange * 2, .@y + .@cellRange * 2, "Slaves", .wbSlaveMobsId[.@i], 1, strnpcinfo(3) + "::OnSaveDied";  
				}
			}
			break;
		case 420:
			//7 min, autocast earthquake at 10% hp cost
			mapannounce $lastPopMap$, "[ World Boss ] STOP BOTHERING ME, HUMANS!", bc_map, 0xFF0000;
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@hp, .@worldBossData[UMOB_HP];
			set .@mhp, .@worldBossData[UMOB_MAXHP];
			set .@x, .@worldBossData[UMOB_X];
			set .@y, .@worldBossData[UMOB_Y];
			if(.@hp > 10 * .@mhp / 100)
			{
				//RATHENA
				setunitdata .wBossId, UMOB_HP, .@hp - 10 * .@mhp / 100;
				set .@id, .wbSlaveMobsId[rand(getarraysize(.wbSlaveMobsId) - 1)];
				areamobuseskill $lastPopMap$, .@x, .@y, .@cellRange * 2, .@id, 653, 3, 3000, 1, ET_KIK, 3;
			}
			else
			{
				//only world boss pop, but stronger
				areamobuseskill $lastPopMap$, .@x, .@y, .@cellRange * 2, .wBossIds[$lastPopIdRank], 653, 10, 3000, 1, ET_KIK, 3;
			}
			break;
		case 480:
			//8 min, wide bleeding
			mapannounce $lastPopMap$, "[ World Boss ] You don't even deserve me to fight you!", bc_map, 0xFF0000;
			areamobuseskill $lastPopMap$, .@x, .@y, 50, .wBossIds[$lastPopIdRank], 665, 5, 3000, 1, ET_KIK, 3;
			break;
		case 540:
			//9 min, random kill over fighters
			mapannounce $lastPopMap$, "[ World Boss ] Feel my rage! Limitless is my power!!", bc_map, 0xFF0000;
			set .@killCount, rand(getarraysize($wbFighters));
			for(set .@i,0; .@i<getarraysize($wbFighters); set .@i,.@i+1)
			{
				if(attachrid($wbFighters[.@i]) == 1 && strcharinfo(3) == $lastPopMap$)
				{
					charcommand "#nuke " + strcharinfo(0) + " " + strcharinfo(0);
				}
				else
				{
					deletearray $wbFighters[.@i], 1;
				}
			}
			break;
		case 600:
			//10 min, raise life according to alive clones
			mapannounce $lastPopMap$, "[ World Boss ] I'll feast from your bones!!", bc_map, 0xFF0000;
			set .@mobCount, mobcount($lastPopMap$, strnpcinfo(3) + "::OnReducedBossDied");
			killmonster $lastPopMap$, strnpcinfo(3) + "::OnReducedBossDied";
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@hp, .@worldBossData[UMOB_HP];
			set .@mhp, .@worldBossData[UMOB_MAXHP];
			if( .@hp + .@mobCount * 50000 > .@mhp )
				setunitdata .wBossId, UMOB_HP, .@mhp;
			else
				setunitdata .wBossId, UMOB_HP, .@hp + .@mobCount * 50000;
			break;
		case 660:
			//11 min, slave skill area
			mapannounce $lastPopMap$, "[ World Boss ] Life and death are nothing to me!", bc_map, 0xFF0000;
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@x, .@worldBossData[UMOB_X];
			set .@y, .@worldBossData[UMOB_Y];
			for(set .@i,0; .@i<getarraysize(.wbSlaveMobsId); set .@i,.@i+1)
			{
				//BASILICA 362 (5) OR EVILLAND 670 (1)
				if(rand(1) == 0)
				{
					areamobuseskill $lastPopMap$, .@x, .@y, .@cellRange * 2, .wbSlaveMobsId[.@i], 362, 5, 3000,1,ET_KIK,3;
				}
				else
				{
					areamobuseskill $lastPopMap$, .@x, .@y, .@cellRange * 2, .wbSlaveMobsId[.@i], 670, 1, 3000,1,ET_KIK,3;
				}
			}
			break;
	}
	setnpctimer 0;
	freeloop(0);
	end;
	
OnPCDieEvent:
	if(strcharinfo(3) == $lastPopMap$ && getarraysize(.wbMap$) == 1)
	{
		set .@rebirthArea, rand(4);
		warp $lastPopMap$, .rebirthXY[.@rebirthArea * 2], .rebirthXY[.@rebirthArea * 2 + 1];	 
		charcommand "#alive " + strcharinfo(0);
	}
	addtimer 10000, strnpcinfo(3) + "::OnPopClone";
	set .deadCount, .deadCount + 1;
	end;
	
OnPopClone:
	if(Hp > 0)
	{
		set .@cellRange, 25;
		//RATHENA
		getunitdata(.wBossId, .@worldBossData);
		set .@x, .@worldBossData[UMOB_X];
		set .@y, .@worldBossData[UMOB_Y];
		clone $lastPopMap$, rand(.@x - .@cellRange, .@x + .@cellRange), rand(.@y - .@cellRange, .@y + .@cellRange), strnpcinfo(3) + "::OnCloneDied", getcharid(0);
	}
	end;
	
OnSaveDied:
OnCloneDied:
OnReducedBossDied:
	//nothing, used to clean
	end;
	
OnWorldBossDied:
	stopnpctimer;
	set $wordBossPop, 0;
	donpcevent "World Boss#wb_board::OnEvent";
	killmonster $lastPopMap$, "All";
	announce "[ System ] "+strcharinfo(0)+" gave the final blow to the World Boss !",bc_all,0x0000FF;
	if (.special_reward_id && .special_reward_amount)
		getitem .special_reward_id, .special_reward_amount;
	callsub OnReward;
	end;

OnReward:
	if (!.reward_id_size && !.reward_zeny)
		return;
	if (.rewardMode == 3) {
		if (.rewardCount == -1) {
			set .rewardCount, getmapusers($lastPopMap$);
		}
		for (set .@i,0; .@i < .rewardCount; set .@i,.@i+1) {
			set .@rand, rand(getarraysize(.@reward_id));
			//edit 150 if the map length and height is different of 150 cell
			makeitem .reward_id[.@rand],.reward_amount[.@rand],$lastPopMap$,rand(150),rand(150); 
		}
		return;
	}
	if (.rewardMode) .@str$ = gettimestr("%B %d, %Y",21);
	freeloop(1);
	.@size = getmapunits(BL_PC,$lastPopMap$,.@aid[0]);
	if (.ip_check) {
		for ( .@j = 0; .@j < .@size; ++.@j ) {
		//	.@ip$ = replacestr(getcharip(.@aid[.@j]),".","");
			.@ip$ = getcharip(.@aid[.@j]);
			.@duplicate = inarray(.@iplist$, .@ip$);
			if (.@duplicate < 0)
				.@iplist$[.@iplistcount++] = .@ip$;
			else {
				message rid2name(.@aid[.@j]), "Another character with the same IP address has received the World Boss reward.";
				deletearray .@aid[.@j],1;
				.@j--;
			}
		}
		.@size = getarraysize(.@aid[0]);
	}
	for (.@j = 0; .@j < .@size; .@j++) {
		if (.rewardMode == 2) {
			.@charid = convertpcinfo(.@aid[.@j],CPC_CHAR);
			.@sender$ = "Rune-Midgarts Kingdom";
			.@title$ = "World Boss Reward";
			.@body$ = "Congratulations on defeating the World Boss!\r\n "+.@str$+".\r\n \r\n \r\n \r\n \r\n [ Your reward is attached. ]";

			if (.reward_id_size)
				mail .@charid, .@sender$, .@title$, .@body$, .reward_zeny, .reward_id, .reward_amount;
			else
				mail .@charid, .@sender$, .@title$, .@body$, .reward_zeny;

			if (PACKETVER < 20150513 && !getd(".@str_"+.@cid[.@j]) && .@online) {
				setd ".@str_"+.@cid[.@j],1;
				message rid2name(.@aid[.@j]),"You've got mail!";
			}
		}
		else {
			attachrid( .@aid[.@j], true );
			.@name$ = strcharinfo( 0 );
			for ( .@k = 0; .@k < .reward_id_size; .@k++ ) {
				if (checkweight(.reward_id[.@k], .reward_amount[.@k]))
					getitem .reward_id[.@k], .reward_amount[.@k];
				else
					dispbottom "You can't receive x" + .reward_amount[.@k] + " " + getitemname(.reward_id[.@k]) + " for defeating the World Boss because you're overweight.";
			}
			Zeny += .reward_zeny;
			dispbottom "You have been rewarded for defeating the World Boss.";
		}
	}
	return;
}

prontera,144,198,4	script	World Boss#wb_board	2_BOARD1,{
	mes "[World Boss]";
	if ($wordBossPop == 1) {
		mes "Hurry up, " + strcharinfo(0) + ".";
		mes "A World Boss threat has been raised, a few ago!";
		mes "We need all fighters to join!";
		if(select("Send me there","No way, I'm not going") == 1) {
			next;
			mes "[World Boss Area]";
			mes "Right, get ready.";
			set $wbFighters[getarraysize($wbFighters)], getcharid(3);
			warp $lastPopMap$, 0, 0;
		}
		else {
			next;
			mes "[World Boss Area]";
			mes "What are you? A coward?";
			mes "You'll be blessed when we all be dead...";
		}
	}
	else {
		mes "I'm the one you should come to visit when a World Boss will appear.";
		mes "And believe, it will.";
		mes "Those monsters are regular, in some kind.";
		mes "Al mortal, giant...And ridiculously strong...";
	}
	close;

OnInit:
OnTimer60000:
OnEvent:
	stopnpctimer;
	initnpctimer;
	delwaitingroom;
	if ($wordBossPop) {
		waitingroom "World Boss Alive",0;
		end;
	}
	.@time = ($WorldBoss_cd - gettimetick(2));
	if (.@time < 1) {
		donpcevent "alawboss::OnStarted";
		end;
	}
	.@remaining_d = .@time / 86400;
	.@remaining_h = (.@time % 86400) / 3600;
	.@remaining_m = (.@time % 3600) / 60;
	.@remaining_s = .@time % 60;
	if (.@remaining_d)
		.@s$[.@i++] = .@remaining_d + " day" + (.@remaining_d>1?"s":"");
	if (.@remaining_h)
		.@s$[.@i++] = .@remaining_h + " hour" + (.@remaining_h>1?"s":"");
	if (.@remaining_m)
		.@s$[.@i++] = .@remaining_m + " minute" + (.@remaining_m>1?"s":"");
	if (!.@remaining_d && !.@remaining_h && !.@remaining_m)
		.@s$[.@i++] = .@remaining_s + " second" + (.@remaining_s>1?"s":"");
	waitingroom implode(.@s$," "),0;
	end;
}

 

  • Like 1
  • 0
Posted
On 4/22/2025 at 6:17 PM, Racaae said:

Hi
 

//===== rAthena Script =======================================
//= World Boss Apparition
//===== By: ==================================================
//= Alayne
//===== Current Version: =====================================
//= 1.0 First version.
//= 2.0 Updated. [Racaae]
//============================================================

-	script	WorldBoss::alawboss	-1,{
OnInit:

//===== CONF
	.rewardMode = 2;	// 1:inventory - 2:mailed - 3:drop on floor

	// Rewards
	// setarray .reward_id[0],     <itemID>{,<itemID>,...}
	// setarray .reward_amount[0], <amount>{,<amount>,...}
	setarray .reward_id[0],969;
	setarray .reward_amount[0],1;

	.special_reward_id = 607;	//item id for person who gave the final blow 
	.special_reward_amount = 3;	//amount for person who gave the final blow
	.reward_zeny = 0;	// Zeny reward
	.rewardCount = -1;	//How many items to drop on floor? (rewardMode:3 Only)
	.ip_check = true;	//No rewards for double login
	set .bossAliveDuration, 30; //in minutes
	setarray .rebirthXY[0],120,202,202,120,119,37,37,119; //X, then Y. Only used if only one map is used
	set $lastPopMap$, "";
	set $wordBossPop, 0;
	setarray .wbMap$[0],
		"prontera";
	setarray .wbMapName$[0],
		"Prontera";
	setarray .wBossIds[0],
		2320,2483,1917,2942,2131;
	setarray .wBossHp[0],
		20000000,30000000,40000000,50000000,60000000;
	//Storm Gust, Meteor Storm, Lord of Vermillion, Bowling Bash, Kyrie Eleison
	setarray .wbSummonSkillId[0],
		89, 83, 85, 62, 73;
	setarray .wBossName$[0],
		"Hoktarrh","Giashim","Deathres","Cerbere","Citrak";
	setarray .wbSlaveMobsId[0], 1098, 2023, 2365, 2019, 2472;
	setarray .wbSlaveMobsCount[0], 25, 15, 10, 15, 5;
	setarray .deadMonstersId[0], 1865, 2603, 1870, 2473, 2474, 2283;
//===== CONF END

	set .timerCount, 0;
	.reward_id_size = getarraysize(.reward_id);
	bindatcmd "worldboss", strnpcinfo(3) + "::OnStartWBoss",90,90;
	end;

OnStartWBoss:
	.@force = 1;
OnMinute30:
OnStarted:
	if($WorldBoss_cd <= gettimetick(2) || .@force) {
		set .@chosenMap$, "[ ";
		set .@spawnRand, rand(0, getarraysize(.wbMap$)-1);
		set .lastRandId, rand(0, getarraysize(.wBossIds) - 1);
		//RATHENA
		monster .wbMap$[.@spawnRand],82,55,.wBossName$[.lastRandId],.wBossIds[.lastRandId],1,strnpcinfo(3) + "::OnWorldBossDied",2; 
		set .wBossId, $@mobId[0];
		setunitdata .wBossId, UMOB_MAXHP, .wBossHp[.@spawnRand];
		
		set .@chosenMap$, .@chosenMap$ + .wbMapName$[.@spawnRand] + "]";
		
		announce "[ System ] World Boss appeared in " + .@chosenMap$ + " !",bc_all,0xFF0000;
		set $WorldBoss_cd, gettimetick(2) + 21600; //next pop in 3 days, 60 for debug (1 min) - 21600 6hours
		
		set $lastPopMap$, .wbMap$[.@spawnRand];
		set $lastPopIdRank, .@spawnRand;
		deletearray $wbFighters[0], getarraysize($wbFighters);
		set $wordBossPop, 1;
		set .deadCount, 0;
		
		set .timerCount, 0;
		initnpctimer;
		donpcevent "World Boss#wb_board::OnEvent";
	}
	else {
		if(.debug == 1) {
			debugmes "Not ready yet.";		
		}
	}
	end;
	
OnTimer1000:
	.timerCount += 1;
	freeloop(1);
	if(.timerCount == .bossAliveDuration * 60) {
		stopnpctimer; 

		killmonster $lastPopMap$, strnpcinfo(3) + "::OnWorldBossDied";
		killmonster $lastPopMap$, strnpcinfo(3) + "::OnSaveDied";
		killmonster $lastPopMap$, strnpcinfo(3) + "::OnCloneDied";
		killmonster $lastPopMap$, strnpcinfo(3) + "::OnReducedBossDied";

		set $wordBossPop, 0;
		announce "[ System ] World Boss vanished without being killed...",bc_all,0x00FF00;
	}
	set .@cellRange, 25;
	switch(.timerCount)
	{
		case 60:
			//1 min
			mapannounce $lastPopMap$, "[ World Boss ] Raise! Raise, my army!", bc_map, 0xFF0000;
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@x, .@worldBossData[UMOB_X];
			set .@y, .@worldBossData[UMOB_Y];
			for(set .@i,0; .@i<getarraysize(.wbSlaveMobsId); set .@i,.@i+1)
			{
				for(set .@j,0; .@j<.wbSlaveMobsCount[.@i]; set .@j,.@j+1)
				{
					areamonster $lastPopMap$, .@x - .@cellRange, .@y - .@cellRange, .@x + .@cellRange, .@y + .@cellRange, "Slaves", .wbSlaveMobsId[.@i], 1, strnpcinfo(3) + "::OnSaveDied";  
				}
			}
			break;
		case 120:
			//2 min, all summon cast skills
			mapannounce $lastPopMap$, "[ World Boss ] You are all far beyond my control!", bc_map, 0xFF0000;
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@x, .@worldBossData[UMOB_X];
			set .@y, .@worldBossData[UMOB_Y];
			for(set .@i,0; .@i<getarraysize(.wbSlaveMobsId); set .@i,.@i+1)
			{
				areamobuseskill $lastPopMap$, .@x, .@y, .@cellRange * 2, .wbSlaveMobsId[.@i], .wbSummonSkillId[.lastRandId], 5, 3000,1,ET_KIK,3;
			}
			break;
		case 180:
			//3 min, pop 15 reduced clone of the mob
			mapannounce $lastPopMap$, "[ World Boss ] You won't go away with this, humans!", bc_map, 0xFF0000;
			monster $lastPopMap$,0,0,.wBossName$[.lastRandId],.wBossIds[.lastRandId],15,strnpcinfo(3) + "::OnReducedBossDied"; 
			copyarray .@tempMobId[0], $@mobId[0], 15;
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@hp, .@worldBossData[UMOB_HP];
			set .@tempHp, .@hp / 15;
			for(set .@i,0; .@i<getarraysize(.@tempMobId); set .@i,.@i+1)
			{	
				//RATHENA
				setunitdata .@tempMobId[.@i], UMOB_MAXHP, .@tempHp;
				setunitdata .@tempMobId[.@i], UMOB_HP, .@tempHp;
			}
			break;
		case 240:
			//4 min, raise dead bodies
			mapannounce $lastPopMap$, "[ World Boss ] Even the deads are on my side! You can't win!", bc_map, 0xFF0000;
			set .@deadSplit, .deadCount / getarraysize(.deadMonstersId);
			if(.@deadSplit <= 0)
			{
				set .@deadSplit, 2;
			}
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@x, .@worldBossData[UMOB_X];
			set .@y, .@worldBossData[UMOB_Y];
			for(set .@i,0; .@i<getarraysize(.deadMonstersId); set .@i,.@i+1)
			{
				areamonster $lastPopMap$, .@x - .@cellRange, .@y - .@cellRange, .@x + .@cellRange, .@y + .@cellRange, "Dead Corpses", .deadMonstersId[.@i], .@deadSplit, strnpcinfo(3) + "::OnSaveDied";  
			}
			break;
		case 300:
			//5 min, pop clone of each player
			mapannounce $lastPopMap$, "[ World Boss ] Fight against your own power you're so proud of, shall you?!", bc_map, 0xFF0000;
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@x, .@worldBossData[UMOB_X];
			set .@y, .@worldBossData[UMOB_Y];
			for(set .@i,0; .@i<getarraysize($wbFighters); set .@i,.@i+1)
			{
				if(attachrid($wbFighters[.@i]) == 1 && strcharinfo(3) == $lastPopMap$)
				{
					clone $lastPopMap$, rand(.@x - .@cellRange, .@x + .@cellRange), rand(.@y - .@cellRange, .@y + .@cellRange), strnpcinfo(3) + "::OnCloneDied", getcharid(0);
				}
				else
				{
					deletearray $wbFighters[.@i], 1;
				}
			}
			break;
		case 360:
			//6 min
			mapannounce $lastPopMap$, "[ World Boss ] Raise! Raise, my army!", bc_map, 0xFF0000;
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@x, .@worldBossData[UMOB_X];
			set .@y, .@worldBossData[UMOB_Y];
			for(set .@i,0; .@i<getarraysize(.wbSlaveMobsId); set .@i,.@i+1)
			{
				for(set .@j,0; .@j<.wbSlaveMobsCount[.@i]; set .@j,.@j+1)
				{
					areamonster $lastPopMap$, .@x - .@cellRange * 2, .@y - .@cellRange * 2, .@x + .@cellRange * 2, .@y + .@cellRange * 2, "Slaves", .wbSlaveMobsId[.@i], 1, strnpcinfo(3) + "::OnSaveDied";  
				}
			}
			break;
		case 420:
			//7 min, autocast earthquake at 10% hp cost
			mapannounce $lastPopMap$, "[ World Boss ] STOP BOTHERING ME, HUMANS!", bc_map, 0xFF0000;
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@hp, .@worldBossData[UMOB_HP];
			set .@mhp, .@worldBossData[UMOB_MAXHP];
			set .@x, .@worldBossData[UMOB_X];
			set .@y, .@worldBossData[UMOB_Y];
			if(.@hp > 10 * .@mhp / 100)
			{
				//RATHENA
				setunitdata .wBossId, UMOB_HP, .@hp - 10 * .@mhp / 100;
				set .@id, .wbSlaveMobsId[rand(getarraysize(.wbSlaveMobsId) - 1)];
				areamobuseskill $lastPopMap$, .@x, .@y, .@cellRange * 2, .@id, 653, 3, 3000, 1, ET_KIK, 3;
			}
			else
			{
				//only world boss pop, but stronger
				areamobuseskill $lastPopMap$, .@x, .@y, .@cellRange * 2, .wBossIds[$lastPopIdRank], 653, 10, 3000, 1, ET_KIK, 3;
			}
			break;
		case 480:
			//8 min, wide bleeding
			mapannounce $lastPopMap$, "[ World Boss ] You don't even deserve me to fight you!", bc_map, 0xFF0000;
			areamobuseskill $lastPopMap$, .@x, .@y, 50, .wBossIds[$lastPopIdRank], 665, 5, 3000, 1, ET_KIK, 3;
			break;
		case 540:
			//9 min, random kill over fighters
			mapannounce $lastPopMap$, "[ World Boss ] Feel my rage! Limitless is my power!!", bc_map, 0xFF0000;
			set .@killCount, rand(getarraysize($wbFighters));
			for(set .@i,0; .@i<getarraysize($wbFighters); set .@i,.@i+1)
			{
				if(attachrid($wbFighters[.@i]) == 1 && strcharinfo(3) == $lastPopMap$)
				{
					charcommand "#nuke " + strcharinfo(0) + " " + strcharinfo(0);
				}
				else
				{
					deletearray $wbFighters[.@i], 1;
				}
			}
			break;
		case 600:
			//10 min, raise life according to alive clones
			mapannounce $lastPopMap$, "[ World Boss ] I'll feast from your bones!!", bc_map, 0xFF0000;
			set .@mobCount, mobcount($lastPopMap$, strnpcinfo(3) + "::OnReducedBossDied");
			killmonster $lastPopMap$, strnpcinfo(3) + "::OnReducedBossDied";
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@hp, .@worldBossData[UMOB_HP];
			set .@mhp, .@worldBossData[UMOB_MAXHP];
			if( .@hp + .@mobCount * 50000 > .@mhp )
				setunitdata .wBossId, UMOB_HP, .@mhp;
			else
				setunitdata .wBossId, UMOB_HP, .@hp + .@mobCount * 50000;
			break;
		case 660:
			//11 min, slave skill area
			mapannounce $lastPopMap$, "[ World Boss ] Life and death are nothing to me!", bc_map, 0xFF0000;
			//RATHENA
			getunitdata(.wBossId, .@worldBossData);
			set .@x, .@worldBossData[UMOB_X];
			set .@y, .@worldBossData[UMOB_Y];
			for(set .@i,0; .@i<getarraysize(.wbSlaveMobsId); set .@i,.@i+1)
			{
				//BASILICA 362 (5) OR EVILLAND 670 (1)
				if(rand(1) == 0)
				{
					areamobuseskill $lastPopMap$, .@x, .@y, .@cellRange * 2, .wbSlaveMobsId[.@i], 362, 5, 3000,1,ET_KIK,3;
				}
				else
				{
					areamobuseskill $lastPopMap$, .@x, .@y, .@cellRange * 2, .wbSlaveMobsId[.@i], 670, 1, 3000,1,ET_KIK,3;
				}
			}
			break;
	}
	setnpctimer 0;
	freeloop(0);
	end;
	
OnPCDieEvent:
	if(strcharinfo(3) == $lastPopMap$ && getarraysize(.wbMap$) == 1)
	{
		set .@rebirthArea, rand(4);
		warp $lastPopMap$, .rebirthXY[.@rebirthArea * 2], .rebirthXY[.@rebirthArea * 2 + 1];	 
		charcommand "#alive " + strcharinfo(0);
	}
	addtimer 10000, strnpcinfo(3) + "::OnPopClone";
	set .deadCount, .deadCount + 1;
	end;
	
OnPopClone:
	if(Hp > 0)
	{
		set .@cellRange, 25;
		//RATHENA
		getunitdata(.wBossId, .@worldBossData);
		set .@x, .@worldBossData[UMOB_X];
		set .@y, .@worldBossData[UMOB_Y];
		clone $lastPopMap$, rand(.@x - .@cellRange, .@x + .@cellRange), rand(.@y - .@cellRange, .@y + .@cellRange), strnpcinfo(3) + "::OnCloneDied", getcharid(0);
	}
	end;
	
OnSaveDied:
OnCloneDied:
OnReducedBossDied:
	//nothing, used to clean
	end;
	
OnWorldBossDied:
	stopnpctimer;
	set $wordBossPop, 0;
	donpcevent "World Boss#wb_board::OnEvent";
	killmonster $lastPopMap$, "All";
	announce "[ System ] "+strcharinfo(0)+" gave the final blow to the World Boss !",bc_all,0x0000FF;
	if (.special_reward_id && .special_reward_amount)
		getitem .special_reward_id, .special_reward_amount;
	callsub OnReward;
	end;

OnReward:
	if (!.reward_id_size && !.reward_zeny)
		return;
	if (.rewardMode == 3) {
		if (.rewardCount == -1) {
			set .rewardCount, getmapusers($lastPopMap$);
		}
		for (set .@i,0; .@i < .rewardCount; set .@i,.@i+1) {
			set .@rand, rand(getarraysize(.@reward_id));
			//edit 150 if the map length and height is different of 150 cell
			makeitem .reward_id[.@rand],.reward_amount[.@rand],$lastPopMap$,rand(150),rand(150); 
		}
		return;
	}
	if (.rewardMode) .@str$ = gettimestr("%B %d, %Y",21);
	freeloop(1);
	.@size = getmapunits(BL_PC,$lastPopMap$,.@aid[0]);
	if (.ip_check) {
		for ( .@j = 0; .@j < .@size; ++.@j ) {
		//	.@ip$ = replacestr(getcharip(.@aid[.@j]),".","");
			.@ip$ = getcharip(.@aid[.@j]);
			.@duplicate = inarray(.@iplist$, .@ip$);
			if (.@duplicate < 0)
				.@iplist$[.@iplistcount++] = .@ip$;
			else {
				message rid2name(.@aid[.@j]), "Another character with the same IP address has received the World Boss reward.";
				deletearray .@aid[.@j],1;
				.@j--;
			}
		}
		.@size = getarraysize(.@aid[0]);
	}
	for (.@j = 0; .@j < .@size; .@j++) {
		if (.rewardMode == 2) {
			.@charid = convertpcinfo(.@aid[.@j],CPC_CHAR);
			.@sender$ = "Rune-Midgarts Kingdom";
			.@title$ = "World Boss Reward";
			.@body$ = "Congratulations on defeating the World Boss!\r\n "+.@str$+".\r\n \r\n \r\n \r\n \r\n [ Your reward is attached. ]";

			if (.reward_id_size)
				mail .@charid, .@sender$, .@title$, .@body$, .reward_zeny, .reward_id, .reward_amount;
			else
				mail .@charid, .@sender$, .@title$, .@body$, .reward_zeny;

			if (PACKETVER < 20150513 && !getd(".@str_"+.@cid[.@j]) && .@online) {
				setd ".@str_"+.@cid[.@j],1;
				message rid2name(.@aid[.@j]),"You've got mail!";
			}
		}
		else {
			attachrid( .@aid[.@j], true );
			.@name$ = strcharinfo( 0 );
			for ( .@k = 0; .@k < .reward_id_size; .@k++ ) {
				if (checkweight(.reward_id[.@k], .reward_amount[.@k]))
					getitem .reward_id[.@k], .reward_amount[.@k];
				else
					dispbottom "You can't receive x" + .reward_amount[.@k] + " " + getitemname(.reward_id[.@k]) + " for defeating the World Boss because you're overweight.";
			}
			Zeny += .reward_zeny;
			dispbottom "You have been rewarded for defeating the World Boss.";
		}
	}
	return;
}

prontera,144,198,4	script	World Boss#wb_board	2_BOARD1,{
	mes "[World Boss]";
	if ($wordBossPop == 1) {
		mes "Hurry up, " + strcharinfo(0) + ".";
		mes "A World Boss threat has been raised, a few ago!";
		mes "We need all fighters to join!";
		if(select("Send me there","No way, I'm not going") == 1) {
			next;
			mes "[World Boss Area]";
			mes "Right, get ready.";
			set $wbFighters[getarraysize($wbFighters)], getcharid(3);
			warp $lastPopMap$, 0, 0;
		}
		else {
			next;
			mes "[World Boss Area]";
			mes "What are you? A coward?";
			mes "You'll be blessed when we all be dead...";
		}
	}
	else {
		mes "I'm the one you should come to visit when a World Boss will appear.";
		mes "And believe, it will.";
		mes "Those monsters are regular, in some kind.";
		mes "Al mortal, giant...And ridiculously strong...";
	}
	close;

OnInit:
OnTimer60000:
OnEvent:
	stopnpctimer;
	initnpctimer;
	delwaitingroom;
	if ($wordBossPop) {
		waitingroom "World Boss Alive",0;
		end;
	}
	.@time = ($WorldBoss_cd - gettimetick(2));
	if (.@time < 1) {
		donpcevent "alawboss::OnStarted";
		end;
	}
	.@remaining_d = .@time / 86400;
	.@remaining_h = (.@time % 86400) / 3600;
	.@remaining_m = (.@time % 3600) / 60;
	.@remaining_s = .@time % 60;
	if (.@remaining_d)
		.@s$[.@i++] = .@remaining_d + " day" + (.@remaining_d>1?"s":"");
	if (.@remaining_h)
		.@s$[.@i++] = .@remaining_h + " hour" + (.@remaining_h>1?"s":"");
	if (.@remaining_m)
		.@s$[.@i++] = .@remaining_m + " minute" + (.@remaining_m>1?"s":"");
	if (!.@remaining_d && !.@remaining_h && !.@remaining_m)
		.@s$[.@i++] = .@remaining_s + " second" + (.@remaining_s>1?"s":"");
	waitingroom implode(.@s$," "),0;
	end;
}

 

Thank you🙏🏼🙏🏼 I test it is good🤙🏻 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...