Jump to content

Why are turrets duplicated on-line?


yosh56

Recommended Posts

  • Totem Arts Staff

Simple question I ran in to that is currently breaking my Commander mod. It appears that in Skirmish/single-player, turrets spawn fine and if you look up how many defence classes there are it will show a correct number: e.g on Field if you look up how many Rx_Defence class objects there are, it will show just 2, an Rx_Defence_Turret_0 and 1.

Now, take this on-line, and if you look for how many instances of turrets there are it will be FOUR, from 0-3.

If you want to really look at a crazy list, list Rx_Defence objects on Whiteout... that list is rediculous.

I was just wondering if this is intentional or not, because the way it affects me is the that I can not have turrets set to attack targets properly because the client sends one actor's name, but the server is using some other name for the exact same turret. I might be able to make a full list and make any "0" be a 1 or something like that.

I'll probably post and release the mutator with this deficiency for now, but I would really love to get it settled.

Link to comment
Share on other sites

Hm the number of initialized turrets in multiplayer match is different from singleplayer match? That is weird.

It would be interesting to find out why this is the case. How can I replicate your finding? Is there a console command which lists all objects of specific class?

In any case, I think your issue could be solved this way:

(Replace Rx_Defence with the exact name of duplicated turret class)

Struct All_Actors_Refering_ToA_Single_Turret
{
      var array Actors;
}

var array Turrets;
...
local int i;
local All_Actors_Refering_ToA_Single_Turret NewTurret;
local bool Turret_Already_Exists;

foreach Rx_Game(WorldInfo.Game).AllActors(class'Actor', Other)
{
   if (Rx_Defence(Other) != none)
  {
       Turret_Already_Exists = false;
        for(i = 0; i < Turrets.Length;i++) 
       {
                 if (Turrets[i].Actors[0] == Other.Location)
                  {
                                   Turrets[i].Actors.AddItem(Rx_Defence(Other));
                                   Turret_Already_Exists = true;
                   }
       }
        if (Turret_Already_Exists == false)
       {
                NewTurret.Actors.AddItem(Rx_Defence(Other));
               Turrets.AddItem(NewTurret);
               NewTurret.Actors.Length = 0; 
       }
  }
}

So basically every element of array Turrets will hold all actors refering to a single turret.

Say Field has 2 turrets. If you want to order second turret to fire then iterate through Turrets[1].Actors array and give order to every individual Actor to fire.

This is not elegant solution but I hope it will get the job done until someone manages to figure out this singleplayer-multiplayer weirdness.

Link to comment
Share on other sites

It seems that turrets have their own Controller class.

Instead of referring to placeable turret classes perhaps you should try referring to Rx_Defence_Controller class. Those shouldn't be duplicated in MP match. You should be able to find the location of Controller's turret using this: Rx_Defence_Controller(Actor).Pawn.Location

Link to comment
Share on other sites

  • Totem Arts Staff

I think I found a workaround to solve all problems I'm having now. For vehicles, if the vehicle doesn't have a PRI, it simply sends the location to the server, then the server sets the vehicle actor on itself (Rx_Defence extends vehicles, as I may have told someone otherwise by accident), then it replicates the location of that vehicle to the clients which just find the closest vehicle (of that kind) that is near that location for them, and sets that vehicle to the target.

For Pawns it's much simpler. All Pawns have a PRI attached to them, even bots. I just send the player ID up and tell the clients to look for what actor has that PID.

EDIT: This is no longer an issue I have to concern myself with, thanks to the above change to how I find targets.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...