Announcement

Collapse
No announcement yet.

How do I code ammunition reloads into a vehicle?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Thanks wong! I couldn't get the batch export to work so I used UTPT, works like a charm.

    Leave a comment:


  • replied
    ucc batchexport usually does it. if for some reason thats not adequate, UTPT should do the trick.

    Leave a comment:


  • replied
    Heh, mind me asking but how do you decompile source code and get all the default properties ect? Dont take this as a noob question I just never learned how to do that lol.

    Leave a comment:


  • replied
    Originally posted by SquirrelZero
    Frag.Ops has reloadable vehicle weapons. Decompile our source and look at War_FOVehicleWeapon.uc.
    This is why SquirrelZero rocks. "Decompile our source" he says. A fine human being. Everyone raise a glass for this guy.

    Dicky B (I was going to use the enhanced playershadow code in a mod I'm doing, but it is way unnecessary for what it is.. Code is still in there, not active, just in case)

    Leave a comment:


  • replied
    Frag.Ops has reloadable vehicle weapons. Decompile our source and look at War_FOVehicleWeapon.uc.

    Leave a comment:


  • replied
    I remember someone posting some code on how to do this. Not sure if reloadable vehicles works the same for weapons. So try this:

    Code:
    class SomeReloadableStuff extends WhatYourTurret extends
    
    var int ammoammount;
    
    state ProjectileFireMode
    {
    function Fire(Controller C)
    {
     if (ammoammount >= 4) //So you cant fire after shooting 4 projectiles and must reload.
     GoToState( 'Reloading' );
    
    SpawnProjectile(ProjectileClass, False); 
    ammoammount += 1;
    }
    }
    
    state Reloading
    {
      Begin:
      Sleep( 3.0 );
      ammoammount = 0;
      GoToState( 'ProjectileFireMode' );
    }
    
    defaultproperties
    {
       ammoammount = 0 //So you start wit full ammo.
    }
    This is not my code, I remember it from a post somewhere.

    Leave a comment:


  • replied
    Well, it sounds like you almost answered your own question. Just make the variables you need, then under the the fire functions, just add some if else statements and you should have it...

    Leave a comment:


  • How do I code ammunition reloads into a vehicle?

    I'm working on a couple vehicles for some TC mods, and I'd like to be able to have the weapons on these vehicles stop firing after a set number of rounds, then simulate a reload.

    Basically, it would:

    1) Count how many seconds the weapon has been fired (a variable called "firetime"). Basically, each time the player presses Fire, a timer runs until Fire is released.

    2) Once "firetime" is greater than a set amount ("ammolimit") the weapon stops firing and a "weaponactive" var is set to false.

    3) A new timer runs for a certain amount of seconds ("reloadtime"). I trigger a sound and maybe an animation.

    4) Once the timer reaches "reloadtime", "firetime" is reset to 0, "weaponactive" is set to true, and the weapon resumes firing.

    I haven't coded anything relatively complex in a long time, so I really need some help with this.
Working...
X