importing coded smoke grenade not working

A refuge for those migrating from the fallen DXEditing.com and a place for general discussion relating to Deus Ex editing (coding, mapping, etc).
Post Reply
User avatar
Kelkos
UNATCO
Posts: 214
Joined: Fri Oct 28, 2016 12:54 pm

importing coded smoke grenade not working

Post by Kelkos »

I'm importing a smokegrenade , but it's not spawning the desired Smoke grenade effect upon explosion . The effect's name is SFXSmokeGrenade. When I throw it, it spawns the desired smoke, but when It explodes, It does not spawn the SFXSmokeGrenade effect.
The code

Code: Select all

//=============================================================================
// P_SmokeGrenade
//=============================================================================
class P_SmokeGrenade extends GasGrenade;

var bool bFallen;
var() float realBlastRadius;

event SupportActor( actor StandingActor )
{
	if (!bFallen)
	{
		if (StandingActor.Isa('DeusExPlayer'))
			SetPhysics(PHYS_Falling);
		bFallen=true;
	}
}

function Frob(Actor Frobber, Inventory frobWith)
{
	bFallen=false;
	Super.Frob(Frobber, frobWith);
}

simulated function Tick(float deltaTime)
{
      Super.Tick(deltaTime);

     MultiSkins[0]=Texture'DeusExItems.Skins.GasGrenadeTex1';
}

simulated function SpawnEffects(Vector HitLocation, Vector HitNormal, Actor Other)
{
	local ExplosionLight light;
    local SFXExplosionFragmented expeffect;
    local float dist;
    local DeusExPlayer player;

	player = DeusExPlayer(GetPlayerPawn());
	dist = Abs(VSize(player.Location - Location));
	
	if (dist ~= 0)
		dist = 10.0;

	if(dist < realBlastRadius)
		player.ClientFlash(FClamp(realBlastRadius/dist, 0.0, 4.0), vect(500,500,500));

	PlaySound(Sound'DeusExSounds.Weapons.GasGrenadeExplode', SLOT_None, 2.0,, realBlastRadius*10);
	AISendEvent('LoudNoise', EAITYPE_Audio, 2.0, realBlastRadius*10);

	SpawnTearGas();

	expeffect = Spawn(class'SFXExplosionFragmented',,, HitLocation);
	
	if(expeffect != None)
		expeffect.ScaleFactor = 0.6;

	light = Spawn(class'ExplosionLight',,, HitLocation);

	if (light != None)
	{
		if (!bDamaged)
			light.RemoteRole = ROLE_None;

		light.size = 8;
		light.LightHue = 80;
		light.LightSaturation = 255;
		light.LightEffect = LE_Shell;
	}
}

function SpawnTearGas()
{
	local vector loc;
	local int i;
	
	for (i=0; i<realBlastRadius/30; i++)
	{
		if (FRand() < 0.9)
		{
			loc = Location;
			loc.X += FRand() * realBlastRadius * 0.5 - FRand() * realBlastRadius;
			loc.Y += FRand() * realBlastRadius * 0.5 - FRand() * realBlastRadius;

			spawn(class'GameSFX.SFXSmokeGrenade',,, loc);
		}
	}
}

function PostBeginPlay()
{
	local ParticleGenerator launchGen;
	
	Super.PostBeginPlay();
	
	launchGen = Spawn(class'ParticleGenerator', Self);
	
	if (launchGen != None)
	{
        launchGen.RemoteRole = ROLE_None;
        launchGen.bScale = True;
		launchGen.particleTexture = Texture'GameMedia.Effects.ef_ExpSmoke005';
		launchGen.particleDrawScale = 0.35;
		launchGen.checkTime = 0.01;
		launchGen.riseRate = 200.0;
		launchGen.ejectSpeed = 150.0;
		launchGen.particleLifeSpan = 1.0;
		launchGen.bRandomEject = True;
		launchGen.SetBase(Self);
		launchGen.LifeSpan = fuseLength + 1;
	}
}

defaultproperties
{
}
Being a soldier isn't just following orders, it's following those orders in the service of a higher cause. When that cause is betrayed, we're not soldiers anymore, just pieces on a chess board dying for the wrong reason.
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

Re: importing coded smoke grenade not working

Post by Cybernetic pig »

You didn't post the other classes. Post the one that isn't getting spawned, which I assume is SFXSmokeGrenade.

class'GameSFX.SFXSmokeGrenade'

class'SFXExplosionFragmented'
User avatar
Kelkos
UNATCO
Posts: 214
Joined: Fri Oct 28, 2016 12:54 pm

Re: importing coded smoke grenade not working

Post by Kelkos »

Code: Select all

class SFXExplosionFragmented extends AnimatedSprite;

function PostBeginPlay()
{
     local DeusExPlayer player;
     local int i;

	Super.PostBeginPlay();

     player = DeusExPlayer(GetPlayerPawn());

     if (player.bNoResurrection)
     {
        animSpeed=0.060000;
        numFrames=8;
        frames[0]=Texture'DeusExItems.Skins.FlatFXTex20';
        frames[1]=Texture'DeusExItems.Skins.FlatFXTex21';
        frames[2]=Texture'DeusExItems.Skins.FlatFXTex22';
        frames[3]=Texture'DeusExItems.Skins.FlatFXTex23';
        frames[4]=Texture'DeusExItems.Skins.FlatFXTex24';
        frames[5]=Texture'DeusExItems.Skins.FlatFXTex25';
        frames[6]=Texture'DeusExItems.Skins.FlatFXTex26';
        frames[7]=Texture'DeusExItems.Skins.FlatFXTex27';
        Texture=Texture'DeusExItems.Skins.FlatFXTex20';
     }
}

defaultproperties
{
     animSpeed=0.020000
     scaleFactor=1.400000
     numFrames=21
     frames(0)=Texture'GameMedia.Effects.ef_ExGrn001'
     frames(1)=Texture'GameMedia.Effects.ef_ExGrn002'
     frames(2)=Texture'GameMedia.Effects.ef_ExGrn003'
     frames(3)=Texture'GameMedia.Effects.ef_ExGrn004'
     frames(4)=Texture'GameMedia.Effects.ef_ExGrn005'
     frames(5)=Texture'GameMedia.Effects.ef_ExGrn006'
     frames(6)=Texture'GameMedia.Effects.ef_ExGrn007'
     frames(7)=Texture'GameMedia.Effects.ef_ExGrn008'
     frames(8)=Texture'GameMedia.Effects.ef_ExGrn009'
     frames(9)=Texture'GameMedia.Effects.ef_ExGrn010'
     frames(10)=Texture'GameMedia.Effects.ef_ExGrn011'
     frames(11)=Texture'GameMedia.Effects.ef_ExGrn012'
     frames(12)=Texture'GameMedia.Effects.ef_ExGrn013'
     frames(13)=Texture'GameMedia.Effects.ef_ExGrn014'
     frames(14)=Texture'GameMedia.Effects.ef_ExGrn015'
     frames(15)=Texture'GameMedia.Effects.ef_ExGrn016'
     frames(16)=Texture'GameMedia.Effects.ef_ExGrn017'
     frames(17)=Texture'GameMedia.Effects.ef_ExGrn018'
     frames(18)=Texture'GameMedia.Effects.ef_ExGrn019'
     frames(19)=Texture'GameMedia.Effects.ef_ExGrn020'
     frames(20)=Texture'GameMedia.Effects.ef_ExGrn021'
     Texture=Texture'GameMedia.Effects.ef_ExGrn001'
}
Being a soldier isn't just following orders, it's following those orders in the service of a higher cause. When that cause is betrayed, we're not soldiers anymore, just pieces on a chess board dying for the wrong reason.
User avatar
Kelkos
UNATCO
Posts: 214
Joined: Fri Oct 28, 2016 12:54 pm

Re: importing coded smoke grenade not working

Post by Kelkos »

Code: Select all

class SFXSmokeGrenade expands Effects;

var() float RiseRate;
var() bool bGravity;
var float OrigLifeSpan;
var float OrigScale;
var vector OrigVel;
var bool bScale;
var bool bFade;
var bool bFrozen;

function PostBeginPlay()
{
	RiseRate = FRand()* 0.05;
	OrigScale = DrawScale;
	DrawScale = FRand() + 2;	
	OrigLifeSpan = LifeSpan;
	LifeSpan = FRand() * 5 + 35;	
}

auto simulated state Flying
{
	simulated function Tick(float deltaTime)
	{
		// if we are frozen, don't update
		if (bFrozen && (Owner != None))
		{
			LifeSpan += deltaTime;
			return;
		}

		Velocity.X = OrigVel.X + 2 - FRand() * 5;
		Velocity.Y = OrigVel.Y + 2 - FRand() * 5;

		if (bGravity)
			Velocity.Z += Region.Zone.ZoneGravity.Z * deltaTime * 0.2;
		else
			Velocity.Z = OrigVel.Z + (RiseRate * (OrigLifeSpan - LifeSpan)) * (FRand() * 0.2 + 0.9);

		if (bScale)
		{
			if ( Level.NetMode != NM_Standalone )
				DrawScale = FClamp(OrigScale * (1.0 + (OrigLifeSpan - LifeSpan)), 0.4, 4.0);
			else
				DrawScale = FClamp(OrigScale * (1.0 + (OrigLifeSpan - LifeSpan)), 0.01, 4.0);
		}
		if (bFade)
			ScaleGlow = LifeSpan / OrigLifeSpan;	// this actually sets the alpha from 1.0 to 0.0
	}
	simulated function BeginState()
	{
		Super.BeginState();

		OrigScale = DrawScale;
		OrigVel = Velocity;
		OrigLifeSpan = LifeSpan;
	}
}

defaultproperties
{
     RiseRate=0.025000
     bScale=True
     bFade=True
     Physics=PHYS_Projectile
     LifeSpan=30.000000
     DrawType=DT_Sprite
     Style=STY_Translucent
     Texture=Texture'GameMedia.Effects.ef_ExpSmoke009'
     DrawScale=0.040000
}
Being a soldier isn't just following orders, it's following those orders in the service of a higher cause. When that cause is betrayed, we're not soldiers anymore, just pieces on a chess board dying for the wrong reason.
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

Re: importing coded smoke grenade not working

Post by Cybernetic pig »

Do you have a package named class'GameSFX.SFXSmokeGrenade'?
If not, you'll need to change that spawn() call in P_SmokeGrenade to Spawn(class'DeusEx.SFXSmokeGrenade',,,loc), assuming you even have the SFXSmokeGrenade class in your DeusEx.u build.
Post Reply