Author Topic: Ammo system  (Read 2167 times)

I want to implement an ammo system for my weapons. I don't know how, so if someone can give me a quick run-thru I would be most grateful <3

EDIT

I am looking for a simple  shoot 10 projectiles > run out > plays reloading animation
« Last Edit: June 03, 2014, 10:15:48 PM by Damien4545 »

open up other weapons with ammo built in and see how they did it. i don't know how, but thats how i'd figure it out.

open up other weapons with ammo built in and see how they did it. i don't know how, but thats how i'd figure it out.

I tried. No work


what do you mean 'no work'?


It had "Support_ammo" in it. I know what it is, but I don't know how to get it to link with the weapons.

It had "Support_ammo" in it. I know what it is, but I don't know how to get it to link with the weapons.
you don't need support_ammo to do it.
i opened up a T+T weapons pack and literally found it in a matter of seconds:
http://prntscr.com/3m9ua3

you don't need support_ammo to do it.
i opened up a T+T weapons pack and literally found it in a matter of seconds:
http://prntscr.com/3m9ua3

There is no setImageAmmo, that is just the ammo hud
« Last Edit: May 24, 2014, 07:19:34 PM by Damien4545 »

First find the function for when the weapon is fired, then add an if(%obj.ammo>=1) {blah} and else if(%obj.ammo<0) { reload }

His picture shows a reload function

-snip-
http://prntscr.com/3m9ua3


It isn't too hard, I believe you can do it.
Code: [Select]
function M1014Image::onFire1(%this,%obj,%slot)

{
%obj.toolMag[%obj.currTool]-=1;if(%obj.toolMag[%obj.currTool]<1)

{
%obj.toolMag[%obj.currTool]=0;%obj.setImageAmmo(0,0);

}
M1014Fire(%this,%obj,%slot,0.0015,1,0.02);

}
function M1014Image::onFire2(%this,%obj,%slot)
{
%obj.toolMag[%obj.currTool]-=1;

if(%obj.toolMag[%obj.currTool]<1)
{
%obj.toolMag[%obj.currTool]=0;%obj.setImageAmmo(0,0);

}
M1014Fire(%this,%obj,%slot,0.0030,1,0.04);
}

There is no setImageAmmo, that is just the ammo hud

Code: [Select]
function M1014Image::onReload(%this,%obj,%slot)

{
%obj.toolMag[%obj.currTool]+=1;
    %obj.setImageAmmo(0,1);

}
As for the setImageAmmo you can create that yourself. Or write your own script to replace this one for something totally different.

Taken from BF3Shotguns by Sgt. A. Walter, A Twig and Navaro

First find the function for when the weapon is fired, then add an if(%obj.ammo>=1) {blah} and else if(%obj.ammo<0) { reload }

-shnip

I don't follow; I can't code. at all. I just change numbers around to my liking in the scripts

I don't follow; I can't code. at all. I just change numbers around to my liking in the scripts
learn to code
you will get literally nowhere without knowing how to code and you're making weapons


bump?
How are we supposed to help you if you only know how to change a few variables?

This board is called "Coding Help." It is not called "Code for me."