Results 1 to 3 of 3
  1. #1
    The Sacrifice
    Join Date
    Jun 2009

    Default 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.

    function AltFire(optional float F)
    if(CurrentWeapon > 5){
    CurrentWeapon = 0;
    if(CurrentWeapon == 0)
    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.
    Last edited by Azarael; 07-03-2009 at 02:29 PM.

  2. #2
    God King
    Join Date
    Nov 2007


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

  3. #3
    The Sacrifice
    Join Date
    Jun 2009


    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.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Copyright ©2009-2015 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by