Author Topic: Reload animation after firing a certain amount of ammo?  (Read 2271 times)

Is it possible to make a script in a weapon.cs file that'll make it do a reload animation (if .dts has it) after you shoot like for example, 10 shots? If so, what's the script to do it?

If you edit the onfire scripts, or the Weapon Ammo, you could use %obj.setImageAmmo(%slot,%ammo) and the No Ammo part of the state system to add a "No ammo" and "Reload" state to a weapon after running out.

Uh, can you give me an example of what it should look like, cause i got no idea what i am doing...



Ace

Yeah, sad thing is, even though this forum is here to help people, people rarely check it.

Sorry, I can't help with your problem though. Just stating the problem with these help forums.


Bumped yet again

Pwease help me! :(

Ugh, i figured i'd get more help than this... -.-

Its a simple question even! There are plenty of good scripters/coders here :,(

* masterlegodude still needs help....

If I could help I would, but I have no clue.

Well, I have NO experience with Torque Script, and what coding I can do (basic GML) is considered sloppy, but here goes. =P

Make a variable that goes up by one every time a shot comes out, and resets to zero when you release the mouse button. If the variable reaches a certain number, have it reload.

I'm sure theres a better way, though.

Use a state for each time you fire before the reload, then make a reload state.

«  September 19, 2007, 04:15:58 pm »

That was the last post... Nice >.>

In the weapon's script you want to reload open it  up..
Find the yourweapon::onFire( %this, %obj, %slot )
just add this in there (Notice im not going to do the whole script for you. Unless you give me the file, then i mite.)

Code: [Select]
if(%obj.aamo == 0)
{
      %obj.setImageAmmo(%slot,%ammo);//I don't know if this works, have fun.
return;
}
else
{
      %obj.ammo--;
}


I don't know if i did it right, i hate coding items.


« Last Edit: July 31, 2008, 10:08:55 AM by Skylord123 »