Game Development Community

Weapon Fire Problem

by Chris Labombard · in Torque Game Engine · 08/16/2005 (9:43 am) · 7 replies

Hey guys.

I just merged my game with the lighting pack.

My player carries almost all of his weapons in pairs. I use a specically set up inventory, that allows you to fire both weapons you have selected when you hit mouse0. Basically what happens is mouseFire queries to see what the active Weapons are and in creases there trigger count.

This worked perfectly before I merged and now all of the weapons fire, no matter what I do.

It is very odd. Before I merged I could go into camera mode (ALT C) but all of the particles being fired would disappear. Now, in normal mode, the primary weapons particles are visible, and hte secondary particles aren't. But in camera mode they are all visible.

Nothing shuts the weapons off. I've tried manually setting hte image trigger ot false, manually increasing hte trigger count. Nothing works.

I also made sure that all of my weapon scripts were the same and all of the other neccesary changes were implimented.

Can anyone offer a suggestion?

About the author

I have been a professional game programmer for over 5 years now. I've worked on virtually every platform, dozens of games and released a few of my own games, including 2 iPhone titles and a title waiting release on Big Fish Games.


#1
08/16/2005 (10:08 am)
Here is a clip form the console to demonstrate:

==>2345.mountimage(rightshoeimage,11);
==>echo(2345.getimagetrigger(11));
1
==>2345.setimagetrigger(11,false);
==>echo(2345.getimagetrigger(11));
1
==>2345.unmountimage(11);
==>echo(2345.getmountedimage(11));
0
==>echo(2345.getimagetrigger(11));
0
#2
08/16/2005 (10:27 am)
Are the projectiles missing or only the particles?


"Before I merged I could go into camera mode (ALT C) but all of the particles being fired would disappear."

That definitely doesn't sound right - how did you setup the code to do this?

Have you tried disabling the trigger state on slot 0 (this is the standard weapon slot)?

Have you diff-ed all of your original scripts with the Lighting Pack scripts? The scripts provided in the Lighting Pack are identical to the stock TGE scripts with the exception of three changes in 'starter.fps' (two of them are execs and not changes) and a few in 'common' (related to adding the Lighting Pack objects to the mission editor). None of the Lighting Pack code (script or C++) affects mounting or slot info, so your inventory changes won't overlap with the Lighting Pack code at all.


Just out of curiosity why are you posting this here? I just happened to see the subject in the recent threads section, but would of otherwise missed it.

-John
#3
08/16/2005 (10:59 am)
John. Im posting it here because I dont believe the lightpack is what caused the problem. :)

The projectiles are firing when Im in camera mode... ubt not when Im in 3rd person view (like normal)

The code is NOT network friendly. It is simply calls of $triggercount[getActiveWeapon()]++; where getActiveWeapon is a server side function.

It all worked perfectly. Now I can't get it to stop firing.

One other hting is that I have implemented the additional mount points resource that brings you up to 32 mounts. I double checked the code changes and everything looks normal.

Quote:
Have you tried disabling the trigger state on slot 0 (this is the standard weapon slot)?

I diffed all of the scripts and they are right. THe weapon scripts I use are unique, andthe inventory script had no changes for lighting. I made the appropriate default.bind.cs changes and verified that the changes took.

I tried setting imagetrigger(0,false) but there was no change.
#4
08/16/2005 (3:29 pm)
Quote:Im posting it here because I dont believe the lightpack is what caused the problem

Whoops, I was thrown by the original title of the thread. :)


Quote:
The projectiles are firing when Im in camera mode... ubt not when Im in 3rd person view (like normal)

...

I tried setting imagetrigger(0,false) but there was no change.

Projectiles fire in 3rd person mode in both stock TGE and the Lighting Pack (slot 0 works in both too). It sounds like something may have gone wrong while integrating the 32 slot resource.

Let me know if this helps!

-John
#5
08/16/2005 (3:36 pm)
You say you can't get the weapon to stop fireing? Try getting it to do the continuous fireing then type $mvTriggerCount0++; in console?If that is called once, the weapon keeps fireing till its called again.
#6
08/17/2005 (3:44 am)
Chris - Calling

$mvTriggerCount0++; and/or
$mvTriggerCount11++; and/or
$mvTriggerCount18++;

don't cause a change with the firing weapons, which are mounted in slots 11 and 18. I had already checked that ;)

John - I thought the same thing, but I double and triple checked my changes and they are all there. I guess I will check again.
#7
08/17/2005 (6:16 am)
I figured out the problem...

In moveManager.h there is an enumerated moveConstant called maxTriggerKeys. I upped it from 6 to 32 and all is well.

The weird thing is that I don't recall changing it originally to make these weapons work.

Well, at least it is fixed.