Jump to content
  • 0
Sign in to follow this  
Kuroyama

World Boss Invasion Script

Question

Spoiler

 


//===== Script =======================================
//= World Boss Apparition
//===== Par: =================================================
//= Alayne
//===== Version du Script: =================================== 
//= 1.0 Creation
//===== Compatible Avec: =====================================
//= eAthena TxT & SQL
//===== Commentaires =========================================

-	script	WorldBoss::alawboss	-1,{

OnStartWBoss:
	.@force = 1;
OnClock0330:
OnClock0630:
OnClock0830:
OnClock1030:
OnClock1230:
OnClock1524:
OnClock1630:
OnClock1830:
OnClock2030:
OnClock2230:
	if(.nextPopDay <= 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];
		//HERCULES
		set .wBossId, monster(.wbMap$[.@spawnRand],0, 0,.wBossName$[.lastRandId],.wBossIds[.lastRandId],1,strnpcinfo(3) + "::OnWorldBossDied",2); 
		setunitdata(.wBossId, UDT_MAXHP, .wBossHp[.@spawnRand]);
		
		set .@chosenMap$, .@chosenMap$ + .wbMapName$[.@spawnRand] + "]";
		
		announce "[ System ] World Boss appeared in " + .@chosenMap$ + " !",bc_all,0xFF0000;
		set .nextPopDay, gettimetick(2) + 259200; //next pop in 3 days, 60 for debug (1 min)
		
		set $lastPopMap$, .wbMap$[.@spawnRand];
		set $lastPopIdRank, .@spawnRand;
		deletearray $wbFighters[0], getarraysize($wbFighters);
		set $wordBossPop, 1;
		set .deadCount, 0;
		
		set .timerCount, 0;
		initnpctimer;
	}
	else
	{
		if(.debug == 1)
		{
			consolemes(CONSOLEMES_DEBUG, "Not ready yet.");		
		}
	}
	end;
	
OnTimer1000:	
	set .timerCount, .timerCount + 10;
	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];
			//HERCULES
			getmapxy(.@map$, .@x, .@y, UNITTYPE_MOB, .wBossId);
			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];
			//HERCULES
			getmapxy(.@map$, .@x, .@y, UNITTYPE_MOB, .wBossId);
			for(set .@i,0; .@i<getarraysize(.wbSlaveMobsId); set .@i,.@i+1)
			{
				areamobuseskill $lastPopMap$, .@x, .@y, .@cellRange * 2, .wbSlaveMobsId[.@i], .wbSummonSkillId[.lastRandId], 5, 3000,1,e_gg,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];
			//HERCULES
			set .@hp, getunitdata(.wBossId, UDT_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;
				//HERCULES
				setunitdata .@tempMobId[.@i], UDT_MAXHP, .@tempHp;
				setunitdata .@tempMobId[.@i], UDT_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];
			//HERCULES
			getmapxy(.@map$, .@x, .@y, UNITTYPE_MOB, .wBossId);
			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];
			//HERCULES
			getmapxy(.@map$, .@x, .@y, UNITTYPE_MOB, .wBossId);
			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];
			//HERCULES
			getmapxy(.@map$, .@x, .@y, UNITTYPE_MOB, .wBossId);
			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];
			//HERCULES
			set .@hp, getunitdata(.wBossId, UDT_HP);
			set .@mhp, getunitdata(.wBossId, UDT_MAXHP);
			getmapxy(.@map$, .@x, .@y, UNITTYPE_MOB, .wBossId);
			if(.@hp > 10 * .@mhp / 100)
			{
				//RATHENA
				//setunitdata .wBossId, UMOB_HP, .@hp - 10 * .@mhp / 100;
				//HERCULES
				setunitdata .wBossId, UDT_HP, .@hp - 10 * .@mhp / 100;
				set .@id, .wbSlaveMobsId[rand(getarraysize(.wbSlaveMobsId) - 1)];
				areamobuseskill $lastPopMap$, .@x, .@y, .@cellRange * 2, .@id, 653, 3, 3000, 1, e_gg, 3;
			}
			else
			{
				//only world boss pop, but stronger
				areamobuseskill $lastPopMap$, .@x, .@y, .@cellRange * 2, .wBossIds[$lastPopIdRank], 653, 10, 3000, 1, e_gg, 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, e_gg, 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;
			//HERCULES
			set .@hp, getunitdata(.wBossId, UDT_HP);
			set .@mhp, getunitdata(.wBossId, UDT_MAXHP);
			if( .@hp + .@mobCount * 50000 > .@mhp )
				setunitdata .wBossId, UDT_HP, .@mhp;
			else
				setunitdata .wBossId, UDT_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];
			//HERCULES
			getmapxy(.@map$, .@x, .@y, UNITTYPE_MOB, .wBossId);
			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,e_gg,3;
				}
				else
				{
					areamobuseskill $lastPopMap$, .@x, .@y, .@cellRange * 2, .wbSlaveMobsId[.@i], 670, 1, 3000,1,e_gg,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];
		//HERCULES
		getmapxy(.@map$, .@x, .@y, UNITTYPE_MOB, .wBossId);
		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;
	killmonster $lastPopMap$, "all";
	setarray .@rewardId[0],
		969; //gold
	announce "[ System ] "+strcharinfo(0)+" just killed a World Boss !",bc_all,0x0000FF;		
	if(.rewardCount == 1)
	{
		set .rewardCount, getmapusers(strnpcinfo(4)) - 1;
	}
	for(set .@i,0; .@i<.rewardCount; set .@i,.@i+1)
	{
		set .@randItem, rand(0,getarraysize(.@rewardId) - 1);
		//edit 150 if the map length and height is different of 150 cell
		makeitem .@rewardId[.@randItem],1,$lastPopMap$,rand(150),rand(150); 
	}
	set $wordBossPop, 0;
	end;

OnInit:	
	set .rewardCount, 1;
	set .timerCount, 0;
	set .bossAliveDuration, 30; //in minutes
	set .debug, 1;
	setarray .rebirthXY[0],120,202,202,120,119,37,37,119; //X, then Y. Only used if only one map is used
	set $lastPopMap$, "prontera";
	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;
	bindatcmd "worldboss", strnpcinfo(3) + "::OnStartWBoss";
	end;
}

askald,155,85,5	script	World Class Master::alawcm	4_M_CATMAN2,{
	mes "[World Class Master]";
	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;
}

 

 

 

So uhh, found this simple world boss invasion. It's all ready and good, but one thing I would like to request some help is the reward system is not working.

After killing the Boss monster, no reward is given. There's no error I received in the script after killing the boss monster except [Debug]: mapindex_name2id: Map "" not found in index list!.

Edited by Kuroyama

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0
set .rewardCount, getmapusers(strnpcinfo(4)) - 1;

change strnpcinfo(4) into $lastPopMap$

 

by the way the condition down below might not work,

we don't have *getfreecell script command to search for a free cell to drop items

 

while(checkcell ... trick might work, but might take a lot goto_count .... though

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.