Announcement

Collapse
No announcement yet.

Replication and Emitters?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Replication and Emitters?

    So here's the deal. I have a mover which spawns an effect when it "moves"

    hint : It's a pane of glass.


    Anyway, here is the relevant code.

    Code:
    class KFGlassMover extends Mover;
    
    
    replication
    {
        reliable if(Role == ROLE_Authority)
            ClientGlassBits;
    }
    
    // When bumped by player (OR ZOMBIES!!!!). evil things happen ....
    
    simulated function Bump( actor Other )
    {
    
     // if our window crasher is a Zombie, he must use his arms to break the glass,
     // and pause for a moment while doing this!
     if (Other.IsA('KFMonster'))
      xPawn(Other).SetAnimAction('Claw2');
    
     // Log("Touching actor was moving at:");
     // Log(Other.Velocity);
    
      // If the incoming object is moving at a speed above our set threshold ..
      if (vSize(Other.Velocity) >= 10)
      {
        // "Destroy" our bit of glass
    
        // Spawn chips of glass from broken window Fragment
         GotoState( , 'Open' );
         self.SetCollision(false,false,false);
         bHidden = true;
         Other.Velocity = Vect(0,0,0);
      }
      
      
      if ( EffectIsRelevant(Location,false) )
       ClientGlassBits();
    
    
    }
    
    
    simulated function ClientGlassBits()
    {
      local Emitter GlassShards;
    
      GlassShards = Spawn(GlassBits,,,Location,Rotation);
    }
    It works just fine offline, thank you very much (Standalone and listen servers)

    but online, no glass bits will spawn when the window breaks. Now I'm just learning about replication, but hopefully someone could point me in the right direction?

    I had THOUGHT that through my replication block of ROLE=RoleAutority I managed to notify the client of the ClientGlassBits() ?

    Im confused :S

    #2
    RETARDEDLY,

    i got it working about 30 seconds after making this post.

    lol

    Nevertheless, anyone who could offer some pointers on function replication would be my hero

    Comment


      #3
      All I can point you to is here: http://wiki.beyondunreal.com/wiki/Replicated_Function

      There's also a link to the 'main' replication page, but it's quite messed up. You can easily get confused by it, look out for that..

      Comment


        #4
        Does anyone have any idea what is was he was doing wrong. Im trying to work out the same problem
        Code:
        class VecFxTagger extends trigger
        Placeable;
        
        Var () class< Emitter >                  FXClass;
        Var () Emitter                   SpawnedEmitter;
        
          replication {reliable
                    if (bNetDirty  &&  role == role_authority)
                        SpawnedEmitter;
                   }
        
         simulated Function Touch(Actor Other)
         {
         log("***************       hello Iwas touched");
         if (other.isa('Vehicle'))
           {
            Thetag(vehicle(other));
            log("***************       hello it was A vec");
           }
          super.Touch( Other );
         }
        
         simulated function Thetag(vehicle thevec)
         {
          local Int I;
        
          log("***************       hello i will attempt to spawnsomething now");
          for (i= 0 ;I<thevec.attached.length;i++ )
              {
               If (!thevec.attached[i].isa('Emitter'))
                  {
                   While ( SpawnedEmitter == None )
                         {
                          SpawnedEmitter=Spawn( FXClass ,  thevec, ,  thevec.Location ,  thevec.Rotation ) ;
                          SpawnedEmitter.SetBase( thevec );
                         }
                   log("***************       hello "$SpawnedEmitter);
                   }
                }
         }
        
        Defaultproperties
        {
        RemoteRole=Role_SimulatedProxy
        }
        Im not getting anything show up in the log for the client.
        Is this something i need to set in the default ptoperties because the same sort of code in a vehicle seems to work ok?

        Comment


          #5
          Yeah, come on XAlexX, post your solution!

          I've been through and edited most of the wiki pages on Replication and I can tell you they're far from good enough... they're either incomplete or if they are complete they're unclear! So how did you fix your problem?

          Thanks

          Comment


            #6
            @fatal: I think in your replication block you need

            Code:
              replication {
                reliable if (bNetDirty  &&  role == role_authority)
                  SpawnedEmitter;
                reliable if ( role == role_authority)
                  theTag;
              }
            i.e. the simulated function does not automatically get run client-side, it must be replicated too as far as I understand it.

            http://wiki.beyondunreal.com/wiki/Simulated_Function

            Comment


              #7
              OK i used
              Code:
                replication {
                  reliable if (bNetDirty  &&  role == role_authority)
                    SpawnedEmitter;
                  reliable if ( role == role_authority)
                    theTag;
                }
              But that didnt do it either. Im not getting ANY of my logs pop up from the client

              The server log is fine;-
              ScriptLog: *************** hello Iwas touched
              ScriptLog: *************** hello i will attempt to spawnsomething now
              ScriptLog: *************** hello ONS-Droptest.ONSAutoBomberDeathFlames
              ScriptLog: *************** hello it was A vec
              But no sign of anything in the client log?

              Comment


                #8
                I cant seem to find an answer for this anywhere. Iv looked in the forums here ,theres plenty of people who have asked how its done but no solutions ?

                Comment


                  #9
                  Have you tried setting bGameRelevant? just a guess

                  Comment


                    #10
                    Not yet. I think its in the deafault properites whatever it is as im sure im setting up the code ok. Ill give it a go.

                    Comment


                      #11
                      No that didnt make any difference. Im still not getting anything show up in the log on the client. I know im going to kick myself when i realise what it is.

                      Comment


                        #12
                        in my experience it works like this..you don't replicate the emitter, you replicate the functions etc.. but you could always try putting these default properties in the emitter:
                        Code:
                             bNetTemporary=True
                             RemoteRole=ROLE_DumbProxy
                        or if it an xemitter try this :
                        Code:
                        function PreBeginPlay()
                        {
                        	Super.PreBeginPlay();
                        	RemoteRole=ROLE_SimulatedProxy;
                        }
                        but i had the same problem trying to spawn an actor online but i got it to work with this code in the actual function that called the actor:
                        Code:
                                local class<MonsterINI> nmc; //new monster class
                        	local blueskaarjbaby newMonster;
                        	
                        	if (Role == ROLE_Authority)
                        	    {
                        	        nmc = class'blueskaarjbaby';
                        	        newMonster = blueskaarjbaby(Spawn(nmc,,,Location+((nmc.Default.CollisionHeight+128)*vect(0,0,1)),Rotation));
                        	        }
                        shouldn't be hard at all to change the names around so it fits your emitter.

                        Also don't forget that anything that is essential to the game such as weapon fire is automatically replicated by code deep in the game so if you call anything in any of those functions they will automatically be replicated aswel.

                        also try a search if you havnt already for other people with the same problem with emitters or xemitters, i'm sure there is alot of threads out there.

                        Comment


                          #13
                          Thanks ill give it a go. Ive gone back to doing some basic replication testing untill i get this right now, im fedup with trying to muddle my way though it. Im finding the stuff written at wiki about replication VERY confusing. Theres plenty written in theory but no decent examples for me to work off.
                          Ive been trying to get this solved for a few weeks now with no real progress. I think im going to start downloading other peoples mods and see how they did it.

                          Comment

                          Working...
                          X