• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code How to Code 5 Fire Modes/Alt-Fires into 1 Gun?

StarArk99

Active member
Aug 25, 2012
33
0
I'd like to know how to code 5 different fire modes / alt-fires into 1 gun, as explained below:

The MPXX Multipurpose Heavy Assault Rifle
Fire Modes: Semi, Full Auto, Super Auto, Healing Darts, and Healing Grenade.

I know how to code Semi, Auto, and Super fire modes into a weapon, but I want to add Healing Darts and a Healing Grenade Launcher to it as well, but don't know how.

Primary Fire will shoot the according to the current fire mode selected, while Secondary Fire will switch between the various fire modes. I want to use the M4204's body as a base (due to the integrated grenade launcher and it's coding) but since it's an Insta-Hit weapon (Its bullets connect with target/crosshair) instead of a projectile weapon, I don't know if it's possible within my ability to do (I don't have fancy animation and weapon making software or coding knowledge). I've made a custom M4 (the M4204XFT) that shoots bullets and has a flamethrower (Which can be an alternative to the healing grenade launcher) just coded to heal instead, then I'd probably have to extend the class from "KFShotgunFire" for it to shoot projectiles, but from trial and error, this method doesn't work with all weapons.

So can anybody help me out? I'd greatly appreciate it! :)
 
Hahaha, sounds like a crazy (maybe not the most practical) but interesting weapon. I'll take a crack at it this weekend.

What's super fire though? Is it burst fire (ex. one trigger pull, X number of shots) or firing a primary and secondary fire simultaneously (ex. one trigger pull, bullet and grenade fires)?
 
Upvote 0
Hahaha, sounds like a crazy (maybe not the most practical) but interesting weapon. I'll take a crack at it this weekend.

What's super fire though? Is it burst fire (ex. one trigger pull, X number of shots) or firing a primary and secondary fire simultaneously (ex. one trigger pull, bullet and grenade fires)?

Super Fire is a fire mode that allows you to shoot 3 times the normal fire rate. Here's the Super Fire coded in my custom weapon, the SCAR-MK99 SA-ASR (SCAR-MK99 Star Ark Assault Sniper Rifle):

Code:
class SCARMK99SA-ASR extends KFFire;
//0 = Auto
//1 = Super Auto
//2 = Semi Auto
var int AutoMode;

function SetAutoMode(int NewMode, bool bPlayerIsCommando) //interface for changing modes in uBullpup
{
    if (!bPlayerIsCommando && NewMode == 1)
        NewMode++;  
    else if (NewMode > 2) //go from semi auto to auto
        NewMode = 0;

    AutoMode = NewMode;
    if (NewMode != 2)
        bWaitForRelease=False;
    else
        bWaitForRelease=True;
}

function float GetFireSpeed()
{
    if ( AutoMode == 0 ) //regular automatic
    {
        if (KFGameType(Level.Game).bZEDTimeActive)
        {
        return 1.5;
        }
        else
        return 1.0; //normal default FireRate
    }
    else if ( AutoMode == 1 ) //super automatic available to commandos
    {
        if (KFGameType(Level.Game).bZEDTimeActive)
        {
        return 4.5;
        }
        else
        return 3.0; //Shoot 3x as fast; default FireRate is divided by this number
    }

    //else AutoMode is invalid or 2, so Semi Automatic Mode
    return 1.0; //normal FireRate
}

I know that switching fire modes will normally only change how many rounds that are fired from the gun per click (or holding down the fire button), and I also know that by changing perks, some weapons can change which projectile is fired from the weapon, but I want to create a fusion of both - By changing firemodes (Medic Darts and Medic Grenade Launcher in this case), it will also change the projectile (Only when switching between MD and MGL firemodes). I'll see what I can figure out with the code, and then post it after putting it together, since I'm unable to compile muts for the time being. And Thanks for the Help you're offering dude!
 
Upvote 0