// TMW Script.
// Author:
// Jesusalva
// Notes:
// Christmas 2021 - Configuration Files
function script X21ID {
return (getcharid(1) > 0 ? getcharid(1) : getcharid(3));
}
function script X21ID2 {
return (getcharid(1) > 0 ? getcharid(1) : getcharid(0));
}
function script X21TYPE {
return (getcharid(1) > 0 ? IOT_PARTY : IOT_CHAR);
}
function script X21BC1_CLEAR {
return (XMAS2021 & X21_BOSSDEFEAT);
}
function script X21BC1_DOCLEAR {
XMAS2021 = (XMAS2021 | X21_BOSSDEFEAT);
return;
}
function script X21ED1_CLEAR {
return (XMAS2021 & X21_ALYSSARESCUE);
}
function script X21ED1_DOCLEAR {
XMAS2021 = (XMAS2021 | X21_ALYSSARESCUE);
return;
}
function script X21SEED_CHECK {
/* Protip: You don't have to fill all spots
*
* If you plant a "L" it also works
* This is because "L" is the first letter of "Lazy"
* And I was particularly lazy to make a proper script
*/
if ('XMAS21TREE) return false;
// NOTE: We could check here if player already finished this
// And skip the challenge after planting one tree?
if (!'XMAS21TREE_X[116]) return false;
if (!'XMAS21TREE_X[117]) return false;
if (!'XMAS21TREE_X[118]) return false;
if (!'XMAS21TREE_X[119]) return false;
if (!'XMAS21TREE_X[120]) return false;
if (!'XMAS21TREE_Y[168]) return false;
if (!'XMAS21TREE_Y[169]) return false;
if (!'XMAS21TREE_Y[170]) return false;
// This instance challenge is over
'XMAS21TREE = true;
// Record on player as well, just to be safe.
if (XMAS2021 & X21_PLANTPUZZLE) return true;
XMAS2021 = (XMAS2021 | X21_PLANTPUZZLE);
return true;
}
function script X21_SEEDS {
getmapxy(.@m$, .@x, .@y, 0);
// If planted in the wrong region, vanish without effect
if (.@m$ != "0812@"+X21ID2())
return;
if (.@x < 107 || .@x > 126)
return;
if (.@y < 159 || .@y > 177)
return;
// Should never happen, so nuke everything
if (instance_id() < 0) end;
// Already planted this spot
if ('XMAS21TREE_X[.@x] && 'XMAS21TREE_Y[.@y]) return;
// Record the success planting it
'XMAS21TREE_X[.@x] = true;
'XMAS21TREE_Y[.@y] = true;
// Sprout a Christmas Tree IF position was not already filled
monster(.@m$, .@x, .@y, strmobinfo(1, ChristmasTree), ChristmasTree, 1, "#XMAS21Core::OnX1164");
// Unlock the gate once the puzzle is complete
if (X21SEED_CHECK()) {
delcells("X21L2@"+X21ID());
specialeffect(FX_MAGIC_WICKED_SPAWN, AREA, getcharid(3));
}
return;
}
function script X21QUESTON {
// Create and setup the challenge. Allow to reset quest.
XMAS2021 = X21_ACCEPTED;
/* Prepare something */
return;
}
function script X21INIT {
.@inst = instance_create("Northen Lights", X21ID(), X21TYPE());
// Instance must be created
if (.@inst >= 0) {
// We... Could use base name, actually, but whatever
.@mapa$ = "0812@"+X21ID2(); // Northern Lights
.@mapb$ = "0813@"+X21ID2(); // Existential Frontier
.@mapc$ = "0803@"+X21ID2(); // Forgotten/Mystic/Peaceful Glade
.@mapd$ = "0801@"+X21ID2(); // Peaceful Glade (Present)
instance_attachmap("081-2", .@inst, false, .@mapa$);
instance_attachmap("081-3", .@inst, false, .@mapb$);
instance_attachmap("080-3", .@inst, false, .@mapc$);
instance_attachmap("080-1", .@inst, false, .@mapd$);
instance_set_timeout(1800, 1800, .@inst);
instance_init(.@inst);
/* Create locks */
setcells .@mapa$, 103, 211, 107, 212, 1, "X21L1@"+X21ID();
setcells .@mapa$, 124, 127, 131, 128, 1, "X21L2@"+X21ID();
setcells .@mapa$, 47, 71, 51, 72, 1, "X21L3@"+X21ID();
/* Spawn Special Monsters */
"#XMAS21Core"::spawn(Grinchboo, 5, .@mapa$);
"#XMAS21Core"::spawn(Grinchboo, 3, .@mapc$);
"#XMAS21Core"::spawn2(Koyntety, 70, 250, 99, 265, 1, .@mapa$);
"#XMAS21Core"::spawn2(BlueSpark, 47, 191, 65, 212, 2, .@mapa$);
"#XMAS21Core"::spawn2(RedSpark, 47, 191, 65, 212, 2, .@mapa$);
/* Northern Lights Dungeon */
"#XMAS21Core"::spawn(WhiteSlime, 37, .@mapa$);
"#XMAS21Core"::spawn(Archant, 7, .@mapa$);
//"#XMAS21Core"::spawn(BlueSpark, 1, .@mapa$); //?
//"#XMAS21Core"::spawn(RedSpark, 1, .@mapa$); //?
"#XMAS21Core"::spawn(AzulSlime, 20, .@mapa$);
"#XMAS21Core"::spawn(SantaSlime, 24, .@mapa$);
"#XMAS21Core"::spawn(Moggun, 30, .@mapa$);
"#XMAS21Core"::spawn(Yeti, 4, .@mapa$);
"#XMAS21Core"::spawn(Wisp, 5, .@mapa$);
"#XMAS21Core"::spawn(Poltergeist, 12, .@mapa$);
"#XMAS21Core"::spawn(Spectre, 5, .@mapa$);
"#XMAS21Core"::spawn(ManaGhost, 14, .@mapa$);
"#XMAS21Core"::spawn(IceElement, 3, .@mapa$);
"#XMAS21Core"::spawn(IceSkull, 2, .@mapa$);
"#XMAS21Core"::spawn(Nutcracker, 6, .@mapa$);
"#XMAS21Core"::spawn(Fluffy, 16, .@mapa$);
/* Peaceful/Mystic/Forgotten Glade (Past) */
"#XMAS21Core"::spawn(CrotcherScorpion, 14, .@mapc$);
"#XMAS21Core"::spawn(Snail, 22, .@mapc$);
"#XMAS21Core"::spawn(Bee, 9, .@mapc$);
"#XMAS21Core"::spawn(Butterfly, 27, .@mapc$);
"#XMAS21Core"::spawn(PinkFlower, 42, .@mapc$);
"#XMAS21Core"::spawn(Pinkie, 36, .@mapc$);
"#XMAS21Core"::spawn(Hyvern, 6, .@mapc$);
"#XMAS21Core"::spawn(WitchGuard, 8, .@mapc$);
/* Peaceful/Mystic/Forgotten Glade (Present) */
"#XMAS21Core"::spawn(Fluffy, 9, .@mapd$);
"#XMAS21Core"::spawn(Snail, 11, .@mapd$);
"#XMAS21Core"::spawn(Bee, 5, .@mapd$);
"#XMAS21Core"::spawn(Butterfly, 15, .@mapd$);
"#XMAS21Core"::spawn(PinkFlower, 24, .@mapd$);
"#XMAS21Core"::spawn(Pinkie, 18, .@mapd$);
"#XMAS21Core"::spawn(Hyvern, 3, .@mapd$);
}
if (instance_id() >= 0)
instance_set_timeout(1800, 1800);
return;
}
/* You cannot fiddle with party in this region */
080-1 mapflag partylock
080-3 mapflag partylock
//081-1 mapflag partylock
081-2 mapflag partylock
081-3 mapflag partylock
081-2 mapflag bexp 125
080-3 mapflag bexp 125
080-1 mapflag bexp 125
/* Secure regions */
081-3 mapflag zone MMO
081-3 mapflag nosave 081-1,68,31
- script #XMAS21Core NPC_HIDDEN,{
end;
// "#XMAS21Core"::spawn(MonsterID, {Amount=1, {Map=this}})
public function spawn {
if (playerattached())
.@m$=getarg(2, getmap());
else
.@m$=getarg(2);
.@n$="#XMAS21Core::On"+getarg(0);
if (mobcount(.@m$, .@n$) < 200)
areamonster .@m$, 20, 20, getmapinfo(MAPINFO_SIZE_X, .@m$)-20, getmapinfo(MAPINFO_SIZE_Y, .@m$)-20, strmobinfo(1, getarg(0)), getarg(0), getarg(1, 1), .@n$;
/* Aqua Ticket Drops */
if (playerattached()) {
if (instance_id() < 0) return; // No drops outside instanced maps
if (getmonsterinfo(getarg(0), MOB_LV) >= 150)
getitem AquaTicket, 2;
else if (getmonsterinfo(getarg(0), MOB_LV) >= 100 && any(true, false))
getitem AquaTicket, 2;
else if (getmonsterinfo(getarg(0), MOB_LV) >= 40 && any(true, false, false))
getitem AquaTicket, 1;
else if (rand2(5) == 3)
getitem AquaTicket, 1;
}
return;
}
// "#XMAS21Core"::spawn2(MonsterID, X1, Y1, X2, Y2, {Amount=1, {Map=this}})
// Function Changes from On<ID> to OnX<ID>
public function spawn2 {
.@m$=getarg(6, getmap());
.@n$="#XMAS21Core::OnX"+getarg(0);
.@x1=max(getarg(1), 20);
.@y1=max(getarg(2), 20);
.@x2=min(getarg(3), getmapinfo(MAPINFO_SIZE_X, .@m$)-20);
.@y2=min(getarg(4), getmapinfo(MAPINFO_SIZE_Y, .@m$)-20);
/*
// Radius-based, was scrapped in favor of rectangles
.@x1=max(getarg(1)-getarg(3), 20);
.@y1=max(getarg(2)-getarg(3), 20);
.@x2=min(getarg(1)+getarg(3), getmapinfo(MAPINFO_SIZE_X, .@m$)-20);
.@y2=min(getarg(2)+getarg(3), getmapinfo(MAPINFO_SIZE_Y, .@m$)-20);
*/
if (mobcount(.@m$, .@n$) < 200)
areamonster .@m$, .@x1, .@y1, .@x2, .@y2, strmobinfo(1, getarg(0)), getarg(0), getarg(5, 1), .@n$;
return;
}
/* Special */
// Sparkles Chamber, drops seeds
OnX1080:
OnX1081:
spawn2(any(BlueSpark, RedSpark), 47, 191, 65, 212);
/* Give player enough seeds */
getmapxy(.@m$, .@x, .@y, 0);
.@x1=.@x-1;
.@y1=.@y-1;
.@x2=.@x+1;
.@y2=.@y+1;
.@x=cap_value(rand2(.@x1, .@x2), 47, 65);
.@y=cap_value(rand2(.@y1, .@y2), 191, 212);
makeitem(XmasSeeds, rand2(1, 3), .@m$, .@x, .@y);
end;
// Mini-Boss Chamberlain, drops candle
OnX1146:
OnX1147:
spawn2(any(Flashmob, Koyntety), 70, 250, 99, 265);
/* Give player enough fuel potions */
getmapxy(.@m$, .@x, .@y, 0);
.@x1=.@x-1;
.@y1=.@y-1;
.@x2=.@x+1;
.@y2=.@y+1;
.@x=cap_value(rand2(.@x1, .@x2), 70, 99);
.@y=cap_value(rand2(.@y1, .@y2), 250, 265);
makeitem(ThermalNapalm, rand2(3, 5), .@m$, .@x, .@y);
end;
// Christmas Tree, spawns a (few?) gift boxes
OnX1164:
getmapxy(.@m$, .@x, .@y, 0);
.@x1=.@x-2;
.@y1=.@y-2;
.@x2=.@x+2;
.@y2=.@y+2;
.@x=cap_value(rand2(.@x1, .@x2), 47, 65);
.@y=cap_value(rand2(.@y1, .@y2), 191, 212);
spawn2(ChristmasGift, .@x1, .@y1, .@x2, .@y2, rand2(1, 3));
end;
// Christmas Gift Box, gives you Tickets
OnX1165:
getmapxy(.@m$, .@x, .@y, 0);
.@x1=.@x-2;
.@y1=.@y-2;
.@x2=.@x+2;
.@y2=.@y+2;
.@x=cap_value(rand2(.@x1, .@x2), 47, 65);
.@y=cap_value(rand2(.@y1, .@y2), 191, 212);
makeitem(AquaTicket, any(1, 1, 2), .@m$, .@x, .@y);
end;
/* Experimental */
On1162:
spawn(Grinchboo, 2);
end;
/* Ice Caves */
On1093:
spawn(WhiteSlime);
end;
On1060:
spawn(Archant);
end;
On1080:
spawn(BlueSpark);
end;
On1081:
spawn(RedSpark);
end;
On1100:
spawn(AzulSlime);
end;
On1015:
spawn(SantaSlime);
end;
On1061:
spawn(Moggun);
end;
On1072:
spawn(Yeti);
end;
On1040:
spawn(Wisp);
end;
On1047:
spawn(Poltergeist);
end;
On1042:
spawn(Spectre);
end;
On1125:
spawn(ManaGhost);
end;
On1071:
spawn(IceElement);
end;
On1085:
spawn(IceSkull);
end;
On1114:
spawn(Nutcracker);
end;
On1020:
spawn(Fluffy);
end;
/* Woodlands */
On1084:
spawn(CrotcherScorpion);
end;
On1041:
spawn(Snail);
end;
On1049:
spawn(Bee);
end;
On1055:
spawn(Butterfly);
end;
On1014:
spawn(PinkFlower);
end;
On1018:
spawn(Pinkie);
end;
On1088:
spawn(Hyvern);
end;
On1103:
spawn(WitchGuard);
end;
/* Ambush */
On1140:
spawn(Tengu);
end;
On1138:
spawn(ManaGuardian);
end;
On1143:
spawn(ManaSlayer);
end;
On1150:
spawn(ManaTyrant);
end;
On1147:
spawn(Koyntety);
end;
On1146:
spawn(Flashmob);
end;
/* Other Christmas settings */
OnInstanceInit:
/* Prepare the color code */
'COLORCODE[0] = rand2(0, 2);
'COLORCODE[1] = rand2(0, 2);
'COLORCODE[2] = rand2(0, 2);
'COLORCODE[3] = rand2(0, 2);
'COLORCODE[4] = rand2(0, 2);
'COLORCODE[5] = rand2(0, 2);
end;
OnInit:
/* Aethyra - Frontier Town */
"#XMAS21Core"::spawn(Fluffy, 16, "081-1");
"#XMAS21Core"::spawn(Poltergeist, 7, "081-1");
"#XMAS21Core"::spawn(Wisp, 7, "081-1");
"#XMAS21Core"::spawn(Spectre, 7, "081-1");
"#XMAS21Core"::spawn(WhiteSlime, 12, "081-1");
"#XMAS21Core"::spawn(SantaSlime, 3, "081-1");
"#XMAS21Core"::spawn(Moggun, 18, "081-1");
end;
}