// TMW Script.
// Author:
// Jesusalva
// Notes:
// Christmas 2021 - Northen Lights Dungeon
081-2,90,20,0 script #0812Nexit NPC_HIDDEN,0,0,{
end;
OnTouch:
if (!isChristmas21()) end;
/* We need to determine if instance exists and is needed */
X21INIT();
.@mapn$="0813@"+X21ID2();
warp .@mapn$, 44, 49;
// FIXME: Cleanup if inst returns -4
//doevent instance_npcname("Pentagram#Xmas21A", .@inst)+"::OnClean";
end;
}
/* *************************************************************************** */
/* Candle Puzzle */
081-2,130,255,0 script #X21Candle_0 NPC_NO_SPRITE,{
if (!countitem(ThermalNapalm)) { dispbottom(l("I don't have anything to lit this candle.")); end; }
if ('XMAS21CANDLE) end;
// Extract ID
.@n$=strnpcinfo(2, "_-1");
explode(.@ni$, .@n$, "_");
.@id=atoi(.@ni$[1]);
if (.@id < 0) { consolemes(CONSOLEMES_ERROR, "ERROR, X21 Invalid Candle"); end; }
.@c = 'X21_CANDLE[.@id];
.@c$ = (.@c == 0 ? l("No") : (.@c == 1 ? l("Regular") : l("Magic")));
mes l("This candle is using %s Fire.", .@c$);
mes l("Do you want to change it?");
mesc l("Cost: 1x %s", getitemlink(ThermalNapalm)), 1;
next;
menuint
l("No, leave it alone."), -1,
rif(.@c != 1, l("Lit a regular fire.")), 1,
rif(.@c != 2, l("Lit a magic fire.")), 2,
rif(.@c != 0, l("Remove the fire.")), 0;
mes "";
if (@menuret < 0) { closeclientdialog; close; }
delitem ThermalNapalm, 1;
'X21_CANDLE[.@id] = @menuret;
// Modify the flame sprite
setnpcdisplay(instance_npcname(strnpcinfo(0)), (@menuret ? (@menuret == 1 ? NPC436 : NPC437) : NPC_NO_SPRITE));
//debugmes "Sprite %s (%s) to %d", strnpcinfo(0), instance_npcname(strnpcinfo(0)), (@menuret ? (@menuret == 1 ? NPC436 : NPC437) : NPC_NO_SPRITE);
// What about 374 instead of 437?
// Unlock the gate once the puzzle is complete
if (X21CANDLE_CHECK()) {
delcells("X21L1@"+X21ID());
specialeffect(FX_MAGIC_WICKED_SPAWN, AREA, getcharid(3));
getexp X21_EXP_PUZZLE, 0;
getitem XmasTicket, X21_TICKET_PUZZLE;
X21INIT();
}
closeclientdialog;
close;
OnInit:
.distance=1;
end;
}
081-2,131,257,0 duplicate(#X21Candle_0) #X21Candle_1 NPC_NO_SPRITE
081-2,132,249,0 duplicate(#X21Candle_0) #X21Candle_2 NPC_NO_SPRITE
081-2,133,253,0 duplicate(#X21Candle_0) #X21Candle_3 NPC_NO_SPRITE
081-2,134,258,0 duplicate(#X21Candle_0) #X21Candle_4 NPC_NO_SPRITE
081-2,135,251,0 duplicate(#X21Candle_0) #X21Candle_5 NPC_NO_SPRITE
081-2,79,279,0 script Hint#X21C0 NPC_NO_SPRITE,{
.@c = 0;
.@c += ('COLORCODE[0] ? 0 : 1);
.@c += ('COLORCODE[1] ? 0 : 1);
.@c += ('COLORCODE[2] ? 0 : 1);
.@c += ('COLORCODE[3] ? 0 : 1);
.@c += ('COLORCODE[4] ? 0 : 1);
.@c += ('COLORCODE[5] ? 0 : 1);
dispbottom l("%d candles should always be off.", .@c);
end;
OnInit:
.distance=1;
end;
}
081-2,65,274,0 script Hint#X21C1 NPC_NO_SPRITE,{
.@c = 0;
.@c += ('COLORCODE[0] == 1 ? 1 : 0);
.@c += ('COLORCODE[1] == 1 ? 1 : 0);
.@c += ('COLORCODE[2] == 1 ? 1 : 0);
.@c += ('COLORCODE[3] == 1 ? 1 : 0);
.@c += ('COLORCODE[4] == 1 ? 1 : 0);
.@c += ('COLORCODE[5] == 1 ? 1 : 0);
dispbottom l("%d candles should use regular fire.", .@c);
end;
OnInit:
.distance=1;
end;
}
081-2,51,271,0 script Hint#X21C2 NPC_NO_SPRITE,{
if ('COLORCODE[0] == 2)
dispbottom l("The leftmost candle is magical.");
else if ('COLORCODE[5] == 2)
dispbottom l("The rightmost candle is magical.");
else
dispbottom l("Neither extremes are magical.");
OnInit:
.distance=1;
end;
}
081-2,41,267,0 script Hint#X21C3 NPC_NO_SPRITE,{
if ('COLORCODE[0] == 'COLORCODE[5])
dispbottom l("The leftmost and the rightmost candle are identical.");
else
dispbottom l("The extremes are different.");
OnInit:
.distance=1;
end;
}
081-2,51,247,0 script Hint#X21C4 NPC_NO_SPRITE,{
.@n$ = ('COLORCODE[2] ? ('COLORCODE[2] == 1 ? "Regular" : "Magical") : "No");
dispbottom l("The northmost candle should use %s Fire.", .@n$);
OnInit:
.distance=1;
end;
}
081-2,63,236,0 script Hint#X21C5 NPC_NO_SPRITE,{
.@n$="";
if (!'COLORCODE[3])
.@n$=('OBSCURECOLOR ? "Regular" : "Magical");
else if ('COLORCODE[3] == 1)
.@n$=('OBSCURECOLOR ? "No" : "Magical");
else
.@n$=('OBSCURECOLOR ? "Regular" : "No");
dispbottom l("The central candle should NOT use %s Fire.", .@n$);
OnInit:
.distance=1;
end;
}
081-2,88,257,0 script Hint#X21C6 NPC_NO_SPRITE,{
.@c=('COLORCODE[1]+'COLORCODE[4]);
if (.@c <= 1)
.@n$="Bleakness";
else if (.@c >= 3)
.@n$="Brightness, perhaps Magical Fire";
else
.@n$="either Regular Fire, or they may diverge";
dispbottom l("The two southern candles lean towards %s.", .@n$);
OnInit:
.distance=1;
end;
}
081-2,103,213,0 script #X21Barrier1 NPC_HIDDEN,4,1,{
@inst = instance_id();
if (!'XMAS21CANDLE)
npctalkonce l("The strong shall yield the powder to enlighten the way, according to the established sequence.");
end;
OnInit:
.distance=1;
end;
}
/* *************************************************************************** */
/* Seeds Puzzle - See 2021.txt */
081-2,127,129,0 script #X21Barrier2 NPC_HIDDEN,4,0,{
if (!'XMAS21TREE)
npctalkonce l("In this year Christmas, kids shall play ball. Once the Christmas Tree is set, the festivities may proceed.");
end;
OnInit:
.distance=1;
end;
}
081-2,118,169,0 script #X21SeedFlag NPC_NO_SPRITE,{
if (!'XMAS21TREE)
npctalkonce l("The leaves in a room, the objects from the other; When they merge together, the festivities shall proceed.");
end;
OnPlant:
getmapxy(.@m$, .@x, .@y, 0);
// Should never happen, so nuke everything
if (instance_id() < 0) end;
// Already planted this spot
if ('XMAS21TREE_X[.@x] && 'XMAS21TREE_Y[.@y]) end;
// 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));
getexp X21_EXP_PUZZLE, 0;
getitem XmasTicket, X21_TICKET_PUZZLE;
X21INIT();
}
end;
OnInit:
.distance=2;
end;
}
/* *************************************************************************** */
/* Ambush Puzzle */
081-2,49,73,0 script #X21Barrier3 NPC_HIDDEN,2,0,{
if (!'XMAS21AMBUSH)
npctalkonce l("One room, Seventeen buttons, Three truths, and a lever to bring joy to the children.");
end;
OnInit:
.distance=1;
end;
}
081-2,112,90,0 script Nutcracker O'Panel#X21 NPC_NO_SPRITE,{
if ('XMAS21AMBUSH)
end;
mes l("This Nutcracker has a lever on it.");
mesc l("Do you flip it?"), 1;
next;
if (askyesno() == ASK_NO) {
closeclientdialog;
close;
}
.@goal = (2**'AMBUSHTRI[0]) + (2**'AMBUSHTRI[1]) + (2**'AMBUSHTRI[2]);
if ('AMBUSH_BMASK == .@goal) {
npctalk l("*beep*");
delcells("X21L3@"+X21ID());
'XMAS21AMBUSH = true;
specialeffect(FX_MAGIC_WICKED_SPAWN, AREA, getcharid(3));
getexp X21_EXP_PUZZLE, 0;
getitem XmasTicket, X21_TICKET_PUZZLE;
X21INIT();
} else {
npctalk l("*click*");
}
'AMBUSH_BMASK = 0;
.@amb = any(ManaGuardian, ManaGuardian, ManaSlayer, (X21TYPE() == IOT_PARTY ? ManaTyrant : ManaGuardian), Tengu, Sasquatch);
areamonster getmap(), 108, 82, 128, 102, strmobinfo(1, .@amb), .@amb, 1;
closeclientdialog;
close;
OnInit:
.distance=1;
end;
}
081-2,117,87,0 script Star of Bethlem#X21_0 NPC_NO_SPRITE,{
if ('XMAS21AMBUSH)
end;
// Extract ID
.@n$=strnpcinfo(2, "_-1");
explode(.@ni$, .@n$, "_");
.@id=atoi(.@ni$[1]);
if (.@id < 0) { consolemes(CONSOLEMES_ERROR, "ERROR, X21 Invalid Ambush Hint"); end; }
.@n='AMBUSHTRI[.@id]+2; // Account for the invisible frame
.@c=(.@n % 5 == 0) ? 5 : (.@n % 5);
.@r=(.@n / 5)+((.@n % 5 == 0) ? 0 : 1);
npctalkonce l("%s column, %s row", X21SRLZ(.@c), X21SRLZ(.@r));
end;
OnInit:
.distance=1;
end;
}
081-2,124,94,0 duplicate(Star of Bethlem#X21_0) Canes#X21_1 NPC_NO_SPRITE
081-2,120,100,0 duplicate(Star of Bethlem#X21_0) Crown#X21_2 NPC_NO_SPRITE
081-2,60,118,0 script Switch#X21AB_1 NPC_NO_SPRITE,{
if ('XMAS21AMBUSH)
end;
// Extract ID
.@n$=strnpcinfo(2, "_0");
explode(.@ni$, .@n$, "_");
.@id=atoi(.@ni$[1]);
if (.@id < 1) { consolemes(CONSOLEMES_ERROR, "ERROR, X21 Invalid Ambush Switch"); end; }
// Already flipped
.@bit=(2**.@id);
if ('AMBUSH_BMASK & .@bit)
end;
mesc l("There is a switch here.");
mesc l("Do you flip it?"), 1;
next;
if (askyesno() == ASK_YES) {
'AMBUSH_BMASK = 'AMBUSH_BMASK | .@bit;
npctalk l("*click*");
}
closeclientdialog;
close;
OnInit:
.distance=1;
end;
}
081-2,65,118,0 duplicate(Switch#X21AB_1) Switch#X21AB_2 NPC_NO_SPRITE
081-2,70,118,0 duplicate(Switch#X21AB_1) Switch#X21AB_3 NPC_NO_SPRITE
081-2,50,123,0 duplicate(Switch#X21AB_1) Switch#X21AB_4 NPC_NO_SPRITE
081-2,55,123,0 duplicate(Switch#X21AB_1) Switch#X21AB_5 NPC_NO_SPRITE
081-2,60,123,0 duplicate(Switch#X21AB_1) Switch#X21AB_6 NPC_NO_SPRITE
081-2,65,123,0 duplicate(Switch#X21AB_1) Switch#X21AB_7 NPC_NO_SPRITE
081-2,70,123,0 duplicate(Switch#X21AB_1) Switch#X21AB_8 NPC_NO_SPRITE
081-2,50,128,0 duplicate(Switch#X21AB_1) Switch#X21AB_9 NPC_NO_SPRITE
081-2,55,128,0 duplicate(Switch#X21AB_1) Switch#X21AB_10 NPC_NO_SPRITE
081-2,60,128,0 duplicate(Switch#X21AB_1) Switch#X21AB_11 NPC_NO_SPRITE
081-2,65,128,0 duplicate(Switch#X21AB_1) Switch#X21AB_12 NPC_NO_SPRITE
081-2,70,128,0 duplicate(Switch#X21AB_1) Switch#X21AB_13 NPC_NO_SPRITE
081-2,50,133,0 duplicate(Switch#X21AB_1) Switch#X21AB_14 NPC_NO_SPRITE
081-2,55,133,0 duplicate(Switch#X21AB_1) Switch#X21AB_15 NPC_NO_SPRITE
081-2,60,133,0 duplicate(Switch#X21AB_1) Switch#X21AB_16 NPC_NO_SPRITE
081-2,65,133,0 duplicate(Switch#X21AB_1) Switch#X21AB_17 NPC_NO_SPRITE
/* *************************************************************************** */
/* The Enigma */
/*
// FIXME (137,68 and 130,56 and 120,69) (no sprite) (no code)
081-2,137,68,0 script Enigma#X21A1 NPC_NO_SPRITE,{
mes l("Three Enigmas, one always say the truth, one always says a lie, and the third may either say the truth or a lie.");
mes "";
if ('TRUTHSTAT[0])
mesc l("The truth"), 1;
else
mesc l("A lie"), 1;
close;
OnInit:
.distance=2;
end;
}
*/