Results 1 to 6 of 6

Thread: Get clientID for use with setOwner

  1. #1

    Get clientID for use with setOwner

    I'm having a bear of a time trying to hand off some AI to a headless client using setOwner. I know setOwner needs to be run on the server and I've tried running this on the server as it creates the AI units in script:

    PHP Code:
    unit setOwner (owner hcName); 
    Where hcName is the actual name of the headless client I create during init using:

    PHP Code:
    if (!hasInterface && !isServerthen{
        
    hcName name player;
        
    publicVariable "hcName";
    }; 
    I've found a few threads about clientID and setowner that don't pertain to what I'm doing. And I've also previously tried to actually spawn the AI directly on the HC and can't seem to get that working, so I've dropped back to try using setOwner.

  2. #2
    PHP Code:
    unit setOwner (owner hcUnit); 
    PHP Code:
    if (!hasInterface && !isDedicatedthen{
        
    hcUnit player;
        
    publicVariable "hcUnit";
    }; 

  3. #3
    Staff Sergeant Johnson11B2P's Avatar
    Join Date
    Jul 8 2012
    Location
    Georgia, United States
    Posts
    318
    If you use setOwner units won't follow waypoints at all. It is best to make the enemies in .sqf file and have only the Headless client exec the file.

  4. #4
    @Naught, I'll try that, must be the fact I used name in the in the init.

    @Johnson11B2P, I've already tried that. The HC executes the script file with all the AI script calls, but the AI script uses createUnit and I'm guessing there's some sort of locality problem with that. I can watch the HC run the script and actually create the groups for the units, but the units themselves never spawn on the dedicated server/connected clients.

  5. #5
    Staff Sergeant Johnson11B2P's Avatar
    Join Date
    Jul 8 2012
    Location
    Georgia, United States
    Posts
    318
    createUnit is a global command it will spawn units. Did you create a Center and a group before you tried to create the units?

  6. #6
    Quote Originally Posted by Johnson11B2P View Post
    createUnit is a global command it will spawn units. Did you create a Center and a group before you tried to create the units?
    Yes, I'm actually using spunFin's AI Spawn script pack, the militarize script in particular. This will create both a center and the groups before the createUnit is run. Though some creative use of hints, variables and radio triggers I've been able to actually watch the headless client run the militarize scripts, create the groups, but it just doesn't create the units, or it's creating them and not synchronizing them off the HC for some reason. Meanwhile the exact same setup works perfectly fine if I run the AI calls from a dedicated server or locally hosted server.

    ---------- Post added at 00:02 ---------- Previous post was at 23:42 ----------

    Think I got it. It's a mess, but it's working. Basically I had to throw a bunch of if/thens into init.sqf to check whether or not there was a HC, etc., and it seems to be working now. Thanks everybody for the help!

Similar Threads

  1. Headless Client/setOwner Question
    By Johnson11B2P in forum ARMA 3 - MISSION EDITING & SCRIPTING
    Replies: 4
    Last Post: Nov 27 2013, 17:32
  2. Get ClientID from PublicVariableServer
    By gdscei in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 19
    Last Post: Mar 30 2013, 15:15
  3. Getting the 'clientID' for 'publicVariableClient'
    By ShaunUK in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 10
    Last Post: Nov 26 2012, 08:12
  4. setOwner command question
    By MrMichael in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 2
    Last Post: Nov 24 2012, 02:25
  5. Question about setOwner
    By A-SUICIDAL in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 18
    Last Post: Sep 30 2012, 17:56

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •