PDA

View Full Version : Holding 6 rocket load ClientSide


War Master
09-24-2006, 07:04 AM
Hi All, I need a hand on coding a subclass from the UT_Eightball (RocketLauncher).

I'm making a mod with modified Instagibs ala UT2k4 style for UT99. The mod is called ArenaPlus which is a set of mutators that will enhance the gameplay for any custom or default Arena Mutators. In this mod I'm also adding some modified Instagibs and a super-cool SniperRifle(BerserkRifle) that can be configured thru an .ini on many things like firing modes, zoom sounds, explosion, damage, etc. Well, the problem I'm bumping on is in the SuperRocketLauncher weapon I'm coding to be able to hold all 6 rockets until the player releases the fire button. I got the weapon working perfectly server-side but I still have problems with the code to stop playing animations Client-Side when all 6 rockets are loaded. If anyone knows a mod that has done this already or know how to code it properly, please let me know. I will really appreciate your help and give you the credit for it. TY

I hope I didnt sound too dramatic but trying to code that gun right Client-Side is making me go :hammer:

oh, and no. RocketsUT dont work right either :dunno:

XYZ8000
09-24-2006, 07:39 AM
I remember that a similar RL was used into Apocalypse weapons. But I don't play online, so I can't say if it works correctly.

http://mods.moddb.com/702/apocalypse-weapons/

Creeper
09-24-2006, 01:27 PM
Haha. Hi WM!

:hammer:

Derdak2rot
09-24-2006, 02:25 PM
is the sniper mesh i did for you will be in this mod ?
you didnt replied to me , if you were ok with it :p

about the codes , hmm , i dunno , there is not a lot of coder here ,maybe ask in the coding section on BU ;)

War Master
09-24-2006, 09:00 PM
Hi Derdak2rot, Hi XYZ2000, Hi Creeper,

Well Derd, I found out that the file I was using -which was an edited t3d where I manually deleted the polys- came out messed up a bit. For some reason, it was still reading the shape of the cone I deleted even when I added a new mesh into it. In this case, the old cone shape which was 8 sided was deforming the new 16 sided cone by making it look pointy in some of the sides as you noticed. So, about a month after you helped me out I met a guy that had an editing program and helped me fix the gun by deleting the old scope part and placing my new scope made in UED3.0 into one piece. The gun looks great now and I got it animated and all but it still needs to be coded in order for it to work with UTPure. After I finished ArenaPlus I will try to finish the ClassicSniper2k4 but I still need to figure out some codes in order to get it working with any protections. I'll let you all know!

I checked almost every mod possible already and noticed that none of them work properly Client-Side (Online). The Apocalypse weapons were never fixed to play the animations to the way the weapons were coded and is one reason why noone hosts those weapons at all and the same goes with the RocketsUT. I tried the code from one of the RocketsUT gun and is missing a single command in order to work correctly Client-Side which I tried to figure out but got stuck on it without any results. Mostly, what the Client-Side code does is play the animations for Online players as the weapon code goes. In other words, it kind of imitates what the gun is doing Server-Side and keeping up with the animations in order to look like is shooting and so on. The Client-Side code is very different from the actual weapon code and that's where people get stuck most of the time or don't bother fixing it so that it plays correctly for Online players. So if anyone knows a good tutorial (not the Wiki) that explains how the Client-Side code works or can give me a hand fixing mine, please let me know or post a link to it. TYs.

Here's what I changed so far:


//=============================================================================
// SuperRocketLauncher.
//=============================================================================

class SuperRocketLauncher expands UT_Eightball config(ArenaPlus);

var config bool bHoldLoad;
var config bool bHoldAltLoad;

///////////////////////////////////////////////////////
state NormalFire
{
function bool SplashJump()
{
return true;
}

function Tick( float DeltaTime )
{
if ( (PlayerPawn(Owner) == None)
&& ((Pawn(Owner).MoveTarget != Pawn(Owner).Target)
|| (LockedTarget != None)
|| (Pawn(Owner).Enemy == None)
|| ( Mover(Owner.Base) != None )
|| ((Owner.Physics == PHYS_Falling) && (Owner.Velocity.Z < 5))
|| (VSize(Owner.Location - Pawn(Owner).Target.Location) < 400)
|| !Pawn(Owner).CheckFutureSight(0.15)) )
Pawn(Owner).bFire = 0;

if( pawn(Owner).bFire==0 || (// !bHoldLoad && // RocketsLoaded > 5))
GoToState('FireRockets');
}

function AnimEnd()
{
if ( bRotated )
{
bRotated = false;
// This is what's missing on the Client Fire and can't get it to stop animation... where does it go? //
// if ( RocketsLoaded < 6 ) //
PlayLoading(1.1, RocketsLoaded);
}
else
{
if ( RocketsLoaded == 6 // || !bHoldLoad //)
{
GotoState('FireRockets');
return;
}
RocketsLoaded++;
AmmoType.UseAmmo(1);
if (pawn(Owner).bAltFire!=0) bTightWad=True;
NewTarget = CheckTarget();
if ( Pawn(NewTarget) != None )
Pawn(NewTarget).WarnTarget(Pawn(Owner), ProjectileSpeed, vector(Pawn(Owner).ViewRotation));
if ( LockedTarget != None )
{
If ( NewTarget != LockedTarget )
{
LockedTarget = None;
Owner.PlaySound(Misc2Sound, SLOT_None, Pawn(Owner).SoundDampening);
bLockedOn=False;
}
else if (LockedTarget != None)
Owner.PlaySound(Misc1Sound, SLOT_None, Pawn(Owner).SoundDampening);
}
bPointing = true;
Owner.MakeNoise(0.6 * Pawn(Owner).SoundDampening);
RotateRocket();
}
}

function BeginState()
{
Super.BeginState();
bFireLoad = True;
RocketsLoaded = 1;
RotateRocket();
}

function RotateRocket()
{
if ( PlayerPawn(Owner) == None )
{
if ( FRand() > 0.33 )
Pawn(Owner).bFire = 0;
if ( Pawn(Owner).bFire == 0 )
{
GoToState('FireRockets');
return;
}
}
if ( AmmoType.AmmoAmount <= 0 )
{
// if ( !bHoldLoad ) //
GotoState('FireRockets');
return;
}
if ( AmmoType.AmmoAmount == 1 )
Owner.PlaySound(Misc2Sound, SLOT_None, Pawn(Owner).SoundDampening);
PlayRotating(RocketsLoaded-1);
bRotated = true;
}

Begin:
Sleep(0.0);
}

state ClientFiring
{
simulated function Tick(float DeltaTime)
{
if ( (Pawn(Owner).bFire == 0) || (// !bHoldLoad && // Ammotype.AmmoAmount <= 0) )
FiringRockets();
}

simulated function AnimEnd()
{
if ( !bCanClientFire || (Pawn(Owner) == None) )
GotoState('');
else if ( bClientDone )
{
PlayLoading(1.5,0);
GotoState('ClientReload');
}
else if ( bRotated )
{
PlayLoading(1.1, ClientRocketsLoaded);
bRotated = false;
ClientRocketsLoaded++;
}
else
{
if ( bInstantRocket || (ClientRocketsLoaded == 6) )
{
// if ( !bHoldLoad ) //
FiringRockets();
return;
}
Enable('Tick');
PlayRotating(ClientRocketsLoaded - 1);
bRotated = true;
}
}

simulated function BeginState()
{
bFireLoad = true;
if ( bInstantRocket )
{
ClientRocketsLoaded = 1;
FiringRockets();
}
else
{
ClientRocketsLoaded = 1;
PlayRotating(ClientRocketsLoaded - 1);
bRotated = true;
}
}

simulated function EndState()
{
ClientRocketsLoaded = 0;
bClientDone = false;
bRotated = false;
}
}



Once I get the gun animating properly Client-side I will code the rest.

Derdak2rot
09-24-2006, 09:08 PM
i know nothing about coding , but why not watch the original weapons code ? , maybe theres something you can borrow :)
you probably di it already so ignore this post if im wrong :p