Jump to content
Sign in to follow this  
Stygs

Laser Problem

Recommended Posts

Got a small problem here - I want a soldier with a laser gun whos laser effect stays behind about 1 second or 2 (so a bit longer than default).

Strangely, the laser slowly fades as it should, but then reappears at full brightness for a moment before finally disappearing.

Any idea why?

 

	<WeaponTemplate
		id="ForgottenTankBusterLaserWeapon"
		AttackRange="350.0"
		WeaponSpeed="=$GENERIC_LASER_SPEED"
		FireSound="NOD_BeamCannon_BeamFire"
		FireFX="FX_NODSpitfireFire"
		FireVeteranFX="FX_NODSpitfireFireHeroic"
		AcceptableAimDelta="=$ACCEPTABLE_AIM_DELTA"
		PreAttackType="PER_SHOT"
		ReAcquireDetailType="PRE_FIRE"
		ClipSize="1"
		AntiMask="ANTI_GROUND ANTI_AIRBORNE_VEHICLE ANTI_AIRBORNE_INFANTRY"
		CanFireWhileMoving="false">
		<PreAttackDelay
			MinSeconds=".2s"
			MaxSeconds=".2s"/>
		<FiringDuration
			MinSeconds="2s"
			MaxSeconds="2s"/>
		<ClipReloadTime
			MinSeconds="2.0s"
			MaxSeconds="2.3s"/>
		<Nuggets>
			<ActivateLaserNugget
				Lifetime="1.5s"
				LaserId="1"
				HitGroundFX="FX_NODSpitfireHit">
				<SpecialObjectFilter
					Rule="ALL"
					Exclude="MINE" />
			</ActivateLaserNugget>
			<DamageNugget
				Damage="200.0"
				Radius="5.0"
				DamageType="ROCKET"
				DamageFXType="NOD_LASER"
				DeathType="LASERED">
			</DamageNugget>
			<SuppressionNugget
				Radius="20.0"
				Suppression="10"
				DurationSeconds="= $SUPPRESSION_LOW"/>
		</Nuggets>
		<ScatterRadiusVsType
			Radius="50.0">
			<Filter
				Rule="NONE"
				Include="INFANTRY" />
		</ScatterRadiusVsType>
	</WeaponTemplate>

 

Share this post


Link to post

I think it has something to do with laserdraw, basicly it draws the texture over a duration of 30 frames, wich equals about 1 second. by extending the lifetime to 2 seconds(60 frames) it draws the texture 2x 30 frames, i think in the past i fiddled with this before but never got a good result. also i dont believe that increasing the framerate to 60 in laserdraw works, that showed the texture 3 times iirc, and going below 30 gave a compile error. Anyway that was my experience with it a while ago. Maybe for you someone can prove me wrong.

Share this post


Link to post

I think it may be as Ravendark said, I had small experience with lasers but if I ever had such timing issue it usually was caused because the draw or the fx itself which I had to delay/increase

Edited by Egozi44

Share this post


Link to post

I think it has something to do with laserdraw, basicly it draws the texture over a duration of 30 frames, wich equals about 1 second. by extending the lifetime to 2 seconds(60 frames) it draws the texture 2x 30 frames, i think in the past i fiddled with this before but never got a good result. also i dont believe that increasing the framerate to 60 in laserdraw works, that showed the texture 3 times iirc, and going below 30 gave a compile error. Anyway that was my experience with it a while ago. Maybe for you someone can prove me wrong.

 

Are you refering to Texture1_FrameRate and such? I tried values of 30, 60 and 300 and there was no significant difference for me, it seems to refer to the texture movement speed. Guess the Laser is not supposted to appear longer than one second :/

Edited by Stygs

Share this post


Link to post

What fx you using? Nod beam cannon fx? nod's commando? avatar?

I recall I had some issue when I mess with the redeemer liquid fx and the lifetime was at fault for making it stay behind but that may was for different matter (can't recall as it been two years ago)

You may need look at the fx/fxlist and make it longer, I done it once with the ion cannon but I think the laser case is completely different matter that don't even have fx list, you can try make one but if the laser end too fast it may just end with similar result


Maybe you should consider take other laser fx (scrin's/MOK) and just change it texture to red

Edited by Egozi44

Share this post


Link to post

Please, feel free to explain the connection between the FX and the ActivateLaserNugget to me because I fail to see how this would relevant...

Share this post


Link to post

Well I don't sure about the laser in particularly but from my experience with fxs, some won't fully listen to what we tell them to do in the weapon because they have their own timing in the fx, and sometime the weapon lifetime is too long and it cause it to leave trail a bit longer (I think it also effect the fx's "respwn" timing)

P.s I edit my last commit

Edited by Egozi44

Share this post


Link to post

Laserdraw or laser state don't use fx list to alter or prolong their effects. You are basicly stuck with how they work. Like i saod above i didnt have much succes with working with those when it comes to altering the lifetime effect.

 

What i have used before is using the FX_list inweapinfirefx/vertancyfirefx to draw lasers (the mammoth uses that to draw its railgun blue laser core, it only uses the laserdraw to draw the distortion effect not the actual laser.)

 

 

FireFX="FX_TestLaserFire01"
FireVeteranFX="FX_TestLaserFire01"

<FXList id="FX_TestLaserFire01">
        <NuggetList>
            <ParticleSystem
                Particle="RailgunCore"
                UseTarget="true"
                OrientToObject="true"
                Ricochet="true" />
            </NuggetList>
    </FXList>
 

and you should be able to alter the lifetime color etc in the particle system:

 

 

<FXParticleSystemTemplate ParticleTexture="FXRailgunThread" PerParticleAttachedSystem="" Priority="ALWAYS_RENDER" SortLevel="2" SystemLifetime="1" Type="STREAK" id="RailgunCore">
        <Lifetime High="25" Low="25"/>
        <Size High="1" Low="1"/>
        <BurstCount High="2" Low="2"/>
        <Colors>
            <Color Frame="1" RelativeAge="0">
                <Color b="1" g="1" r="1"/>
            </Color>
            <Color Frame="2" RelativeAge="50">
                <Color b="1" g="1" r="1"/>
            </Color>
            <Color Frame="3" RelativeAge="100">
                <Color b="0" g="0" r="0"/>
            </Color>
        </Colors>
 

Ive used this before to simulate a laser lockon attack, i could use the firefxbone to define the lasertargetingmodule and the launchbon to actuall launch the missile from. I could serve for your purpose aswell.

Share this post


Link to post

That good idea but I don't think he want the mammoth laser, I think mok elite cyborgs use fx, if that the case it will look better than the mammoth for nod units, he just need to recolor it

 

 

Also... did you looked on TT lasr fx? I never tested it but it may be good idea to give it a try

Edited by Egozi44

Share this post


Link to post

That good idea but I don't think he want the mammoth laser, I think mok elite cyborgs use fx, if that the case it will look better than the mammoth for nod units, he just need to recolor it

 

 

Also... did you looked on TT lasr fx? I never tested it but it may be good idea to give it a try

Have you looked at how the charged particlebeam lasers are done? it is the same way the mammoth does. They use a streak draw in their particle system. Just like i mentioned above.

Both the mok and the improved mok dont even use Laser draws or laser state modules. The laser id that is in their weapons is just dirty code that isnt really used, with exeption for the hitground fx, maybe not even that.

Share this post


Link to post

IF you use a particle fx with streak, you can use the laser texture...altho you might have to turn it 90 degrees, that needs testing.

Share this post


Link to post

Well as long as it serve what he want to do with it, does the laser code really matter? xD

 

 

I changed weapon textures before and particle colors as well (for shatter) but never look deeply into lasers to see if all of them use fx or textures, as far as I could tell each weapon could've it own method to fake the fx to look how they wanted it to look, from my experience with the Shatter, even if I changed the practical color in the xml, It didn't changed the look of the fx, so even if he will change the mammoth's "laser" it still going to look like mammoth's railgun with red color, maybe he can remove something from the fx to make it look different (never looked into the mammoth to see if it even have fx but since it fake laser I assume it use one), So I thought that if he going to do it, MOK's fake laser in red may look better than the Mammoth which will remind people of railguns

Share this post


Link to post

done with the default railgun texture

 

th_sshot0001_1.png

 

and done with the obelisk laser texture...didn't need to rotate it...works as is.

 

th_sshot0002.png

Share this post


Link to post

@ Egozi44

No offense, but I get the feeling that you have no idea what you are talking about as you dont seem to know how laser weapons work in TW/KW.

 

@ Ravendark

Good idea, that should work nicely. They are not meant for Nod, so I dont care if they look/behave slightly different.

But I kinda wonder what happens to the laser if the target moves during the FiringDuration...I will give it a try :)

Edited by Stygs

Share this post


Link to post

Ye i tested that Stygs..it looks like a ground fire attack... the laser doesn't follow the target. I can't remember if the laserdraw did sticky to the target.

Last time i used this system, it was for a SAM like structure with a laser lock on effect. I benched the idea because it turned my defense line into a rock concert with a lightshow...i guess i never extended the lifetime to the point that it would be that obvious before i scrapped the idea.

Im toying with this idea some more, if i find anything interesting ill update.

Share this post


Link to post

So i managed to get something i like, or i would use. Not sure if it suits your needs but basically i did the following:

 

Used the above particle streak method...reduced the lifetime ironically enough:

 

<FXParticleSystemTemplate ParticleTexture="FXObeliskLaser" PerParticleAttachedSystem="" Priority="ALWAYS_RENDER" SortLevel="2" SystemLifetime="1" Type="STREAK" id="LaserGunCore01">
        <Lifetime High="5" Low="5"/>
        <Size High="1" Low="1"/>
        <BurstCount High="10" Low="10"/>
 

in my weapon i give it a clip size of 10 and a fire rate of really fast with a clip reload time(the reload time is a preference)

 

 

<FiringDuration
                MinSeconds="0.1s"
                MaxSeconds="0.1s" />
       <ClipReloadTime
            MinSeconds="2.5s"
            MaxSeconds="2.5s" />
 

I give it a sound per clip so it only "pew" once per clip and not make a "pewpewpewpew etcetc" sound per shot.

Give it a reaquiredetail type per clip as well so it focuses the 10 laser shots in the same spot per clip

 

 

 ReAcquireDetailType="PER_CLIP"
        ClipSize="10"
        AutoReloadsClip="AUTO"
        FireSoundPerClip="ZoneTrooperGunFire"
 

The effect i got is a focused beam that looks very close to a 2 second burning beam, it doesn't fan out or stray due to the tweaks in lifetime and fire rate and it looks like it does its dmg like a burning dot(10shots per clip in a very fast rate)

 

Will post the test video when its rendered on YT.

 

 

The hit fx could need some tweaking as they are abit to much, for a laser of that size on a small unit.

Edited by Ravendark

Share this post


Link to post

2 problems: 1st: The hitfx is also played a huge number of times. 2nd: Your damage is unreliable. Everything that is under 0.2s has to be emulated (as there are only 5 logic frames per second). Also everything under 0.033s has to be widely interpolated as there's 30 graphics frames per second.

 

Additionally you're drawing the particle 10 times per shot for 10 shots. You are also drawing 5 frames, which means 0.165s while your rof is 0.1

Share this post


Link to post

@ Egozi44

No offense, but I get the feeling that you have no idea what you are talking about as you dont seem to know how laser weapons work in TW/KW.

Yea guess you right~ didn't mess with lasers a lot, the only few changes I done with lasers so far from what I recall were messing with Nod's laser defense turrets (only change their color), Adding to redeemer the supercharged/charged beams turrets, and something with the scrin's tank.

 

(Also done this but I guess it doesn't count as laser ;D

 

 

)

 

Guess it 10 years too early or me to actually help expert modders ^^

Edited by Egozi44

Share this post


Link to post

Guess it 10 years too earlier or me to actually help expert modders ^^

Have to disappoint you there. You don't know what's actually going on 50% of the time and even if you do your English makes it really hard for other to decipher what you are talking about.

English is your greatest hurdle here and you really should work improving it, which then could make it easier for you to learn how to mod this game. Understanding is key, and with you it often doesn't really work in any direction.

 

The quoted sentence for example makes zero sense and everyone just has to guess what you're trying to communicate.

Edited by Lauren

Share this post


Link to post

Woops

 

My phone's auto correct got itself involved with that last sentence

Edited by Egozi44

Share this post


Link to post

2 problems: 1st: The hitfx is also played a huge number of times. 2nd: Your damage is unreliable. Everything that is under 0.2s has to be emulated (as there are only 5 logic frames per second). Also everything under 0.033s has to be widely interpolated as there's 30 graphics frames per second.

 

Additionally you're drawing the particle 10 times per shot for 10 shots. You are also drawing 5 frames, which means 0.165s while your rof is 0.1

The hitfx can probably be limited through the

Amount="10.0"
ThrottleTime="50ms"

in the damagefx list?

 

So i changed the numbers to the values mentioned above. And it comes across more jittery, obviously as i doubled the time between shots, overlapping by 0.065 in drawn frames doesn't seem that bad as it makes it slightly look more like 1 pulsing beam en less like several beams in a row. Are there any major downsides to "my" numbers besides some inconsistent damage? Tbh i was glad it worked that well anyway seeing it was a dirty solution to start off with.

Edited by Ravendark

Share this post


Link to post

It's not just your autocorrect. Your overall level of English makes it very hard to understand you. (@egozi)

Edited by Lauren

Share this post


Link to post

After a bit more numbers juggling it feels to me that 0.1 and 5 frames looks more convincing. I'll admit that i might be using dirty math for a dirty solution. But unless this makes my pc crash i would be fine with it.

 

Update: Ye the hitfx might be tricky. If you throttle it to much it will look ok for 1 beam hitting the target. But if you have multiple units attacking the same target, the hitfx of other units won't get played because it is throttled out.

So either you are not showing enough hit fx or to many..which could become a performance issue depending on the weight of the hitfx composition.

Edited by Ravendark

Share this post


Link to post

You could however do not a hitfx at all but add a projectilenugget for an invisible projectile that does the fx stuff.

Share this post


Link to post

wouldnt that just mean that it would shoot projectiles = clipsize, so you would still get 10 times the fx from projectile detonation?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×