Results 1 to 6 of 6

Thread: Locality Issue | Custom Composition Occupation

  1. #1

    Locality Issue | Custom Composition Occupation - SOLVED

    Hey guys, i'm currently working on a mission which has some custom compositions which create small camps around the island. I'll explain the brief method that i am using...

    1. I have a Game Logic > Locations > Camp as the object from which the composition is spawned.

    2. The Camp object is called for example "campa";

    3. I then run the camp composition script to create my custom composition around the object.

    All works fine so far...

    Now i then have the following in each of the camp objects.

    Code:
    null = ["vccampa", random 360, getPos this] execVM "scripts\objectMapper.sqf"; patrolgrp = [(getPos campa1),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[2,0.25]] call bis_fnc_spawngroup;  [patrolgrp, (getPos campa1),50] call BIS_fnc_taskPatrol; defendgrp = [(getPos campa1),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[1,0.25],random 360] call bis_fnc_spawngroup;  [defendgrp, (getPos campa1)] call BIS_fnc_taskDefend;
    As you can see this then creates defensive and patrol units around the specified camp.

    This is where my locality issue comes in...

    It seems that using the above method seems to create units for each client, therefore on a camp which has only say, 4 units (2 def, 2 att) ends up being 40 units if i can have 10 people playing the mission. Obvisouly with a number of camps around the island, this then becomes ALOT of units.

    Finally to my question, how can i solve this and only have units created on the server and not local to each player?


    Apologies for the long winded explantion, but i thought it best to get the full picture.

    Thankyou in advance for any help on this matter.
    Last edited by Shadow.D. ^BOB^; Jun 25 2012 at 00:20.

    "Si vis pacem, para bellum"

  2. #2
    Master Gunnery Sergeant twirly's Avatar
    Join Date
    Sep 13 2010
    Location
    Gods Own (NZ)
    Posts
    1,302
    Hi mate... maybe put all your code in a script and put this at the top of it....

    PHP Code:
    if (not (isserver)) exitwith {}; 
    That should stop it running on the clients.

    Execute the script(s) from your init.sqf or wherever.

    MORE:-

    Your script should look like this... you just have to change the getpos this to getpos campa1 I think!

    Code:
    if (not (isserver)) exitwith {};
    
    null = ["vccampa", random 360, getpos campa1] execVM "scripts\objectMapper.sqf";
    patrolgrp = [(getPos campa1),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[2,0.25]] call bis_fnc_spawngroup;
    [patrolgrp, (getPos campa1),50] call BIS_fnc_taskPatrol;
    defendgrp = [(getPos campa1),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[1,0.25],random 360] call bis_fnc_spawngroup;
    [defendgrp, (getPos campa1)] call BIS_fnc_taskDefend;
    Last edited by twirly; Jun 23 2012 at 23:05.

    "Learn by doing!" - Quoted from a post by Imutep

    OUTERRA - OUTERRA - OUTERRA - OUTERRA - BLOWMIND!

  3. #3
    Cheers twirly, tbh i didnt think of that at all. (Thats what you get when trying to watch the footy while editing)

    I'll have a play and see what i can get done...

  4. #4
    Looking good twirly, one more quick question.

    Any idea how i could put a check before the script for each camp starts to check if the camp object is present on the map, atm i have the camp objects on a probability of being there to create a bit more of a random feel. Dont really want a load of errors if the script tries to run on an object which is not present.

    Here is what i have so far:-

    Code:
    if (!isServer) exitwith {};
    
    //////////////////////////////////////
    
    null = ["vccampa", random 360, getpos campa1] execVM "scripts\objectMapper.sqf";
    patrolgrpa1 = [(getPos campa1),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[2,0.25]] call bis_fnc_spawngroup;
    [patrolgrpa1, (getPos campa1),50] call BIS_fnc_taskPatrol;
    defendgrpa1 = [(getPos campa1),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[1,0.25],random 360] call bis_fnc_spawngroup;
    [defendgrpa1, (getPos campa1)] call BIS_fnc_taskDefend;
    
    //////////////////////////////////////
    
    null = ["vccampa", random 360, getpos campa2] execVM "scripts\objectMapper.sqf";
    patrolgrpa2 = [(getPos campa2),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[2,0.25]] call bis_fnc_spawngroup;
    [patrolgrpa2, (getPos campa2),50] call BIS_fnc_taskPatrol;
    defendgrpa2 = [(getPos campa2),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[1,0.25],random 360] call bis_fnc_spawngroup;
    [defendgrpa2, (getPos campa2)] call BIS_fnc_taskDefend;
    
    //////////////////////////////////////
    
    null = ["vccampa", random 360, getpos campa3] execVM "scripts\objectMapper.sqf";
    patrolgrpa3 = [(getPos campa3),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[2,0.25]] call bis_fnc_spawngroup;
    [patrolgrpa3, (getPos campa3),50] call BIS_fnc_taskPatrol;
    defendgrpa3 = [(getPos campa3),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[1,0.25],random 360] call bis_fnc_spawngroup;
    [defendgrpa3, (getPos campa3)] call BIS_fnc_taskDefend;
    
    //////////////////////////////////////
    
    null = ["vccampa", random 360, getpos campa4] execVM "scripts\objectMapper.sqf";
    patrolgrpa4 = [(getPos campa4),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[2,0.25]] call bis_fnc_spawngroup;
    [patrolgrpa4, (getPos campa4),50] call BIS_fnc_taskPatrol;
    defendgrpa4 = [(getPos campa4),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[1,0.25],random 360] call bis_fnc_spawngroup;
    [defendgrpa4, (getPos campa4)] call BIS_fnc_taskDefend;
    
    //////////////////////////////////////
    
    null = ["vccampa", random 360, getpos campa5] execVM "scripts\objectMapper.sqf";
    patrolgrpa5 = [(getPos campa5),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[2,0.25]] call bis_fnc_spawngroup;
    [patrolgrpa5, (getPos campa5),50] call BIS_fnc_taskPatrol;
    defendgrpa5 = [(getPos campa5),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[1,0.25],random 360] call bis_fnc_spawngroup;
    [defendgrpa5, (getPos campa5)] call BIS_fnc_taskDefend;
    
    //////////////////////////////////////
    
    null = ["vccampa", random 360, getpos campa6] execVM "scripts\objectMapper.sqf";
    patrolgrpa6 = [(getPos campa6),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[2,0.25]] call bis_fnc_spawngroup;
    [patrolgrpa6, (getPos campa6),50] call BIS_fnc_taskPatrol;
    defendgrpa6 = [(getPos campa6),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[1,0.25],random 360] call bis_fnc_spawngroup;
    [defendgrpa6, (getPos campa6)] call BIS_fnc_taskDefend;
    
    //////////////////////////////////////
    
    null = ["vccampa", random 360, getpos campa7] execVM "scripts\objectMapper.sqf";
    patrolgrpa7 = [(getPos campa7),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[2,0.25]] call bis_fnc_spawngroup;
    [patrolgrpa7, (getPos campa7),50] call BIS_fnc_taskPatrol;
    defendgrpa7 = [(getPos campa7),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[1,0.25],random 360] call bis_fnc_spawngroup;
    [defendgrpa7, (getPos campa7)] call BIS_fnc_taskDefend;
    
    //////////////////////////////////////
    
    null = ["vccampa", random 360, getpos campa8] execVM "scripts\objectMapper.sqf";
    patrolgrpa8 = [(getPos campa8),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[2,0.25]] call bis_fnc_spawngroup;
    [patrolgrpa8, (getPos campa8),50] call BIS_fnc_taskPatrol;
    defendgrpa8 = [(getPos campa8),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[1,0.25],random 360] call bis_fnc_spawngroup;
    [defendgrpa8, (getPos campa8)] call BIS_fnc_taskDefend;
    
    //////////////////////////////////////
    
    null = ["vccampa", random 360, getpos campa9] execVM "scripts\objectMapper.sqf";
    patrolgrpa9 = [(getPos campa9),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[2,0.25]] call bis_fnc_spawngroup;
    [patrolgrpa9, (getPos campa9),50] call BIS_fnc_taskPatrol;
    defendgrpa9 = [(getPos campa9),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[1,0.25],random 360] call bis_fnc_spawngroup;
    [defendgrpa9, (getPos campa9)] call BIS_fnc_taskDefend;
    
    //////////////////////////////////////
    
    null = ["vccampa", random 360, getpos campa10] execVM "scripts\objectMapper.sqf";
    patrolgrpa10 = [(getPos campa10),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[2,0.25]] call bis_fnc_spawngroup;
    [patrolgrpa10, (getPos campa10),50] call BIS_fnc_taskPatrol;
    defendgrpa10 = [(getPos campa10),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[1,0.25],random 360] call bis_fnc_spawngroup;
    [defendgrpa10, (getPos campa10)] call BIS_fnc_taskDefend;
    
    //////////////////////////////////////
    I was thinking maybe a condition check for each camp object, so something like:-

    Code:
    vccampa1 = true
    In the object on the map then:-

    Code:
    if (vccampa1) then {
    null = ["vccampa", random 360, getpos campa1] execVM "scripts\objectMapper.sqf";
    patrolgrpa1 = [(getPos campa1),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[2,0.25]] call bis_fnc_spawngroup;
    [patrolgrpa1, (getPos campa1),50] call BIS_fnc_taskPatrol;
    defendgrpa1 = [(getPos campa1),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[1,0.25],random 360] call bis_fnc_spawngroup;
    [defendgrpa1, (getPos campa1)] call BIS_fnc_taskDefend;
    };
    Dunno if that would be an optimal way of doing things.
    Last edited by Shadow.D. ^BOB^; Jun 24 2012 at 12:51.

  5. #5
    Master Gunnery Sergeant twirly's Avatar
    Join Date
    Sep 13 2010
    Location
    Gods Own (NZ)
    Posts
    1,302
    Use isNil to check if the camps exist.... like this....

    Code:
    if (!isServer) exitwith {};
    
    //////////////////////////////////////
    
    if (not (isnil "campa1")) then {
        null = ["vccampa", random 360, getpos campa1] execVM "scripts\objectMapper.sqf";
        patrolgrpa1 = [(getPos campa1),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[2,0.25]] call bis_fnc_spawngroup;
        [patrolgrpa1, (getPos campa1),50] call BIS_fnc_taskPatrol;
        defendgrpa1 = [(getPos campa1),east,["uns_local_vc1f","uns_local_vc1e","uns_local_vc2d","uns_rf_vc8a"],[],[],[],[],[1,0.25],random 360] call bis_fnc_spawngroup;
        [defendgrpa1, (getPos campa1)] call BIS_fnc_taskDefend;
    };

  6. #6
    Cheers mate, really appeciate the help. All sorted now

    Love learning these little things i can put to some use in future projects.

    /////////////////////////SOLVED///////////////////////////

Similar Threads

  1. Composition Spawn issue
    By psvialli in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 1
    Last Post: Feb 22 2012, 16:00
  2. Locality issue
    By SCAJolly in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 6
    Last Post: Nov 6 2011, 17:37
  3. Custom Composition - Detect Not Alive
    By Shadow.D. ^BOB^ in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 13
    Last Post: Aug 24 2011, 13:03
  4. Locality issue?
    By Stubbinz in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 2
    Last Post: Jun 24 2011, 07:59
  5. locality issue on dedicated?
    By Pappy60 in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 5
    Last Post: Oct 7 2009, 13:39

Posting Permissions

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