Announcement

Collapse
No announcement yet.

OutOfAmmo function and Replication Problem

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

    #16
    oh my, im speechless, i'll give it a go! even if it doesnt work a big huge thankyou to you!!

    edit: can't get it to compile I've never done anything like this before so it is all new for me, error is:

    Code:
    \Classes\ScorchReplicationInfo.uc(79) : Error, Left type is incompatible with '!='
    referring to this line:

    Code:
    simulated function ClientDestroyScorches(Controller C)
    {
    	local int i;
    
    		for (i=0; i < Scorches.Length; i++)
    			if (Scorches[i] != None && Scorches[i].Controller == C)
    			{
    				Scorches[i].Scorch.DetachProjector();
    				Scorches[i].Scorch.Destroy();
    				Scorches.Remove(i, 1);
    				i--;
    			}
    }
    also I have 9 different scorch classes... different colours. but for now i'm just going to try this with one colour scorch and figure out how to destroy them all this way much later on..

    they all extend a parent class that extends xScorch, so shouldnt they all get destroyed anyway ?

    edit2: I commented out that part of the code and tried to compile it to see if there was anymore errors and I got this one aswel, dont know if thers anymore yet.

    Code:
     Error, Call to 'GetSRI': bad or missing parameter 1
    referring to this line.
    Code:
    SRI = class'ScorchReplicationInfo'.static.GetSRI(GetLocalPlayerController());

    Comment


      #17
      hehe nuts, I guess it was too much to expect it to work on the first go. Let's see if I can point out and fix up the errors of my ways here....



      First error: \Classes\ScorchReplicationInfo.uc(79) : Error, Left type is incompatible with '!='

      Here "Left type" is the ScorchInfo struct, and "!= None" doesn't make sense when referring to struct values (though it's perfectly valid with reference members of the struct, of course, as is done below). Here's how it should have been done:
      Code:
      simulated function ClientDestroyScorches(Controller C)
      {
      	local int i;
      	for (i=0; i < Scorches.Length; i++)
      		if (Scorches[i].Controller == C)
      		{
      			if (Scorches[i].Scorch != None)
      			{
      				Scorches[i].Scorch.DetachProjector();
      				Scorches[i].Scorch.Destroy();
      			}
      			Scorches.Remove(i, 1);
      			i--;
      		}
      }


      Second error: Error, Call to 'GetSRI': bad or missing parameter 1

      Simple brain fart ... GetLocalPlayerController() is defined in LevelInfo, and I forgot to add the Level reference ... silly me. Just change it to this:
      Code:
      SRI = class'ScorchReplicationInfo'.static.GetSRI(Level.GetLocalPlayerController());


      lol Thanks for pointing that stuff out.

      Comment


        #18
        lol!!!

        ok it all compiles now, as usual your code was good

        offline, everythig is ok, the scorches are destroyed for all players when the weapon runs out of ammo or if the owner dies.

        but online it doesnt work. when the weapon runs out of ammo or when the owner dies the scorches remain for all players, even the owner. (they disapeared for the owner before, eek!)

        hhm

        edit: i made it log this log("Level.NetMode == NM_DedicatedServer:"@Level.NetMode == NM_DedicatedServer);
        when it ran out of ammo and when you died. Both of them were logged on the server and on the client. (true for server, false for client)

        do you have any ideas why it isnt workin? it seems we are so close to solving it!

        Comment


          #19
          Well, that's too bad. The idea of how to use a ReplicationInfo class for what you're doing is there I think, though it would have been nice if those bits of code could have been straight pasted in to your stuff. If you want to PM me what you're working on I wouldn't mind taking a look....



          Replication is such a / sort of thing ... good exercise for the brain though.

          Comment

          Working...
          X