Azarael
07-03-2009, 01:03 PM
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)
{
CurrentWeapon++;
if(CurrentWeapon > 5){
CurrentWeapon = 0;
}
SetActiveWeapon(CurrentWeapon);
if(CurrentWeapon == 0)
bShowChargingBar=True;
else bShowChargingBar=False;
if (PlayerController(Controller) != None){
PlayerController(Controller).ReceiveLocalizedMessa ge(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.
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).ReceiveLocalizedMessa ge(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.