Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Switching between vehicle weapons, online.

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

  • Switching between vehicle weapons, online.

    I'll admit first-hand that my experience with coding is limited. I currently have a vehicle descended from ONSAttackCraft which switches between weapons with altfire. This all works fine offline, but doesn't work online. For the second weapon (which is a lift of the Goliath's machinegun) tracers are spawned along with the lasers of the first weapon in the array. The other weapons, which fire projectiles, spawn relevant muzzle flashes at the correct intervals...while firing lasers. The localised messages saying which weapon is active work fine, and the charging bar appears and disappears correctly. Using VehicleFire instead of AltFire causes no projectiles to be spawned and no traces for damage to be done, suggesting that the server isn't registering a weapon at all.

    Code:
    function AltFire(optional float F)
    {
    CurrentWeapon++;
    if(CurrentWeapon > 5){
    CurrentWeapon = 0;
    }
    SetActiveWeapon(CurrentWeapon);
    if(CurrentWeapon == 0)
    bShowChargingBar=True;
    else bShowChargingBar=False;
    if (PlayerController(Controller) != None){
    PlayerController(Controller).ReceiveLocalizedMessage(class'VenomSwitchMessage', CurrentWeapon);
    }
    }
    I'm vaguely aware of the concept of replication, but I'm not sure what exactly I need to replicate. Looking at the Leviathan, which switches weapons when it deploys and undeploys, I can't see any replication for weapon changing, and even removing the CurrentWeapon variable and replacing it with, for example, "1" has no effect, so I doubt I need to replicate that variable. Edit: ActiveWeapon is replicated in ONSVehicle...

    I may be doing something extremely stupid and/or hackish here, so try not to lay into me if that's the case. :P

    Thanks in advance for any help.

    Edit: Fixed.

  • #2
    What kind of a variable is CurrentWeapon and where is it defined?

    Comment


    • #3
      CurrentWeapon is a global int. It's always worked, since I had logging code to check that the server and the client's version of CurrentWeapon was the same when doing some replication.

      It works now, using VehicleFire() instead of AltFire(), doing the code above if bWasAltFire, else bWeaponIsFiring = true.

      Comment

      Working...
      X