New muzzleflash?

Need some nice Mods? Here, you are right!
JimmyCognitti

New muzzleflash?

Post by JimmyCognitti »

First off, hello!
Simple question, are there any mods/mutators that allow you to change default muzzleflash effects?

Thanks 8)

EDIT: Just to clarify, I'm not looking for weapon mods, I'm looking for new muzzleflash that can be used with game's vanilla weapons.
User avatar
Feralidragon
Godlike
Posts: 5498
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: New muzzleflash?

Post by Feralidragon »

That's such a specific and niche idea, that I doubt there's anything already out there that does that.
JimmyCognitti

Re: New muzzleflash?

Post by JimmyCognitti »

I see.
I thought it'd be as easy as dropping some files inside UT directory (like you do with games like Counter-Strike), I was totally wrong though.
Thanks for replying.
User avatar
ExpEM
Adept
Posts: 302
Joined: Wed Nov 09, 2016 1:48 am

Re: New muzzleflash?

Post by ExpEM »

I agree with Feralidragon, it is unlikely that anyone has done this before.
But, there is nothing stopping you from doing it now!

The vanilla weapons that actually use a MuzzleFlash are:
-Enforcer* (and DoubleEnforcer by extension)
-Minigun2*
-PulseGun
-SniperRifle
-UT_FlakCannon
*The Enforcer and Minigun2 both have extended code for multiple MuzzleFlash textures.

This is all the MuzzleFlash variables (from Weapon class)

Code: Select all

// Muzzle Flash
// weapon is responsible for setting and clearing bMuzzleFlash whenever it wants the
// MFTexture drawn on the canvas (see RenderOverlays() )
var bool bSetFlashTime;
var(MuzzleFlash) bool bDrawMuzzleFlash;
var byte bMuzzleFlash;
var float FlashTime;
var(MuzzleFlash) float MuzzleScale, FlashY, FlashO, FlashC, FlashLength;
var(MuzzleFlash) int FlashS;	// size of (square) texture/2
var(MuzzleFlash) texture MFTexture;
var(MuzzleFlash) texture MuzzleFlare;
var(MuzzleFlash) float FlareOffset; 
In the editor you can look at the DefaultProperties of any of the weapons I listed before to get an idea of how they work.
You don't have to look at or understand any of the code relating to MuzzleFlash or Weapons** outside of these variables.

**Enforcer has an extra variable:

Code: Select all

var() texture MuzzleFlashVariations[5];
**Minigun2 has one too:

Code: Select all

var() texture MuzzleFlashVariations[10];
So with all of this, all you need to do is wright a Mutator to change the MuzzleFlash variables from whatever they are to whatever you want.
There are many ways to go about this but I would use the CheckReplacement Mutator function.

As an example:

Code: Select all

class NameOfMutator expands Mutator;

function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
	if (Other.IsA('SniperRifle'))
	{
		Weapon(Other).FlashC = 0.1;
		Weapon(Other).FlashLength = 0.02;
		Weapon(Other).FlashO = 0.015;
		Weapon(Other).FlashY = 0.16;
		Weapon(Other).MFTexture = Texture'Botpack.Skins.Flakmuz';
		Weapon(Other).MuzzleFlashMesh = Mesh'Botpack.muzzFF3';
		Weapon(Other).MuzzleFlashScale = 0.4;
		Weapon(Other).MuzzleFlashTexture = Texture'Botpack.Skins.MuzzyFlak';
		Weapon(Other).MuzzleScale = 2.0;
		
		return false;
	}
}
This (entirely untested) Mutator changes the MuzzleFlash of the SniperRifle to the MuzzleFlash of the UT_FlakCannon.
By extension, to modify all the Weapons you want:

Code: Select all

class NameOfMutator expands Mutator;

function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
	if (Other.IsA('Weapon you want to change'))
	{
		Weapon(Other).make changes here
		
		return false;
	}
	
	if (Other.IsA('Another Weapon you want to change'))
	{
		Weapon(Other).make changes here
		
		return false;
	}
	
	if (Other.IsA('Another Weapon you want to change'))
	{
		Weapon(Other).make changes here
		
		return false;
	}
	
	if (Other.IsA('Another Weapon you want to change'))
	{
		Weapon(Other).make changes here
		
		return false;
	}
}
Best of luck! :tu:
Signature goes here.
User avatar
OjitroC
Godlike
Posts: 3746
Joined: Sat Sep 12, 2015 8:46 pm

Re: New muzzleflash?

Post by OjitroC »

Your first example there causes the game to crash with the following error

Code: Select all

Warning: Login failed: Failed to spawn player actor
Critical: appError called:
Critical: Failed to spawn player actor
Critical: Windows GetLastError: Not enough memory. (8)
Exit: Executing UObject::StaticShutdownAfterError
Exit: Executing UWindowsClient::ShutdownAfterError
Exit: UGalaxyAudioSubsystem::ShutdownAfterError
Log: DirectDraw End Mode
Exit: UD3D9RenderDevice::ShutdownAfterError
The following ScriptWarnings are in the log
Spoiler
Function Engine.GameInfo.InitGameReplicationInfo:0039) Attempt to assign variable through None
Function Engine.GameInfo.InitGameReplicationInfo:0046) Accessed None 'GameReplicationInfo'
Function Botpack.DeathMatchPlus.InitGameReplicationInfo:001A) Attempt to assign variable through None
Function Botpack.DeathMatchPlus.InitGameReplicationInfo:002B) Accessed None 'GameReplicationInfo'
Function Botpack.DeathMatchPlus.PostBeginPlay:0060) Accessed None 'GameReplicationInfo'
Function Botpack.DeathMatchPlus.PostBeginPlay:0068) Attempt to assign variable through None
I thought maybe it needed a Return True at the end but that simply removed sniper rifles from the map I tried.
User avatar
ExpEM
Adept
Posts: 302
Joined: Wed Nov 09, 2016 1:48 am

Re: New muzzleflash?

Post by ExpEM »

OjitroC wrote: Sun Oct 23, 2022 10:11 pm Your first example there causes the game to crash with the following error

Code: Select all

Warning: Login failed: Failed to spawn player actor
Critical: appError called:
Critical: Failed to spawn player actor
Critical: Windows GetLastError: Not enough memory. (8)
Exit: Executing UObject::StaticShutdownAfterError
Exit: Executing UWindowsClient::ShutdownAfterError
Exit: UGalaxyAudioSubsystem::ShutdownAfterError
Log: DirectDraw End Mode
Exit: UD3D9RenderDevice::ShutdownAfterError
The following ScriptWarnings are in the log
Spoiler
Function Engine.GameInfo.InitGameReplicationInfo:0039) Attempt to assign variable through None
Function Engine.GameInfo.InitGameReplicationInfo:0046) Accessed None 'GameReplicationInfo'
Function Botpack.DeathMatchPlus.InitGameReplicationInfo:001A) Attempt to assign variable through None
Function Botpack.DeathMatchPlus.InitGameReplicationInfo:002B) Accessed None 'GameReplicationInfo'
Function Botpack.DeathMatchPlus.PostBeginPlay:0060) Accessed None 'GameReplicationInfo'
Function Botpack.DeathMatchPlus.PostBeginPlay:0068) Attempt to assign variable through None
I thought maybe it needed a Return True at the end but that simply removed sniper rifles from the map I tried.
Dang, Code is now tested and fixed:

Code: Select all

class MFTest_Mutator expands Mutator;

function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
	if (Other.IsA('SniperRifle'))
	{
		Weapon(Other).FlashC = 0.1;
		Weapon(Other).FlashLength = 0.02;
		Weapon(Other).FlashO = 0.015;
		Weapon(Other).FlashY = 0.16;
		Weapon(Other).MFTexture = Texture'Botpack.Skins.Flakmuz';
		Weapon(Other).MuzzleFlashMesh = Mesh'Botpack.muzzFF3';
		Weapon(Other).MuzzleFlashScale = 0.4;
		Weapon(Other).MuzzleFlashTexture = Texture'Botpack.Skins.MuzzyFlak';
		Weapon(Other).MuzzleScale = 2.0;
		
		return true; //Fixed here
	}

	bSuperRelevant = 0; //Fixed here
	return true; //Fixed here
}
Signature goes here.