1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Help with Coding...

Discussion in 'Programming' started by Cieprus, Feb 19, 2002.

  1. TaoPaiPai

    TaoPaiPai Commisaire Van Loc

    Joined:
    Jun 13, 2000
    Messages:
    1,626
    Likes Received:
    0
    Just to be sure:
    Did you activate the mutator in the 'start new map' window?
     
  2. Cieprus

    Cieprus Mapper...In Progress

    Joined:
    Feb 17, 2002
    Messages:
    113
    Likes Received:
    0
    What do you mean? Where you choose the mutators? Ummm Ya im not that dumb! :D
     
  3. Call me Erdrik

    Call me Erdrik Arch Mage

    Joined:
    Nov 24, 1999
    Messages:
    334
    Likes Received:
    0
    ya know. sometimes the refire rate is hard to notice, maybe you should add a graphic effect to flag that it is the new enforce then you'll know that the new enforcer is being spawned and can start looking for the real bug... Im at work so Ill download the .u tonite and check it out :p
     
  4. Wormbo

    Wormbo Administrator Staff Member

    Joined:
    Jun 4, 2001
    Messages:
    5,913
    Likes Received:
    36
    Add this to your SuperEnforcer class:
    Code:
    defaultproperties
    {
         FireSound=Sound'Botpack.SniperRifle.SniperFire'
    }
    The weapon's firing sound is the one of the sniper rifle then. Should be easy to tell whether you're playing with the new or old enforcer.
     
  5. Cieprus

    Cieprus Mapper...In Progress

    Joined:
    Feb 17, 2002
    Messages:
    113
    Likes Received:
    0
    Ok thanks Edrik have a go at it...Thanks Wormbo!
     
  6. Cieprus

    Cieprus Mapper...In Progress

    Joined:
    Feb 17, 2002
    Messages:
    113
    Likes Received:
    0
    Well I added that FireSound code...But it doesnt matter because Im still getting the same error as before...So I cant even start a game with the mutator loaded
     
  7. jb

    jb New Member

    Joined:
    May 22, 2000
    Messages:
    278
    Likes Received:
    0
    Ok I downloaded you file. Recomplied it. Summon it in a practicematch and it worked just fine. I even added the minigun sound to ensure it was working. Next up you have to make an int file in your ut/systems dir



    [Public]
    Object=(Name=SuperEnforcer.SuperEnforcer,Class=Class,MetaClass=Engine.Mutator,Description="Super Enforcer")


    call it superenforcer.int

    then start ut, go to the game menu and you will see it in the mut list. However your right the mut is not working right as its not swapping. I added a log statement to your code. Recomplied it and ran it. It never showed up in the log. Something is not working right there.


    again to test it use the summon command:


    summon superenforcer.superenforcer
     
    Last edited: Feb 25, 2002
  8. Cieprus

    Cieprus Mapper...In Progress

    Joined:
    Feb 17, 2002
    Messages:
    113
    Likes Received:
    0
    Ok Ill try it out!
     
  9. Cieprus

    Cieprus Mapper...In Progress

    Joined:
    Feb 17, 2002
    Messages:
    113
    Likes Received:
    0
    OMG THANK THE GREAT LORD JESUS! it worked heres an update Whoooo hooo <-Not part of the update.

    It works with the summon command, But then It gives me double enforcers, The enforcer on the right triple fires the one on the left does nothing and hte single enforcer normal fires...
     
  10. Raeled

    Raeled Feuer Frei!

    Joined:
    Jul 1, 2001
    Messages:
    161
    Likes Received:
    0
    k here's a working version of the mutator:

    Code:
    class SuperEnforcerMutator expands Mutator;
    
    function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
    {
      if ( Other.IsA('Enforcer') && !Other.IsA('SuperEnforcer') )
      {
        ReplaceWith(Other, "SuperEnforcer.SuperEnforcer");
        return false; // <- important change here
      }
      return super.CheckReplacement(other, bSuperRelevant);
    }
    
    defaultproperties
    {
      DefaultWeapon=Class'SuperEnforcer.SuperEnforcer'
    }
    
     
  11. Cieprus

    Cieprus Mapper...In Progress

    Joined:
    Feb 17, 2002
    Messages:
    113
    Likes Received:
    0
    Ok heres the current SuperEnforcer.uc code:

    //
    class SuperEnforcer expands Enforcer;

    //***************************************Func TraceFire
    function TraceFire( float Accuracy )
    {
    local vector RealOffset;

    RealOffset = FireOffset;
    FireOffset *= 0.15;
    if ( (SlaveEnforcer != None) || bIsSlave )
    Accuracy = FClamp(1*Accuracy,0.75,3);
    else if ( Owner.IsA('Bot') && !Bot(Owner).bNovice )
    Accuracy = FMax(Accuracy, 0.45);

    Super.TraceFire(Accuracy);
    FireOffset = RealOffset;
    }
    //***************************************Func Fire
    function Fire(float Value)
    {
    if ( AmmoType == None )
    {
    // ammocheck
    GiveAmmo(Pawn(Owner));
    }
    if ( AmmoType.UseAmmo(1) )
    {
    GotoState('NormalFire');
    bCanClientFire = true;
    bPointing=True;
    ClientFire(value);
    if ( SlaveEnforcer != None )
    Pawn(Owner).PlayRecoil(2 * FiringSpeed);
    else if ( !bIsSlave )
    Pawn(Owner).PlayRecoil(FiringSpeed);
    TraceFire(0.2);
    }
    }
    //***************************************Sim Func PlayFiring
    simulated function PlayFiring()
    {
    PlayOwnedSound(FireSound, SLOT_None,2.0*Pawn(Owner).SoundDampening);
    bMuzzleFlash++;
    PlayAnim('Shoot',2.1 + 0.31 * FireAdjust, 0.02);
    }
    //***************************************Sim FUnc PlayAltFiring
    simulated function PlayAltFiring()
    {
    PlayAnim('T1', 3.1, 0.05);
    bFirstFire = true;
    }
    //***************************************Sim Func PlayRepeatFiring
    simulated function PlayRepeatFiring()
    {
    if ( Affector != None )
    Affector.FireEffect();
    if ( PlayerPawn(Owner) != None )
    {
    PlayerPawn(Owner).ClientInstantFlash( -0.2, vect(325, 225, 95));
    PlayerPawn(Owner).ShakeView(ShakeTime, ShakeMag, ShakeVert);
    }
    bMuzzleFlash++;
    PlayOwnedSound(FireSound, SLOT_None,2.0*Pawn(Owner).SoundDampening);
    PlayAnim('Shot2', 3.1 + 0.3 * FireAdjust, 0.02);
    }
    //***************************************Func Alt Firing
    function AltFire( float Value )
    {
    bPointing=True;
    bCanClientFire = true;
    AltAccuracy = 0.1;
    if ( AmmoType == None )
    {
    // ammocheck
    GiveAmmo(Pawn(Owner));
    }
    if (AmmoType.AmmoAmount>0)
    {
    if ( SlaveEnforcer != None )
    Pawn(Owner).PlayRecoil(3 * FiringSpeed);
    else if ( !bIsSlave )
    Pawn(Owner).PlayRecoil(1.5 * FiringSpeed);
    ClientAltFire(value);
    GotoState('AltFiring');
    }
    }
    //******************************************State Normal Firing
    state NormalFire
    {
    ignores Fire, AltFire, AnimEnd;

    function Timer()
    {
    if ( SlaveEnforcer != none )
    SlaveEnforcer.Fire(0);
    }

    function EndState()
    {
    Super.EndState();
    OldFlashCount = FlashCount;
    }

    Begin:
    FlashCount++;
    if ( SlaveEnforcer != none )
    SetTimer(0.20, false);
    FinishAnim();
    if ( bIsSlave )
    GotoState('Idle');
    else
    Finish();
    }
    //*******************************************State Alt Firing
    state AltFiring
    {
    ignores Fire, AltFire, AnimEnd;

    function Timer()
    {
    if ( Slaveenforcer != none )
    Slaveenforcer.AltFire(0);
    }

    function EndState()
    {
    Super.EndState();
    OldFlashCount = FlashCount;
    }

    Begin:
    if ( SlaveEnforcer != none )
    SetTimer(0.20, false);
    FinishAnim();
    Repeater:
    if (AmmoType.UseAmmo(1))
    {
    FlashCount++;
    if ( SlaveEnforcer != None )
    Pawn(Owner).PlayRecoil(3 * FiringSpeed);
    else if ( !bIsSlave )
    Pawn(Owner).PlayRecoil(1.5 * FiringSpeed);
    TraceFire(AltAccuracy);
    PlayRepeatFiring();
    FinishAnim();
    }

    if ( AltAccuracy < 3 )
    AltAccuracy += 0.1;
    if ( bIsSlave )
    {
    if ( (Pawn(Owner).bAltFire!=0)
    && AmmoType.AmmoAmount>0 )
    Goto('Repeater');
    }
    else if ( bChangeWeapon )
    GotoState('DownWeapon');
    else if ( (Pawn(Owner).bAltFire!=0)
    && AmmoType.AmmoAmount>0 )
    {
    if ( PlayerPawn(Owner) == None )
    Pawn(Owner).bAltFire = int( FRand() < AltReFireRate );
    Goto('Repeater');
    }
    PlayAnim('T2', 0.9, 0.05);
    FinishAnim();
    Finish();


    }
    defaultproperties
    {
    }


    And this is what happens:

    I start the game and summon teh SuperEnforcer

    I pick it up, then switch to it...Its like having 2 weapons to shoose from when I choose the enforcer.

    It shoots 3 times as fast on normal fire..Then on alt firt it shoots a lil faster

    The accuracy when I have 1 SuperEnforcer Is close to perfect, just the way I want it...

    When I summon another SuperEnforcer heres how it screws up:

    I pick it up, When I shoot normal Fire it shoots the Right gun(The non slave) the way it should, but the slave doesnt fire SOMETIMES! it Sometimes does fire

    When I alt fire the 2 Superenforcers, They fire correctly.

    This is really wierd..So help a brother out! :rolleyes:
     
  12. Call me Erdrik

    Call me Erdrik Arch Mage

    Joined:
    Nov 24, 1999
    Messages:
    334
    Likes Received:
    0
    Code:
    //***************************************Func Fire 
    function Fire(float Value) 
    { 
    if ( AmmoType == None ) 
    { 
    // ammocheck 
    GiveAmmo(Pawn(Owner)); 
    } 
    if ( AmmoType.UseAmmo(1) ) 
    { 
    [b]GotoState('NormalFire'); [/b]
    bCanClientFire = true; 
    bPointing=True; 
    ClientFire(value); 
    if ( SlaveEnforcer != None ) 
    Pawn(Owner).PlayRecoil(2 * FiringSpeed); 
    else if ( !bIsSlave ) 
    Pawn(Owner).PlayRecoil(FiringSpeed); 
    TraceFire(0.2); 
    } 
    } 
    
    //***************************************Func Alt Firing 
    function AltFire( float Value ) 
    { 
    bPointing=True; 
    bCanClientFire = true; 
    AltAccuracy = 0.1; 
    if ( AmmoType == None ) 
    { 
    // ammocheck 
    GiveAmmo(Pawn(Owner)); 
    } 
    if (AmmoType.AmmoAmount>0) 
    { 
    if ( SlaveEnforcer != None ) 
    Pawn(Owner).PlayRecoil(3 * FiringSpeed); 
    else if ( !bIsSlave ) 
    Pawn(Owner).PlayRecoil(1.5 * FiringSpeed); 
    ClientAltFire(value); 
    [b]GotoState('AltFiring'); [/b]
    } 
    
    Ive never worked with the enforcers before but I noticed that the gotostate for fire is before the code and the one in alt fire is after. not sure if this is relevent but, eh :rolleyes:

    and you seem to be missing some things in your NormalFire state... like the beginstate function, and there is a lot of code in the Altfire's begin label compared to normalfire... but like I said, i got no expirence with the enforcers... just seems to me that it would need these things in normalfire... :p
     
  13. Cieprus

    Cieprus Mapper...In Progress

    Joined:
    Feb 17, 2002
    Messages:
    113
    Likes Received:
    0
    Well i copyed it from the real enforcers code, so it should be right..Right?
     

Share This Page