Nice landmine, Lycia, a lot like the one on Classic...better, but with some of the same problems (not putnpc, which has its advantages). but I guess I'll post mine...could be more efficient, but it blows up every time and doesn't follow the player around, unlike the current one.
NPC Code:
// NPC made by Jeff, 8.21.2001
// The code for this firemine is entirely original,
// save for a few of the blasts from the
// old Starcon/Lord Chimp version
// The reason it is now just the Fire Mine and not
// the STARCON FireMine is that the code really isn't
// any creation of STARCON's, being rewritten
// as it is. Why credit a guy who did little towards this?
// This takes up seven bombs instead of five, as it uses
// more explosions, and actually WORKS ALL THE TIME!
//new fire mine, laying section
if (playertouchsme) {
set jeffmine;
toweapons Fire Mine;
}
if(weaponfired && playerbombs >=7){
playerbombs -= 7;
putnpc starconexplo.mng,jeffmine.txt,x,y;
}
if(created){
timeout=1;
}
if(timeout){
message Fire Mine;
}
NPC Code:
// Operating part of the new fire mine system.
if (created){
// Set safe getaway time for the setter, and display it to help.
timeout=5;
timershow;
}
if (timeout){
// after the five secs are up
if ((abs(playerx-x)<=5) || (abs(x-playerx)<=5)){
// absolute value of one x and one Y difference must be less than or equal to five.
// Larger range than the old one. This is to ensure that it sets off correctly.
if ((abs(playery-y)<=5) || (abs(y-playery)<=5)){
// to establish a square, as opposed to a semisquare rectangle
// explodes, destroys itself in the process
putexplosion 5, x, y;
putexplosion 4, x+1, y;
putexplosion 4, x, y+1;
putexplosion 4, x+1, y+1;
putexplosion 4, x, y-1;
putexplosion 4, x-1, y;
putexplosion 4, x-1, y-1;
putexplosion 3, x+2, y+2;
putexplosion 3, x-2, y-2;
putexplosion 3, x+2, y-2;
putexplosion 3, x-2, y+2;
putexplosion 2, x+3, y+3;
putexplosion 2, x-3, y-3;
putexplosion 2, x+3, y-3;
putexplosion 2, x-3, y+3;
destroy;
// larger explosion than the old Fire Mine, so as to almost always damage the poor sod who steps too close.
}
}
// sets timeout to minimum amount to check for triggering
timeout=.05;
// the shown timer will disappear by itself as part of the timeout.
}