Modding MI

Miscellaneous
          Changing Cheats
          Changing the Flecko.net Screen
          Fading Corpses
          Fading Weapons
          Friendly Fire
          Life Limit
          Multiple Sound File Loading
          Shoot the Dying



Changing Cheats
Frame 5 / cheatmenu (mc.cheat) / bu.invis
Line 1
on (release) {
     ch=mycheat.toLowerCase();
     givec=true;

     if (ch=="armstrong") {
          _root.armlength=2;
          mycheat="Reach doubled!";
     } else if (ch=="newyorkminute") {
          _root.infbt=true;
          mycheat="Infinite bullet time!";
     } else if (ch=="willis") {
          _root.alwaysinvincible=true;
          mycheat="heat="Unbreakable!";
     } else if (ch=="hop") {
          _root.highjump=true;
          mycheat="heat="High jump!";
     } else if (ch=="guide") {
          _root.laserguide=true;
          mycheat="heat="Laser guide!";
     } else if (ch=="minnie") {
          _root.giveminigun=true;
          mycheat="heat="Minigun power!";
     } else if (ch=="arnold") {
          _root.arnold=true;
          mycheat="heat="Pumped up!";
     } else if (ch=="gump") {
          _root.gump=true;
          mycheat="heat="Run!";
     } else if (ch=="apollo") {
          _root.allrocket=true;
          mycheat="heat="All enemies use explosives!";
     } else if (ch=="flcl") {
          _root.infammo=true;
          mycheat="heat="Infinite ammo!";
     } else {
          givec=false;
          mycheat="heat="No dice.";
     }

     if (givec) {
          _root.ischeating=true;
     }
}

The layout for the cheats is below.

if (ch=="#CODE#") {
     _root.#CHEAT#=true;
     mycheat="#RESULT#";
}

#CODE# is the cheat code you type in.
#CHEAT# is the cheat is the effect the cheat has.
#RESULT# is what the cheat box replies to show that the cheat has worked.


Changing the Flecko.net Screen
Frame 3
Line 3
text=new Array(
     1,1,1,0,1,0,0,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,0,0,1,0,0,1,0,1,1,1,0,1,1,1,
     1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,0,1,1,0,1,0,1,0,0,0,0,1,0,
     1,1,0,0,1,0,0,0,1,1,0,0,1,0,0,0,1,1,0,0,1,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,1,0,
     1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,0,1,0,
     1,0,0,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,0,1,0,1,1,1,0,0,1,0
);

1 = Block
0 = Empty

Example:

text=new Array(
     1,1,1,0,1,0,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,
     0,1,0,0,1,1,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,0,1,0,0,0,
     0,1,0,0,1,0,1,1,0,1,0,0,0,1,1,1,0,1,1,0,0,1,0,1,1,0,1,1,1,0,0,1,0,0,1,1,1,0,
     0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,0,1,0,0,0,
     1,1,1,0,1,0,0,1,0,1,1,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,0,1,1,1,0
);

Taking out columns messes the whole thing up.
Notice the pattern:

text=new Array(
     1,1,1,0,1,0,0,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,0,0,1,0,0,1,0,1,1,1,0,1,1,1,
     1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,0,1,1,0,1,0,1,0,0,0,0,1,0,
     1,1,0,0,1,0,0,0,1,1,0,0,1,0,0,0,1,1,0,0,1,0,1,0,0,0,1,0,1,1,0,1,1,0,0,0,1,0,
     1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,0,1,0,
     1,0,0,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,0,1,0,1,1,1,0,0,1,0
);



Fading Corpses
Use this if you want the corpses to fade away rather than just vanishing.

Frame 6 / pgen (mc.guy)
Line 521
deadtime++;
     if (deadtime>30) {
     esc();
}

Replace that with:

deadtime++;
     _alpha -= 100/30;
     if (deadtime>30) {
     esc();
}


Fading Weapons
Use this if you want the weapons to fade away rather than just vanishing.

Frame 6 / tgun (mc.tgun)
Line 99
deadtimer++;
if (deadtimer>100 || _root.knifing || (ammo==0 && !_root.mtest(type))) {
     remove();
}

Replace that with:

deadtimer++;
if(ammo > 0 && deadtimer > 70){
     _alpha -= 100/30;
}
else if(ammo == 0 && !_root.mtest(type) && deadtimer > 35){
     _alpha -= 100/15;
}
if (deadtimer>100 || _root.knifing || (ammo==0 && !_root.mtest(type) && deadtimer > 50)) {
     remove();
}


Friendly Fire
Use this if you want the enemies' bullets to hurt other enemies if it hits them.

Frame 6 / pgen (mc.guy) / hand (mc.hand)
Line 335
if (t.hmn!=_parent.hmn && (t.dying<=1 || (t.ddelay<5 && (t.deadhits<10 || t.zombie==3))) && ((fdir==1 && t._x+t.khw>pt0.x) || (fdir==-1 && t._x-t.khw<pt0.x)) && t.hasentered) {

Replace that with:

if ((t.dying<=1 || (t.ddelay<5 && (t.deadhits<10 || t.zombie==3))) && ((fdir==1 && t._x+t.khw>pt0.x) || (fdir==-1 && t._x-t.khw<pt0.x)) && t.hasentered) {


Life Limit
Use this if you want the Player to only have a set limit of lives in the Main Game.

Frame 5
Line 23
//selection menus

Replace with:

//selection menus
gameover = new Array(
     new Array(0,8,"Return to Menu",14)
);

Frame 6
Line 1
stop();
gameframe=_currentframe;
pause=false;

Replace with:

stop();
gameframe=_currentframe;
pause=false;
lives = 3;

Of course, to change the starting number of lives, simply change the lives variable here.

Frame 6 / pgen (mc.guy)
Line 70
_root.hmndeaths++;

Replace with:

_root.hmndeaths++;
if(_root.maingame){
     _root.lives--;
     if(_root.lives < 0){
          _root.lives = 0;
          _root.dopause();
          stopAllSounds();
          Mouse.show();
          _root.newmenu(200,150,225,100,"Game Over",_root.gameover);
     }
}

To make a lives counter, just make a dynamic textbox and make the variable "_root.lives". Then convert it into a movieclip (F8), and give it the following actionscript:

onClipEvent(load){
     if(_root.maingame){
     _visible = true;
     }
     else{
          _visible = false;
     }
}


Multiple Sound File Loading
Use this if you want to be able to load in different sound files before playing the game.

Due to a Flash Player Security Setting, this code may not work when downloaded on some computers. It will work online, however.

Download the required movieclips here.
Copy the objects in the Library to the Madness Source Code Library.

Frame 1
Line 3
loadMovie("mrsound.swf",1); //OFFLINE

Replace that with:

stop();
var soundload = "mrsound";
this.createEmptyMovieClip("pHolder",1);
pHolder.onData = function(){
     w = 160;
     h = 32+(22*pHolder.numsound);
     _root.createEmptyMovieClip("soundselect",100000);
     _root.soundselect._alpha = 0;
     _root.soundselect.lineStyle(2,0xFFFFFF);
     _root.soundselect.beginFill(0xCCCCCC);
     _root.soundselect.moveTo((Stage.width-w)/2,(Stage.height-h)/2);
     _root.soundselect.lineTo((((Stage.width-w)/2)+w),(Stage.height-h)/2);
     _root.soundselect.lineTo((((Stage.width-w)/2)+w),((Stage.height-h)/2)+h);
     _root.soundselect.lineTo(((Stage.width-w)/2),((Stage.height-h)/2)+h);
     _root.soundselect.lineTo((Stage.width-w)/2,(Stage.height-h)/2);
     _root.soundselect.endFill();
     _root.soundselect.attachMovie("marztitle","marztitle",1);
     _root.soundselect.marztitle._x = Stage.width/2;
     _root.soundselect.marztitle._y = (Stage.height-h)/2;
     _root.soundselect.marztitle.txt = "Load Sound";
     for(var num = 0; num < pHolder.numsound; num++){
          _root.soundselect.attachMovie("marzselect","marzselect"+num,2+num);
          _root.soundselect["marzselect"+num].stop();
          _root.soundselect["marzselect"+num]._x = Stage.width/2;
          _root.soundselect["marzselect"+num]._y = ((Stage.height-h)/2)+10+((num+1)*20);
          _root.soundselect["marzselect"+num]._width = w;
          _root.soundselect["marzselect"+num].txt = pHolder["sound"+(num+1)];
     }
     _root.soundselect.fadeup = true;
}
loadVariables("http://marz.dancingdog.co.uk/mrvariables.txt",pHolder);
onEnterFrame = function(){
     if(this.soundselect.fadeup){
          if(this.soundselect._alpha < 100){
               this.soundselect._alpha += 5;
          }
          else{
               this.soundselect.fadeup = false;
          }
     }
}


Frame 2
After Last Line
loadMovieNum(soundload+".swf",1);
onEnterFrame = function(){
     if(Key.isDown(Key.ENTER) && _currentframe == 2){
          unloadMovieNum(1);
          _root.gotoAndStop(1);
     }
}


Shoot the Dying
Use this if you want to be able to shoot people even after they've lost all their hitpoints.

Frame 6 / pgen (mc.guy) / hand (mc.hand)
Line 335
if (t.hmn!=_parent.hmn && (t.dying<=1 || (t.ddelay<5 && (t.deadhits<10 || t.zombie==3))) && ((fdir==1 && t._x+t.khw>pt0.x) || (fdir==-1 && t._x-t.khw<pt0.x)) && t.hasentered) {

Replace that with:

if (t.hmn!=_parent.hmn && (t.dying<1 || (t.ddelay<1000000 && (t.deadhits<1000000 || t.zombie==3))) && ((fdir==1 && t._x+t.khw>pt0.x) || (fdir==-1 && t._x-t.khw<pt0.x)) && t.hasentered) {