Skip to content

Instantly share code, notes, and snippets.

@AnnieRuru
Created October 26, 2020 06:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AnnieRuru/d0e99d26f560f6622350ee8b82d70aec to your computer and use it in GitHub Desktop.
Save AnnieRuru/d0e99d26f560f6622350ee8b82d70aec to your computer and use it in GitHub Desktop.
//===== 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($lastPopMap$);
}
freeloop true;
getmapxy .@map$, .@x, .@y, UNITTYPE_PC;
.@area = getbattleflag("area_size");
for(set .@i,0; .@i<.rewardCount; set .@i,.@i+1)
{
//edit 150 if the map length and height is different of 150 cell
while (checkcell(.@map$, .@x2 = rand(.@x - .@area, .@x + .@area), .@y2 = rand(.@y - .@area, .@y + .@area), cell_chknopass));
makeitem .@rewardId[rand(getarraysize(.@rewardId))], 1, $lastPopMap$, .@x2, .@y2;
}
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$, "guild_vs2";
set $wordBossPop, 0;
setarray .wbMap$[0],
"guild_vs2";
setarray .wbMapName$[0],
"guild_vs2";
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;
}
prontera,155,185,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;
}
/*
guild_vs2 mapflag nomobloot
prontera,160,180,5 script kjdsfksjdh 1_F_MARIA,{
getmapxy .@map$, .@x, .@y, UNITTYPE_PC;
freeloop true;
.@rewardId = Gold;
.@area = getbattleflag("area_size");
set .rewardCount, getmapusers(.@map$);
for(set .@i,0; .@i<.rewardCount; set .@i,.@i+1) {
while (checkcell(.@map$, .@x2 = rand(.@x - .@area, .@x + .@area), .@y2 = rand(.@y - .@area, .@y + .@area), cell_chknopass));
makeitem .@rewardId[rand(getarraysize(.@rewardId))], 1, .@map$, .@x2, .@y2;
}
end;
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment