Results 1 to 7 of 7

Thread: Dynamic Object Compositions - Random Building facing some issues

  1. #1

    Dynamic Object Compositions - Random Building facing some issues

    Hello guys i have a little problem. I post on the map a game logic, which is a training base and on it's int i post this:

    _newComp = [(getPos this), (getDir this), "SmallBase_EP1"] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf "));


    I also put 2 markers and grouped it to the game logic to randomize it's location. here is the issue 1. I have 4 groups which i wanted to be part of the base. Therefore every time the base move location the 4 groups would move location as well. I tried to group them, but it seems that every time i do that the groups dismember and also lose their way-points. Any ideas?

    Problem number 2. I would like to place AI on gun possition with in this game logic "SmallBase_EP1"

    Problem number 3. How can i have some evidence that would indicate the location of the map. I was thinking of a map. that when payer finds will show the current location of the base on the map with a marker. Any ideas. Please help! Thank you

  2. #2
    Here are some general ideas and code snippets that might help. This is not the entire code or even valid code all of it:

    1. Place something, eg. another logic or marker, let's call this BeforeBasePos. The logic which has the real pos of the base let's call that AfterBasePos. Place all the squads and units in relation to BeforeBasePos. E.g. if Squad A should start 200m left of the base then place it 200m left of BeforeBasePos. Now what you want to do is teleport all units up to the new base. Example pseudo-code:
    PHP Code:

    _fromPos 
    getPos BeforeBasePos;
    _toPos getPos AfterBasePos;
    {
        
    _squad _x;
        {
             
    //Single unit is _x - also don't use _x for coordinate in here
      
             //Find relative pos to before base, eg. if unit was 50m N and 100m W of BeforeBase then would be [50, -100].
             
    _newPos = [getPos _x select 0 _fromPos select 0getPos _x select 1_fromPos select 10];
             
    //Now add this to the after base pos:
             
    _newPos = [_newPos select 0 _toPos select 0_newPos select 1 _toPos select 10];
             
    //Now move the unit
             
    _x setPos _newPos;
        } forEach 
    _squad;
    } forEach [
    SquadASquadBSquadCSquadD]; 
    The trick is that if the unit has waypoints you would need to do the same to them. I recommend moving them first then the unit. Also if the squads in question patrols the base and you used the fact that the squads original position is a hidden waypoint in your patrol then you might want to create an explicit waypoint on their own position.

    2. In your snippet _newComp contains all the objects created in the composition. So you can go through all objects to check if it can have a gunner:

    PHP Code:
    _mannableGuns = [];
    {
        
    _className typeOf _x;
        
    //Has gunner then add it
        
    if (getNumber (configFile >> "CfgVehicles" >> _className "hasGunner") == 1then {
            
    _mannableGuns set [count _mannableGuns_x];
        };
    } forEach 
    _newComp;

    if (
    count _mannableGuns 0then {
        
    //There were some guns. Create units to man and assign them to guns.
        
    _baseDefenseSquad createGroup east;
        {
            
    _defender _baseDefenseSquad  createUnit [.......];
            
    _defender assignAsGunner _x;
            
    _defender moveInGunner _x;
        } forEach 
    _mannableGuns;
    }; 
    3. Here's the quick and dirty, but MP friendly version.

    Add the evidence to the map. Add an action to it (addAction) e.g. in it's init. However, make sure the condition of the addAction is "isNil 'MAP_FOUND'". When the action is triggered you should:
    PHP Code:
    MAP_FOUND true;
    publicVariable "MAP_FOUND"
    You should also create a trigger with
    CONDITION: isServer && MAP_FOUND
    ON ACT: createMarker .......

    However, not sure this is JIP safe - depends on whether you use beta or not I would guess.

  3. #3
    heya,
    You also have a space between the .sqf and the " in the composition call, should be this

    Code:
    _newComp = [(getPos this), (getDir this), "SmallBase_EP1"] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf"));
    not
    Code:
    _newComp = [(getPos this), (getDir this), "SmallBase_EP1"] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf "));
    cya
    Normally in dangerous situations I have a getaway car.

  4. #4
    Hey thank you. Now could you walk me through # 2. I m having some problems. Here is what i did. I copy your php code to notepad, then i save it .sqf , then i went to the game logic of the base and past on its int:

    _nil = [] execVM "xxx.sqf"

    is that right???

  5. #5
    I cant make number 2 work. what m I doing wrong?

  6. #6
    Quote Originally Posted by Odyseus View Post
    I cant make number 2 work. what m I doing wrong?
    As I wrote it is pseudo code and will need some adjustments to work - isn't copy-paste-ready.

    This line:
    PHP Code:
    if (getNumber (configFile >> "CfgVehicles" >> _className "hasGunner") == 1then 
    is missing a >> and even then i'm not 100% sure it is right.

    This line also has to be fixed:
    PHP Code:
    _defender _baseDefenseSquad  createUnit [.......]; 
    Also the script posted under point 2 has to know what _newComp is. Two possible solutions are to put this script in below the first one which creates the composition. Another is to pass it into the script, eg.:
    PHP Code:
    _newComp _this select 0
    And instead of starting it from a logic you start it at the bottom of the other script:
    PHP Code:
    //Part of script #1...
    //.....
     
    [] execVM "xxx.sqf"

  7. #7
    thank you so much muzzleflash. sorry i did not now what a pseudo code was. anyways. Now i do! I will try to do something with it. I think will be very hard since my level of scripting is beginner of the beginner. LOL

Similar Threads

  1. Dynamic Object Compositions and 2D Editor
    By xsdmx in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 119
    Last Post: Sep 28 2012, 23:28
  2. check Dynamic Object Compositions is destroyed
    By psvialli in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 2
    Last Post: Jul 29 2011, 16:15
  3. 3D Editor and OA object compositions (bug?)
    By kylania in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 7
    Last Post: Jul 21 2010, 18:14
  4. Self made DOC, Dynamic Object Compositions
    By spirit6 in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 0
    Last Post: Aug 24 2009, 08:04
  5. Object Compositions on ArmaHolic?
    By Smoot178 in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 1
    Last Post: Jul 22 2009, 08: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
  •