Jump to content

wildbill2016

Member
  • Content Count

    6
  • Joined

  • Last visited

  • Medals

Posts posted by wildbill2016


  1. On 2018/4/22 at 10:53 PM, Grumpy Old Man said:

    If in doubt, check the wiki.

     

    disableAI requires object as first and string as second parameter.

    You're passing a string as a first parameter, hence it doesn't work.

     

    I guess wp1_enemy1 etc. are the variable names of editor placed units?

    Just remove the quotation marks inside townenemy array then.

     

    Cheers

     

    On 2018/4/22 at 11:01 PM, Harzach said:

    In addition, your second code is the correct one:

    
    { _x disableAI "TARGET"; } forEach townenemy;

    You wouldn't use _townenemy because that's a local variable that you have not defined. Also, units returns the members of a group, and so would only work if townenemy was defined as such.

     

    https://community.bistudio.com/wiki/Variables

    https://community.bistudio.com/wiki/units

     

    On 2018/4/23 at 5:10 PM, zonekiller said:

     

     

    I guess wp1_enemy1 etc. are group names?

     

    so if townenemy is an array of group names and not unit names it would need to look like this

    as you will need to loop through all the units in each group as DisableAI only works with objects not groups

     

    Syntax: unitName disableAI section

    Parameters: unitName: Object - AI unit

     

    Just remove the quotation marks inside townenemy array then loop through each unit in each group.

     

    you could do something like this

     

    townenemy = [wp1_enemy1,wp1_enemy2,wp1_enemy3,wp1_enemy4,wp1_enemy5,wp1_enemy6];

     

    { _x disableAI "TARGET"; } forEach units _x  } forEach townenemy;  

    // it will run the red code for all units in selected group (_x)  before continuing on to the next loop in townenemy

    //(yes i know there are 2 _Xs that is because each _x is only local to whats between {}  )

     

    or

     

    for "_i" from 0 to ((count townenemy) - 1) do

    {

    { _x disableAI "TARGET"; } forEach units (townenemy select _i);

    };

     

    or 

     

    townenemy_units =  [];  // create an empty array

    {townenemy_units pushBack units _x } forEach townenemy; // add all the units from groups into one array

    { _x disableAI "TARGET"; } forEach townenemy_units;  // run code on each unit 

     

     

     

    Hope this helps

     

    Hi guys, thanks again (And thanks for the additional info about the loop nesting).

    It's the double quotation marks....

    And I define the group of townunits in another .sqf file.

    Maybe global variables should be defined in certain script like init.?

    When I define the array of units in another custom script and tried to access the array from another script, there is an undefined variable error.

    It is removed after I copy and paste the array definition to the disable AI execution script..

     

     


  2. So in the initialization script I defined a unit group like this

    townenemy = ["wp1_enemy1","wp1_enemy2","wp1_enemy3","wp1_enemy4","wp1_enemy5","wp1_enemy6"];

    and I want to use a trigger to disable their AI, when the player lefts the trigger.

    so I use the for each loop and the magic variable. But it always pops up a generic error..

    { _x disableAI "TARGET"; } forEach _townenemy;
    { _x disableAI "TARGET"; } forEach townenemy;
    { _x disableAI "TARGET"; } forEach units townenemy;
    { _x disableAI "TARGET"; } forEach units _townenemy;

    None of the above works..

    Is that I missed something?

    • Like 1

  3. In one of my trigger's "onActivation",

    I use

    exec "endcine.sqf";

     

    and in this sqf file is like this

    Sleep 1;
    bomb = "Bo_GBU12_LGB" createVehicle (getPos dem1);
    Sleep 2;
    bomb = "Bo_GBU12_LGB" createVehicle (getPos ramptarget1);
    Sleepleep 1.5;
    bomb = "Bo_GBU12_LGB" createVehicle (getPos ramptarget2);
    sleep 1.5;
    bomb = "Bo_GBU12_LGB" createVehicle (getPos ramptarget3);
    sleep 1.5;
    bomb = "Bo_GBU12_LGB" createVehicle (getPos ramptarget4);
    sleep 1.5;
    bomb = "Bo_GBU12_LGB" createVehicle (getPos ramptarget5);

     

    this sleep causes generic error..

    From all the googled results I only find it is caused by the unscheduled environment.

    I have found a similar case here

     

    It said as long as I put this

      [] spawn {
    	  Sleep 1;
    	  bomb = "Bo_GBU12_LGB" createVehicle (getPos dem1);
    	  Sleep 2;
    	  bomb = "Bo_GBU12_LGB" createVehicle (getPos ramptarget1);
    	  Sleep 1.5;
    	  bomb = "Bo_GBU12_LGB" createVehicle (getPos ramptarget2);
    	   sleep 1.5;
    	  bomb = "Bo_GBU12_LGB" createVehicle (getPos ramptarget3);
    	   sleep 1.5;
    	  bomb = "Bo_GBU12_LGB" createVehicle (getPos ramptarget4);
    	   sleep 1.5;
    	  bomb = "Bo_GBU12_LGB" createVehicle (getPos ramptarget5);
    };

    In to the trigger's onActivate, it will be Ok,

    But I got a "Type Script, expect nothing " error..

    So how can I add some delay between this explosions?

     

     


  4. 9 minutes ago, Grumpy Old Man said:

     

    The command still works.

    The rotating back to init position of the turret is most likely an indicator of the arty gun being outside of the firing arc.

    Make sure the arty gun is a fair distance to its target, >10km is usually advisable.

     

    Cheers

    Hi Grumpy,

    Thanks for the info. So, the default firing range setting for my game  for the M5 is 1000m-1300m (currently the distance between the M5 and the target is 1400), I think that also applies to AI players? But should the AI automatically set the range mode? 

    I'm currently using an alternate script.

    I'll verified it after the first playable version is made.


  5. https://gyazo.com/9b5ad00a9f21fcbf0d4bd9dfd9929bcd

    RT. After the Tank DLC update,

    unit commandArtilleryFire [[8016, 9750, 30], "12Rnd_230mm_rockets", 2]; 

    does not make the M5 fire on the fixed point.

     

    Also, 

    guySupport commandSuppressiveFire [8016, 9710, 30];
    guySupport doArtilleryFire [[8016, 9710, 30], "12Rnd_230mm_rockets", 10];

    don't work.

    The doArtileryFire only makes the turret rotate about 10 degrees and then it rotate back to the zero position.

     

×