Modding MI

Weapon Modding
          Weapon Ammo
          Weapon Statistics
          Changing a Weapon's Fire Speed
          Making a Weapon Stab People
               Making a Weapon Stick in People
          Two-Handed Weapons
          Multiple Weapon Slots



This is the most common type of actual modding. I will start with the basics, and go on from there.


Weapon Ammo
Frame 6
Line 20
ammo=new Array(0,11,4,15,20,30,7,30,30,10,0,0,0,20,10,20,20,50,100000000000,5,4,30,14,65,0,0,0,6);
btypes=new Array(0,0,1,3,2,4,2,5,4,2,1,0,0,0,4,3,4,4,2,0,7,6,0,5,0,0,0,0,8);

The first line, ammo, shows how much ammo the weapon's magazine can hold.
The second line, btypes, designates the type of bullet it should display on the side of the screen. The different types are outlined below.

btypes
btype 0          Fist / Baseball Bat / Switch Blade / Night Stick
btype 1Pistol / Silenced Pistol
btype 2Uzi / CQB / Silenced Mp5 / UMP-45
btype 3Shotgun / Saiga
btype 4M16 / M60 / AK-47 / Steyr Aug / L85
btype 5Desert Eagle / Automag
btype 6Rocket Launcher
btype 7Railgun
btype 8Grenade Launcher



Weapon Statistics
Frame 6 / pgen (mc.guy) / hand (mc.hand)
Line 36
gunkick=new Array(0,0,20,40,15,50,35,45,60,30,20,0,0,0,30,40,30,20,25,40,60,40,0,30,0,0,0,0,50,0,0,0,0);
gunforce=new Array(0,0,10,25,10,18,8,15,30,18,10,0,0,0,18,25,10,10,12,25,30,0,0,20,0,0,0,0,0,0,0,0,0);
gundamage=new Array(0,0,1,1,1,2,.75,2,2.5,.75,1,0,0,0,2,1,1.5,1.25,1.5,2,3,0,0,3,0,0,0,0,0,0,0,0,0);
gunblood=new Array(0,0,1,2,1,3,1,2,3,1,1,0,0,0,2,2,2,2,2,2,3,0,3,0,0,0,0,0,0,0,0,0);
shelltype=new Array(0,0,1,3,1,2,1,1,2,1,1,0,0,0,2,3,2,2,1,1,7,0,0,1,0,0,0,0,8,0,0,0,0);
flashtype=new Array(0,0,1,3,1,2,1,1,2,1,1,0,0,0,3,3,2,2,1,3,4,3,0,1,0,0,0,0,3,0,0,0,0);
usepoints=new Array(2,3,4,5,6,5,3,8,5,4,4,5,4,5,5,5,5,5,6,7,7,6,3,2,4,0,0,4,6,6,6,6);
storetype=new Array(0,0,0,1,0,1,1,0,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0,1,1,1,1,1);
gunnames=new Array("Null","Hand","Pistol","Shotgun","Uzi","M16","CQB","Desert Eagle","M60","Silenced MP5", "Silenced Pistol","Baseball Bat","Switchblade","Nightstick","AK-47","Saiga","Steyr Aug","L85","UMP-45", "Minigun","Railgun","Rocket Launcher","Flamethrower","Automag","Tazer","Axe","Jetpack", "Suicide bomb","Grenade Launcher","Urinal","Urinal","Urinal","Urinal");

gunkick The recoil the weapon has. Close combat weapons have 0 gunkick.
gundamage The damage the weapon deals. Close combat weapons have 0 gundamage.
gunblood The type of wound the weapon causes. 1 means small. 2 means medium. 3 means large. Close combat weapons have 0 gunblood.
shelltype The type of shell that comes out of the gun when it is fired. Close combat weapons have 0 shelltype.
flashtype The type of muzzelflash the gun releases. Close combat weapons have 0 flashtype.


Changing a Weapon's Fire Speed
Frame 6 / pgen (mc.guy) / hand (mc.hand)
Line 987
if (ammo>0) {
     //uzi
     uzitimer--;
     if (uzifiring>0 && uzitimer<0) {
          uzitimer=2*_root.runspeed;
          uzifiring--;
          shoot(arot);
     }
               //cbq
     if (cfire) {
          cftimer--;
          if (cftimer<0) {
               cftimer=_root.runspeed;
               shoot(arot);
          }
     }

     //smg
     if (sfire) {
          sftimer--;
          if (sftimer<0) {
               sftimer=_root.runspeed;
               shoot(arot);
          
     }

     //ak47
     if (akfire) {
          aktimer--;
          if (aktimer<0) {
               aktimer=3*_root.runspeed;
               shoot(arot);
          }
     }

     //L85
     if (lfire) {
          ltimer--;
          if (ltimer<0) {
               ltimer=2*_root.runspeed;
               shoot(arot);
          }
     }

     //UMP45
     if (ufire) {
          utimer--;
          if (utimer<0) {                                                  
               utimer=_root.runspeed;
               shoot(arot);
          }
     }

     //chaingun
     if (cgfire) {
          cgtimer--;
          if (cgtimer<0) {
               cgtimer=_root.runspeed-1;
               shoot(arot);
          }
     }

     //flamethrower
     if (flamefire) {
          flametimer--;
          if (flametimer<0) {
               flametimer=2*_root.runspeed-1;
               _root.level++;
               duplicateMovieClip(_root.flame,"flame"+_root.level,_root.level);
               flame=eval("_root.flame"+_root.level);
               flame._x=pt0.x;
               flame._y=pt0.y;
               userad=arad+.05-Math.random()*.1
               flame.xv=Math.cos(userad)*10;
               flame.yv=Math.sin(userad)*10;
               flame.gen=false;
               flame.hmn=_parent.hmn;
               if (_parent.hmn) _root.clip.fire();
               if (!_parent.hmn || !_root.infammo) ammo--;
          }
     }


     //automag
     if (autofire) {
          autotimer--;
          if (autotimer<0) {                                                  
               autotimer=3*_root.runspeed;
               shoot(arot);
          }                                        
     }

     if (tfire) {
          if (_parent.hmn) _root.clip.fire();
          if (!_parent.hmn || !_root.infammo) ammo--;
     }

     //m60fire
     if (m60fire>0) {
          m60timer--;
          if (m60timer<0) {
               m60fire--;
               m60timer=2*_root.runspeed;
               shoot(arot);
          }
     }

} else if (cfire || sfire || akfire || lfire || ufire || cgfire || flamefire || autofire || tfire || m60fire) {
     stopfire(true);
}

Multiply the guntimer's root.runspeed. The higher you multiply it by, the slower it fires.
Note: The sound stays the same, so a very slow automatic still has very fast shooting sounds.

//#GUN#
if (#FIRE#) {
     #TIMER#--;
     if (#TIMER#<0) {
          #TIMER=#SLOW#*_root.runspeed;
          shoot(arot);
     }
}

#GUN# is the gun's name.
#FIRE# is the firetype.
#TIMER# is the gun's timer.
#SLOW# is the number that is multiplied to slow the fire rate of the weapon.

There are some variations of this layout. This only works for automatics.


Making a Weapon Stab People
Frame 6 / pgen (mc.guy) / hand (mc.hand)
Line 937
if ((_parent.guntype==12 || _parent.guntype==25) && n<3) {
     //knifin' around
     t.knife(txc/hv,tyc/hv,fdir*dir,hv,headshot,pt.x,pt.y);
}

Add another Guntype (see Index I for help) onto the end of the if statement. Example:

if ((_parent.guntype==12 || _parent.guntype==25 || _parent.guntype==32) && n<3) {
     //knifin' around
     t.knife(txc/hv,tyc/hv,fdir*dir,hv,headshot,pt.x,pt.y);
}


Making a Weapon Stick In People
Frame 6 / pgen (mc.guy) / head (mc.head) / stuck (mc.stuck)
Frame 6 / pgen (mc.guy) / body (mc.body) / stuck (mc.stuck)
Add a new frame at the end of this motion clip. Fill it with what you want the weapon to look like once it's hit the enemy.

Frame 6 / tgun (mc.tgun)
Line 169
if (n==0 && (_currentframe==11 || _currentframe==24)) {
     if (_currentframe==11) {
          sticktype=1;
     } else (_currentframe==24) {
          sticktype=2;
     }

Add more if() statements. Example:

if (n==0 && (_currentframe==11 || _currentframe==24 || _currentframe==32)) {
     if (_currentframe==11) {
          sticktype=1;
     } else (_currentframe==24) {
          sticktype=2;
     } else (_currentframe==32) {
          sticktype=3;
     }



Two-Handed Weapons
Frame 6 / pgen (mc.guy) (Frame 2) / nonhand (mc.nonhand2)

Give nonhand the following Actionscript:

onClipEvent(enterFrame){
     if(_parent.guntype == #GUN#){
          this._visible = false;
     }
     else{
          this._visible = true;
     }
}

#GUN# is the Guntype of the Gun you wish to be Two-Handed (see Index I for help).
To have multiple two-handed weapons, simply divide each #GUN# with a ||. Example:

onClipEvent(enterFrame){
     if(_parent.guntype == #GUN# || _parent.guntype == #GUN#){
          this._visible = false;
     }
     else{
          this._visible = true;
     }
}


Multiple Weapon Slots
Frame 6 / pgen (mc.guy) / hand (mc.hand)
Line 737
if (Key.isDown(_root.keys[_root.ki["switch"]]) && switchtimer<0) {
     switchtimer=5
     tempgun=_parent.guntype;
     tempammo=ammo;
     _parent.guntype=resgun;
     ammo=resammo;
     resgun=tempgun;
     resammo=tempammo;

Change it to say this:

if (Key.isDown(_root.keys[_root.ki["switch"]]) && switchtimer<0) {
     switchtimer=5
     tempgun=_parent.guntype;
     tempammo=ammo;
     _parent.guntype=resgun;
     ammo=resammo;
     resgun=tempgun;
     resammo=tempammo;
     tempgun2 = _parent.guntype;
     tempammo2 = ammo;
     _parent.guntype = resgun2;
     ammo = resammo2;
     resgun2 = tempgun2;
     resammo2 = tempammo2;

Line 20

resgun=1; //secondary weapon
resammo=0;

Change it to say this:

resgun=1;
resammo=0;
resgun2=1;
resammo2=0;