Clips For Weapons
by RedCore · in Torque Game Engine · 11/26/2003 (8:48 pm) · 6 replies
How would i add clips for my guns? I'v checked out the reloading clip resources.. but thats not exactly what i'm looking for..
Essentually i want to have clips that remember the amount of bullets in them.. and clips that can be inside guns..
i want to me able to run over a gun.. and automatically pick up the ammo inside its clip..
and also i want to be able to pickup a gun that someone else dropped and shoot the remaining bullets that are in the clip of that gun.. how would i do this?
I'm looking for concepts not actual code
Thx, RedCore
Essentually i want to have clips that remember the amount of bullets in them.. and clips that can be inside guns..
i want to me able to run over a gun.. and automatically pick up the ammo inside its clip..
and also i want to be able to pickup a gun that someone else dropped and shoot the remaining bullets that are in the clip of that gun.. how would i do this?
I'm looking for concepts not actual code
Thx, RedCore
About the author
#2
11/26/2003 (9:46 pm)
One more thing. You might want to add this functionality to the collision boxes of the magazines or guns themselves, since that would be the event that triggers that part of the gameplay.
#3
but i'm having a little trouble..
basically..
i added a "Amount" variable to my ammo item..
datablock ItemData(MachineGunClips)
{
category = "Ammo";
className = "Clip";
shapeFile = "~/data/shapes/rifle/ammo.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
PickUpMessage = "You've obtained a Machine Gun clips";
maxInventory = 100000;
Amount = 30;
};
and when the gun is fired..
%Clip = %this.clip;
if(%Clip.Amount = 0)
{
%obj.Throw(%Clip,1);
}
else
{
%Clip.Amount = %Clip.Amount-1;
}
my problem is that if i have 5 clips.. which clip am i subtracting the Amount from?
basically i want o be able to pick up 5 clips (item datablocks) and use all the ammo from one..
then throw that clip (the actual item) and replace it with anouther clip i have..
11/27/2003 (4:23 pm)
I'v figured out away to do it..but i'm having a little trouble..
basically..
i added a "Amount" variable to my ammo item..
datablock ItemData(MachineGunClips)
{
category = "Ammo";
className = "Clip";
shapeFile = "~/data/shapes/rifle/ammo.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
PickUpMessage = "You've obtained a Machine Gun clips";
maxInventory = 100000;
Amount = 30;
};
and when the gun is fired..
%Clip = %this.clip;
if(%Clip.Amount = 0)
{
%obj.Throw(%Clip,1);
}
else
{
%Clip.Amount = %Clip.Amount-1;
}
my problem is that if i have 5 clips.. which clip am i subtracting the Amount from?
basically i want o be able to pick up 5 clips (item datablocks) and use all the ammo from one..
then throw that clip (the actual item) and replace it with anouther clip i have..
#4
%player.currentClip = %clipNum;
11/28/2003 (2:20 am)
Easiest way would be to have an array %clip[0] -> %clip[max#Clips]%player.currentClip = %clipNum;
#5
11/28/2003 (7:33 am)
Like Harold says, why not make the weapon image have clip value[clip], and also player holds [x] clips, then you can directl refer to which clip the gun is using. When that clip becomes empty, you use the next available clip in the array.
Torque 3D Owner Ted Southard