Weapon ammo
by James Steele · in Torque Game Engine Advanced · 05/21/2006 (12:09 pm) · 2 replies
I'm having a problem with firing a weapon. I'm using a bastardized load of code from the BT tank pack, as well as the fps demo. I'm mounted my weapon just fine, and it cycled through the weapon states.
The problem is...is keeps on switching to "No Ammo" straight away. Which is weird because I have the following in my data block for the object using the weapon;
and then when the object is created I have...
I'm completely missing something....but I just can't figure out what! I was wondering if any of you guys had an idea of anything obvious to the initiated, but not to the dumb schmuck likle myself.
thanks in advance!
The problem is...is keeps on switching to "No Ammo" straight away. Which is weird because I have the following in my data block for the object using the weapon;
maxInv[BasicArtWeapon] = 1; maxInv[BasicArtWeaponAmmo] = 10000; ammo = 1;
and then when the object is created I have...
%obj.mountable = true; %obj.setInventory(BasicArtWeapon, 1); %obj.setInventory(BasicArtWeaponAmmo, 10000); %obj.mountImage(BasicArtWeaponImage, 0);
I'm completely missing something....but I just can't figure out what! I was wondering if any of you guys had an idea of anything obvious to the initiated, but not to the dumb schmuck likle myself.
thanks in advance!
About the author
#2
that worked a treat. I couldn't quite work out the relation between the inventory and the mounted image stuff, but I see what's going on now.
thanks again!
05/21/2006 (11:05 pm)
Max,that worked a treat. I couldn't quite work out the relation between the inventory and the mounted image stuff, but I see what's going on now.
thanks again!
Torque Owner Max Robinson
Figure out which ::onMount your weapon is using. If you have a special one just for that weapon, make sure you check. Assuming it's something like ::onMount(%data,%player,%slot), go and do
This is off the top of my head, but it should do it. Also be sure to do the reverse when you fire, otherwise you gun will not actually run out of ammo.