Only 3 image slots on vehicles?
by Maddermadcat · in Torque Game Engine · 03/08/2008 (9:57 pm) · 8 replies
My fighter has four weapon images mounted to it in the onAdd function. Unfortunately, only three of the four images appear at once.
It seems like the only slots that can be mounted to are 1, 2, and 3. Using slot 0 or anything above 3 doesn't work. Yes, my mount points are fine. I can mount the image that used slot 4 to slot 1 and it appears where it should, for example.
What's wrong?
It seems like the only slots that can be mounted to are 1, 2, and 3. Using slot 0 or anything above 3 doesn't work. Yes, my mount points are fine. I can mount the image that used slot 4 to slot 1 and it appears where it should, for example.
What's wrong?
About the author
#2
My images don't mount in the first place. I can only mount to slots 1, 2, and 3, but not 0 or anything above 4. As far as I know all that does is add a bunch of triggers.
03/10/2008 (4:15 pm)
I don't see how that fixes my problem.My images don't mount in the first place. I can only mount to slots 1, 2, and 3, but not 0 or anything above 4. As far as I know all that does is add a bunch of triggers.
#3
Have you tried increasing the MaxMountedImages in ShapeBase.h? (Try changing it to 8 since it has to be a ^2)
That should do it, and you would have to use my trigger code too, to make sure they fire.
03/11/2008 (12:21 am)
Sorry, I didnt read your problem properly, and it was late... at least I tried :-PHave you tried increasing the MaxMountedImages in ShapeBase.h? (Try changing it to 8 since it has to be a ^2)
MaxSoundThreads = 4, ///< Should be a power of 2
MaxScriptThreads = 4, ///< Should be a power of 2
//JLAKER - Increase Triggers
//MaxMountedImages = 4, ///< Should be a power of 2
MaxMountedImages = 8, ///< Should be a power of 2
//JLAKER - Increase Triggers
MaxImageEmitters = 3,
NumImageBits = 3,
ShieldNormalBits = 8,That should do it, and you would have to use my trigger code too, to make sure they fire.
#4
03/11/2008 (4:48 am)
I knew this thread would be worth following :-). Thanks BurNing.
#5
You might want to take in consideration that 4 guns firing will create 4 projectiles. 32 players firing at each other can cause you headaches.
If your guns are always going to be the same create ONE model with all 4 guns in the it at the right positions. Do the same for your Projectile... 1 DTS with the 4 "projectiles" in it. You will need to add a bit of rotation code to the Projectile class. If you need it gimme a shout.
I've done this for Solar Battles and saved ALOT of bandwidth since it's tracking 1 Projectile instead of 4. It also then tracks on ShapeImage instead of one for every mounted gun. So I'm sure you see the obvious benefits of doing this.
It depends on your needs though. If you're gonna allow the player to change the guns seperately, well, good luck with having 64 players we all dream of :-P
03/11/2008 (5:50 am)
It's a pleasure :)You might want to take in consideration that 4 guns firing will create 4 projectiles. 32 players firing at each other can cause you headaches.
If your guns are always going to be the same create ONE model with all 4 guns in the it at the right positions. Do the same for your Projectile... 1 DTS with the 4 "projectiles" in it. You will need to add a bit of rotation code to the Projectile class. If you need it gimme a shout.
I've done this for Solar Battles and saved ALOT of bandwidth since it's tracking 1 Projectile instead of 4. It also then tracks on ShapeImage instead of one for every mounted gun. So I'm sure you see the obvious benefits of doing this.
It depends on your needs though. If you're gonna allow the player to change the guns seperately, well, good luck with having 64 players we all dream of :-P
#6
When the primary fire key is pressed, I trigger images 1 and 2. When the secondary key is pressed, I trigger 3 and 4.
I'll spare you all the primary/secondary trigger stuff. Would I still need to add your trigger code if I do it this way?
03/11/2008 (6:41 pm)
Actually, it's for my vehicles. I have two weapons on my aircraft. Each weapon consists of two images:%obj.mountImage(AirMRImage, 1); %obj.mountImage(AirMRPairImage, 2); %obj.mountImage(AirRLImage, 3); %obj.mountImage(AirRLPairImage, 4);
When the primary fire key is pressed, I trigger images 1 and 2. When the secondary key is pressed, I trigger 3 and 4.
function Vehicle::firePrm(%obj, %val)
{
%obj.setImageTrigger(1, %val);
%obj.setImageTrigger(2, %val);
}
function Vehicle::fireAlt(%obj, %val)
{
%obj.setImageTrigger(3, %val);
%obj.setImageTrigger(4, %val);
}I'll spare you all the primary/secondary trigger stuff. Would I still need to add your trigger code if I do it this way?
#7
The Optimization stuff I mentioned is for any type of vehicle.
03/12/2008 (4:13 am)
Yes you would need the changes in my First post. I take it you managed to get all the images mounted. The Optimization stuff I mentioned is for any type of vehicle.
#8
Really, I don't see how increasing the number of images that can be mounted would change anything. The problem isn't that I can only mount 3 images, it's that I can't mount these images to any slots but 1 2 and 3.
My apologies if I came off as a bit irritated.
03/12/2008 (9:14 pm)
No, the images still do not mount.Really, I don't see how increasing the number of images that can be mounted would change anything. The problem isn't that I can only mount 3 images, it's that I can't mount these images to any slots but 1 2 and 3.
My apologies if I came off as a bit irritated.
Torque Owner James Laker (BurNinG)
void Vehicle::updateMove(const Move* move) { mDelta.move = *move; // Image Triggers if (mDamageState == Enabled) { setImageTriggerState(0,move->trigger[0]); setImageTriggerState(1,move->trigger[1]); //JLAKER - Increase Triggers setImageTriggerState(2,move->trigger[2]); setImageTriggerState(3,move->trigger[3]); setImageTriggerState(4,move->trigger[4]); //JLAKER - Increase Triggers }You have to take into Consideration the jetting trigger further down in the function, so here's another snip from my code... As you can see here I moved my Jetting/Afterburner/Boost to trigger 5:
//JLAKER - Increase Triggers, and added minJetStartEnergy // Jetting flag if (move->trigger[5]) {Then off course you will need to make the changes to your client/scripts/default.bind.cs. Here's another snip... so you might need to change yours. But it'll give you an idea of what needs to be done. You just need to add the triggers to the fire function:
function primaryfire(%val) { $mvTriggerCount0++; $mvTriggerCount1++; $mvTriggerCount2++; $mvTriggerCount3++; } function secondary(%val) { $mvTriggerCount4++; } function afterburner(%val) { $mvTriggerCount5++; } moveMap.bind( mouse, button0, primaryfire ); moveMap.bind( mouse, button1, secondary );Hope that solves your issue :)