Game Development Community

WeaponFireLight is non-functional

by Chris "C2" Byars · in Torque Game Engine · 04/26/2005 (7:02 pm) · 7 replies

The WeaponFireLight block of code in your server/scripts/yourweapon.cs files is non-functional in 1.3.

Verified by a few people who took a look at it as well.

Hope it's fixed in the upcoming releases.

#1
04/27/2005 (3:05 am)
You might want to delete this post and return to the original.
#2
04/27/2005 (3:55 am)
It still does not work, and others confirm.
#3
04/27/2005 (6:49 am)
How in the world did you come to the conclusion that your suspicion was verified? You had one response that gave you an alternative, since you couldn't get it working, and you had another response from The Force, who verified that his was working. This forum does not need blatantly erroneous reports cluttering it up.
#4
04/27/2005 (8:09 am)
The weaponfirelight is working like a charm.
But it depends how you want it to work.
For single shot weapons it works ok
but if you want it constant on or flashing when you use a chaingun or something you need to check the code or how you setup the script .
#5
04/27/2005 (1:13 pm)
lightType = WeaponFireLight;
   lightColor = "0.5 0.5 0.25";
   lightTime = 200;
   lightRadius = 3.8;

Apparently that piece of code does not function. What's the difference if the rate of the weapon fire is fast or slow? On a single shot weapon, there is no avail to this bugged code.
#6
04/28/2005 (2:44 am)
I had the same problem with rapid fire weapons and the weapon fire light only appearing once and not continuing to loop. I have fixed this problem and can tell you it is not broken in 1.3 at all. It's all in the way you set up your fire states in your weapon's *.cs file. (Not trying to insult anyone's intelligence here but i'm not refering to the weapon.cs file in server/scripts i'm refering to the crossbow.cs script or whatever you named it.

To elaborate,
It works with single shot weapons cos of the way its fired. You press the mouse button once, the light is displayed, you release the mouse button, press the mouse button again to refire, light is displayed again and so on.

With a rapid fire weapon you would generally hold the mouse button down thus the fire state is only being called once and the light will not continue to flash as the mouse button is held down. It will flash once when the mouse button is pressed, will not continue to flash as the mouse button is held down, and only flash again when the mouse button is released and pressed again. The same problem will happen with any particle effects you have like smoke out the end of the nozzle.

So in a rapid fire weapon, if what i'm saying is true and the stateFire[3] = true; is only being called once and not continuing to loop whilst held down why does everything else (like the projectile, recoil etc) still work???

Well the projectile still works cos it is defined at the bottom of the fire states in a function that starts like this;
function M16Image::onFire(%this, %obj, %slot)

The recoil still works cos you can set it to 'cyclic' in the actual *.dts file. If you don't you'll find the recoil will have the same problem as the light and particle, it will only occur once.

This is all probably a little confusing i know, and i'm sure people will disagree with what i'm saying. To those people all i can say is everything works spot on with my weapons. I have an m16 that has recoil, particle effects, muzzle flash, weapon fire light, camera shake, a looping fire sound that plays evenly rather than that erratic crap you get when you have a sound per shot system, and a shell drop sound when you release the mouse button.

The only way i could achieve all this was heavy modification of each weapons *.cs script. If your weapon *.cs script is scripted like in Beaver Patrol or that resource that gives you three weapons (www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6221) then you're gonna have problems.

I could go on about this a lot more but i'll stop here unless anyone requests some assistance.

I should add that i realise the problems and (brief) solutions i outlined above may or may not be unique to my modified copy of Torque 1.3 lighting pack / installer.
#7
04/29/2005 (10:30 am)
Thanks for the insight, Tim! :)