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.

Akimbo replication troubles, to the limit

Discussion in 'Ask a Coder' started by EvilDrWong, Aug 12, 2003.

?

A poll? What for?

  1. I do not know!

    0 vote(s)
    0.0%
  2. Silly rabbit, poles are for strippers!

    2 vote(s)
    25.0%
  3. Arnold for President!!!

    3 vote(s)
    37.5%
  4. Make a flamethrower!

    3 vote(s)
    37.5%
  1. EvilDrWong

    EvilDrWong Every line of code elevates you

    Joined:
    Jun 16, 2001
    Messages:
    932
    Likes Received:
    0
    Ok so yesterday, if you were attentive, you would have noticed a thread that was up for about an hour and a half. I was having trouble getting the second pistol to show up in network games. I finally fixed that issue about a half hour after i posted asking for help, so i figured i might as well delete the thread. Now im back, with yet more troubles.
    You see, i took a peek at the Akimbo mutator's method of making weapons akimbo, and for the most part its great. Had to hack away some of the stuff, but it works online now. The only real problem is that the slaved weapon wont animate unless its master tells it to (in this case that only happens during BringUp and PutDown)
    The real issue with that is that you can fire, but the second one wont appear to shoot. I can live with that, but im sure that anyone who might play it would be kinda irked, so i need a fix for it. Ive got a feeling that theres something going horribly wrong, since the second pistol's ModeDoFire and InitEffects pump out AN's like nobody's business, but i have no idea why it would do that. The weapon exists both client and server side, so what would cause the firemodes to not recognise it? I mean, it doesnt draw a muzzleflash nor does it play the firing animation when i tell it to fire. It just sits there like some lazy bastard...
    Heres a picture from when i just got the second one working online. I set its bHidden to false just to make sure there wasnt anything real wonky happening before it got postrender called, but that produced a third pistol that sort of chased me around, trying to keep itself in place :)
     
  2. EvilDrWong

    EvilDrWong Every line of code elevates you

    Joined:
    Jun 16, 2001
    Messages:
    932
    Likes Received:
    0
    Gah, fixed it. Turns out Instigator wasnt being set for some screwed up reason. Fixed all the problems i was having. Thanks for voting in the poll.
     
  3. MadNad

    MadNad New Member

    Joined:
    Nov 5, 2002
    Messages:
    32
    Likes Received:
    0
    If you are using the same weapon for Akimbo, then just switch hands and render the weapon again. Thats what I am doing for Version 2 of excessive.
    [​IMG]

    If you are trying to get two weapons working its much more a pain....I am close, but i have put it on hold, as I am too busy atm.
    [​IMG]
     
  4. Neuroflare

    Neuroflare Brewer - Patriot

    Joined:
    Jun 21, 2001
    Messages:
    425
    Likes Received:
    0
  5. EvilDrWong

    EvilDrWong Every line of code elevates you

    Joined:
    Jun 16, 2001
    Messages:
    932
    Likes Received:
    0
    the only problem with rendering twice is that the weapon doesnt actually fire twice, it just pretends to. Ive gotten it so you can fire them in sequence when you hold the button down (and unlike the enforcer, the timing doesnt get messed up over long periods of firing.) bandaging and reloading both work just fine with dualies as well. Im rather pleased with what ive done (with the help of that funky Akimbo mutator thats floating around... anyone know the author?)
     
  6. MadNad

    MadNad New Member

    Joined:
    Nov 5, 2002
    Messages:
    32
    Likes Received:
    0

    Hehe, the guns don't really fire anyway....you shoot from your center to your opponent. My akimbo assaults shoot grenades from each weapon. The assault/flak combo above does not use that method of course
     
  7. NeoNight

    NeoNight Lurker

    Joined:
    Feb 3, 2003
    Messages:
    403
    Likes Received:
    0

    I forgot who the author was but um..... if you do a search on the beyond unreal fourms for the word akimbo you can probably find the thread he made where he uploaded the file for the mut....
     
  8. EvilDrWong

    EvilDrWong Every line of code elevates you

    Joined:
    Jun 16, 2001
    Messages:
    932
    Likes Received:
    0
    It doesnt make much sense, but i swear theres a question in here somewhere!

    Once again, this problem rears its ugly head! DAMN YOU REPLICATION! DAMN YOU TO THE STINKIEST AND MOST MUSHROOM FILLED PITS OF HELL!!!
    You see, i changed the format a little. Last time when i had this problem i didnt have a menu where you could select your stuff, but now... well, the times have changed. Players can opt to spawn with two pistols in leiu of a more fearsome weapon. Sadly though, instigators arent being set for the Slave's firemodes (yes, that sounds weird... because it is) but the slave itself is getting the correct instigator. Obviously, this problem doesnt amount to much on an Instant Action or Listenserver (for the server) but being a client of any sort means that the extra pistol you spawn with is three different kinds of screwed up. But you see, the most perplexing predicament of this precarious proposition would have to be that a player can pick up an extra pistol at any time after theyve been spawned... and it works perfectly fine! No instigator problems, the replication doesnt puke all over the logs, and it even mails me a $5 check every two weekends! Hang on, let me fish up the relevant code bits!
    CODE!!!
    Code:
    class Pistol extends HalfCockedWeapon;
    
    var pistol Master, Slave;
    var bool bIsSlave, bSlavingNow;
    var pawn RepInstigator;
    
    replication
    {
        Reliable if(bNetDirty&&bNetOwner&&Role==ROLE_Authority)
            Slave, Master;
        reliable if(bNetDirty&&Role==ROLE_Authority)
            bIsSlave, RepInstigator;
        reliable if(Role==ROLE_Authority)
            ClientSideSlaveStuff;
    }
    
    function GiveTo(Pawn Other, optional Pickup Pickup)
    {
    local pistol tPistol;
    
        tPistol=Pistol(Other.FindInventoryType(class));
        if(tPistol!=None&&tPistol.Slave==None&&tPistol.Master==None)
        {
            Instigator=Other;
            tPistol.SpawnDouble(Self);
            Return;
        }
    
        RepInstigator=Other;
    
        Super.GiveTo(Other, Pickup);
    }
    
    simulated function SpawnDouble(optional Pistol AlreadyFilled)
    {
    local inventory Copy;
    
        if(Slave==none)
        {
            if(AlreadyFilled!=None)
                Slave=AlreadyFilled;
            else
            {
                Copy=Spawn(class, Pawn(Owner) );
                Slave=Pistol(Copy);
            }
            if(Slave!=None)
            {
                Slave.SetOwner(Owner);
                Slave.Ammo[0]=Ammo[0];
                Slave.Ammo[1]=Ammo[1];
                Slave.bIsSlave=True;
                Slave.Master=Self;
                Slave.Instigator=RepInstigator;
                slave.FireMode[0].Instigator=RepInstigator;
                slave.FireMode[1].Instigator=RepInstigator;
                MagazineSize=Class.Default.MagazineSize*2;
                ClipCount=min(MagazineSize,ClipCount+class.Default.MagazineSize);
                if(Slave.ThirdPersonActor==None&&Pawn(Owner).Weapon==Self)
                {
                    Slave.ThirdPersonActor=Spawn(Slave.AttachmentClass,Owner);
                    InventoryAttachment(Slave.ThirdPersonActor).InitFor(Slave);
                    Pawn(Owner).AttachToBone(Slave.ThirdPersonActor,'Bip01 L Hand');
                    Slave.ThirdPersonActor.SetRelativeRotation(Rot(0,32768,0));
                }
    //            Log(Slave@"exists during SpawnDouble on the Server?");
                Slave.ClientSideSlaveStuff(RepInstigator);
    //            Sleep(0.3);
                Instigator.Inventory.OwnerEvent('ChangedWeapon');
            }
        }
    }
    
    simulated function ClientSideSlaveStuff(pawn NewInst)
    {
        Instigator=NewInst;
        Log("Instigator:"@Instigator@"NewInst:"@NewInst);
        FireMode[0].Instigator=NewInst;
        FireMode[1].Instigator=NewInst;
        ClientState=WS_Hidden;
        GotoState('Hidden');
    //    bHidden=false;
    
        Log(Pawn(Owner).Weapon@"weapon,"@Master@"master"@Master.ClientState@"clientstate");
    
        if(Pawn(Owner).Weapon==Master&&
            (Master.ClientState==WS_ReadyToFire||Master.ClientState==WS_BringUp))
            BringUp();
    }
    
     
    Last edited: Oct 28, 2003
  9. MadNad

    MadNad New Member

    Joined:
    Nov 5, 2002
    Messages:
    32
    Likes Received:
    0
    Try setting your instigator in clientweaponset for both the weapon and firemodes
     
  10. RegularX

    RegularX Master of Dagoth Lies

    Joined:
    Feb 2, 2000
    Messages:
    1,215
    Likes Received:
    0
    So did destroying the firemode class work or are you too busy playing Riftwar to try?
     
  11. EvilDrWong

    EvilDrWong Every line of code elevates you

    Joined:
    Jun 16, 2001
    Messages:
    932
    Likes Received:
    0
    No, it didnt work :( i had absolutely no sleep between yesterday and the day before... so i think that i only managed to mess things up even more :/
     
  12. RegularX

    RegularX Master of Dagoth Lies

    Joined:
    Feb 2, 2000
    Messages:
    1,215
    Likes Received:
    0
    Yeah, half my fixes always seem to turn out that way...
     
  13. EvilDrWong

    EvilDrWong Every line of code elevates you

    Joined:
    Jun 16, 2001
    Messages:
    932
    Likes Received:
    0
    oh, no, your fix didnt mess stuff up. All of my semi-fixes did... thankfully though, ive got a backup of the code from a couple weeks ago... and the only changes ive made to the pistol between now and then have been the ones i did yesterday and the day before :)
     
  14. Shuriken

    Shuriken Cordless Pixie

    Joined:
    Apr 11, 2002
    Messages:
    153
    Likes Received:
    0
    Captain Kewl.
     
  15. EvilDrWong

    EvilDrWong Every line of code elevates you

    Joined:
    Jun 16, 2001
    Messages:
    932
    Likes Received:
    0
    kick ass! Thank you muchly
     

Share This Page