Jump to content

pierremgi

Member
  • Content Count

    4792
  • Joined

  • Last visited

  • Medals

  • Medals

Posts posted by pierremgi


  1. Hi all,

    I'm wondering, as new feature, if it could be possible, in editor, to replace the black line between the group (or the previous waypoint) and the waypoint icon, by a broken-line tracing as calculated path? Something like the calculatePath drawing but in editor. That could be fine for elaborate paths with a visual tool in 3den.

    Thanks

    • Like 2

  2. 10 minutes ago, RCA3 said:

    @pierremgi

    People complain a lot of vehicles not driving on roads, especially with long journeys, this makes sure it uses them.

     

    Well. Imho, the addWaypoint process and the calculated path is same, for the same vehicle and the same behavior. If I'm right, the addWaypoint (when running in game) starts with a path calculation (the longer journey, the greater delay before move). So probably with the same algorithm.

     

    How things could work differently? It's my true question. I'm always in search for performance, trying to avoid heavier script than necessary.


  3. Hi,

    Many authors are in quest of performance for Arma3, and some tools are already useful for that: garbage collector, dynamic simulation, simple objects...

    I was asking myself is there could be a way to skip the code(s) scouting for achievements (104 of them at this time). I guess the global gameplay stats (useless imho), then the engine, is waiting for some "events" like: Safely ejected from any compatible jet using an ejection seat.

    I'm aware of the added value for some personal challenge and the interest for some players trying to improve their own stats.

    On the other hand, it's a waste of code, even at low level engine, event handlers or else, to say the truth, for most of the authors of scenarios.

     

    So, the 2 cent question is: why not a launch and/or server parameter skipping all that hundred+ stuffs if this could improve, even slightly, the global performance?

    Thanks

     

     

    • Like 1

  4. In the EH "handleDamage" the 3rd passed argument , called  _damage in example, is the  resulting level of damage for the selection.
    Not the global damage as you can grab with damage _unit.

    So, the final result will depend on all the hits. For a single shot, you can test:
    unitHits = []; this addEventHandler ["handleDamage", { unitHits pushBack _this; copyToClipboard str unitHits}];

     

    Shoot once at this unit. Edit your clipboard.


  5. In fact, the save load system  saves the damage on buildings (the value). That "loads the bark" of what is having to be saved, but you can try something like:

    cursorObject setDamage 0.01; cursorObject setVariable ["my_testVar",true]

    Note: on the other hand, that doesn't mean you can pass a variable on any object (like blue or red containers, or usually returning "" as typeOf), even if you saved a set damage on them.

    • Thanks 1

  6. My bad. corrected. The EH must end by the value you want to be applied. If you (or I) write _damage/2; _damage; the code ends by _damage which is not modified.

    But,  if you write _damage = _damage/2  you modify this value.

    So the 2 right ways:

    _damage = _damage/2; _damage

    or just _damage/2 (to end the script)


  7. this addaction ["Spawn Assault Force", // will run on server + clients (so everybody will see the addAction)

      {

         _this select 1;  // no idea what you do with that

         hint "Assault Force Spawned";  // should trigger locally (on player who triggered the action)

         playSound "Alarm_BLUFOR";    // same

         [] spawn { _sound = ASLToAGL [0,0,0] nearestObject "#soundonvehicle"; sleep 6.1; deleteVehicle _sound; };  // same

          execVM "AssaultAiSpawn.sqf"; // run locally but the effects will depend on the code, so on each command used

      }];


    Suggested init field (if you want to hear the alarm for all players, and spawn tanks on server):

    Spoiler

     

    
    alarmStart = {
      hint "Assault Force Spawned";
      playSound "Alarm_BLUFOR";
     [] spawn { _sound = ASLToAGL [0,0,0] nearestObject "#soundonvehicle"; sleep 6.1; deleteVehicle _sound; };
    };
    this addAction ["Spawn Assault Force",{alarmStart remoteExec ["call"];assaultSpawn remoteExec ["call",2]; },[], 1,true,true,"","",6];

     

     

     

    Note: See below for assaultSpawn

     

    AssaultAISpawn.sqf

    if(!isServer)exitWith{...  } // why? usually the AI units are spawned on server (or headless client)... where they will be finally managed. They will not stay in local client PC except those who belong to the client group/vehicle (client leader/driver).

    On the contrary, you should create your units on server, the remote exec your code on server.

     remove this condition.

     

    Suggested code:

    Spoiler

     

    
    _myunitarray = ["O_APC_WHEELED_02_RCWS_V2_F","O_APC_TRACKED_02_CANNON_F","O_MBT_02_CANNON_F","O_MBT_04_CANNON_F"];
    {
      _mk = _x;
      _idx = _x select [9];
      _grp = [ getMarkerPos _mk, EAST,[selectrandom _myunitarray],[],[],[],[],[],160] call BIS_fnc_spawnGroup;
      _veh = vehicle leader _grp;
      _curr = "ASLT"+_idx;
    
      [_grp, getMarkerPos "SLUGFEST1"] call bis_fnc_taskAttack;
      [_grp, 1] setWaypointCombatMode "RED";
      [_grp, 1] setWaypointBehaviour "SAFE";
      [_grp, 1] setWaypointFormation "LINE";
    
      [_grp, getMarkerPos "SLUGFEST2"] call bis_fnc_taskAttack;
      [_grp, 1] setWaypointCombatMode "RED";
      [_grp, 1] setWaypointBehaviour "SAFE";
      [_grp, 1] setWaypointFormation "LINE";
    
      [_grp, getMarkerPos "SLUGFEST3"] call bis_fnc_taskAttack;
      [_grp, 1] setWaypointCombatMode "RED";
      [_grp, 1] setWaypointBehaviour "SAFE";
      [_grp, 1] setWaypointFormation "LINE";
    
      _veh setVariable ["taskOnVeh",_curr];
      if ( _curr call BIS_fnc_taskExists) then {_curr call BIS_fnc_deleteTask};
      [west,[_curr],["A CSAT Assault force has landed near Lolisse. Intercept and Destroy the enemy.","Slug Fest","tank"],_veh,1,3,true] call BIS_fnc_taskCreate;
      _veh addEventHandler [ "Killed", { params ["_veh"];
        [_veh getVariable ["taskOnVeh","fake"],"SUCCEEDED"] call BIS_fnc_taskSetState
      }];
    
    } forEach ["ASSAULT1_1","ASSAULT1_2","ASSAULT1_3","ASSAULT1_4","ASSAULT1_5","ASSAULT1_6","ASSAULT1_7","ASSAULT1_8"];

     

     

     

    Then, modify your addAction (as above):

    >   first:  don't execVM "AssaultAiSpawn.sqf", spawn it after compiling the processed file. That means, add this line in init.sqf:

    AssaultSpawn = compile preprocessFileLineNumbers  "AssaultAiSpawn.sqf"; // assaultSpawn is now the code you can spawn/call and remote exec

    >  second: replace in addAction:

      execVM "AssaultAiSpawn.sqf";   by:    assaultSpawn remoteExec ["call",2];  // you can call it instead of spawn it

     

    • Like 1

  8. 1 - probably not but, on the other hand, you'll not trigger this EH anymore on dead.

    Note: The EH doesn't seem to add script or variable on the unit itself or in missionNameSpace (test with basic mission: player + one unit and run: diag_activeSQFScripts, diag_activeScripts and allVariable yourUnit... You will see plenty of extra running things and variables (especially with mods like CBA) but nothing about this EH.

    The good habit is to delete the corpse, anyway, after delay. See the garbage collection in editor (for MP scenario).

     

    2. { _x addEventhandler ["HandleDamage",{ params ["","","_damage"]; _damage /2 }] } forEach (units _grp01);

     

    Note: I never wrote:  _damage /2; _damage  That doesn't make sense. The code must end by the value you want to apply.

    _damage = _damage /2; _damage     works because you divided the value and passed it as the new value.

    _damage/2 works also. It's straight but less readable with more complex calculation (see your code)

     


  9. Removing All Event Handlers "HandleDamage" on edited or spawned units makes sense if you previously added this kind of EH. That means some running code from  mods (probably these which "manage" the damage). So, if you guess a conflict, why not? It's your choice.

    If you are sure that there is not yet this kind of EH running, forget that.

     

    If you're spawning units (in areas) you need to add the EH on them. one of the way to do that is a loop:

    0 = [] spawn {

      while {true} do {

        {_x addEventHandler ["handleDamage", {code}]; _x setVariable ["passedDamage",true] } forEach (allUnits select { isNil {_x getVariable "passedDamage"} });

        uiSleep 2

      }

    };

     

    or, if you can, add the EH after the spawn unit code.

    For player:

    Player addEventhandler ["HandleDamage",{ params ["_unit","_selection","_damage"]; _damage = _damage /2; _damage }];

    or even:

    Player addEventhandler ["HandleDamage",{ params ["","","_damage"]; _damage /2 }];

    same as:

    Player addEventhandler ["handledamage",{ _damage = (_this select 2) / 2;_damage}];

     

    This EH is persistent, so no need to run it again after respawn.

    • Like 1

  10. This command needs an absolute path, sometimes tricky to obtain everywhere. Did you try the new command getMissionPath ?

    (not sure that help for an addon! but that could be useful for mission's sound folder for other readers).

    Are you sure your addon is same version for client and server, so the sound file exists on server?

    Note: So far, I uses say3D (even for object's sound), relative path. It's EL so you need to remoteExec on clients (filtered by distance to reduce the).


  11. Did you try your function alone? say with a radio trigger instead of EH? That means to rework few things like another variable instead of _this select 0 in command line and a set damage. You could work easier than inside an EH and grab more detailed errors.

    It seems to me you miss disableSerialization before working with _local variable for the display. I'm not sure, I can't test your display. Not vanilla Arma.

     


  12. It seems to me you just have to use the 3den menu: scenario > export > export in sqf

    This menu will use the BIS_fnc_3DENExportSQF anyway.

    You can previously read what will be exported in clipboard.

     

    As you can see, the init can be made of:

    Spoiler

    // Init
    params [["_layerWhiteList",[],[[]]],["_layerBlacklist",[],[[]]],["_posCenter",[0,0,0],[[]]],["_dir",0,[0]],["_idBlacklist",[],[[]]]];
    private _allWhitelisted = _layerWhiteList isEqualTo [];
    private _layerRoot = (_allWhitelisted || {true in _layerWhiteList}) && {!(true in _layerBlackList)};
    private _layer82 = (_allWhitelisted || {"roadblock" in _layerWhiteList}) && {!("roadblock" in _layerBlackList)};
    private _layer70 = (_allWhitelisted || {"camp courage" in _layerWhiteList}) && {!("camp courage" in _layerBlackList)};

    if you are using 3den or custom compositions (group/props or custom) Here camp Courage & roadblock (vanilla).

    What layers are made of:

     

    Spoiler

    ///////////////////////////////////////////////////////////////////////////////////////////
    // Layers
    if (_layer82) then {missionNamespace setVariable ["essai%20export_Roadblock",[[_item71,_item72,_item73,_item74,_item75,_item76,_item77,_item78,_item79,_item80,_item81],[]]];};
    if (_layer70) then {missionNamespace setVariable ["essai%20export_Camp Courage",[[_item18,_item19,_item20,_item21,_item22,_item23,_item24,_item25,_item26,_item27,_item28,_item29,_item30,_item31,_item32,_item33,_item34,_item35,_item36,_item37,_item38,_item39,_item40,_item41,_item42,_item43,_item44,_item45,_item46,_item47,_item48,_item49,_item50,_item51,_item52,_item53,_item54,_item55,_item56,_item57,_item58,_item59,_item60,_item61,_item62,_item63,_item64,_item65,_item66,_item67,_item68,_item69],[]]];};

     

    So layers (you can create several of them sorting units+ waypoints in a layer, objects in another one), can be white or blacklisted in init.

    Blacklisting a layer:
     

    Spoiler

     

    params [["_layerWhiteList",[],[[]]],["_layerBlacklist",[],[[]]],["_posCenter",[0,0,0],[[]]],["_dir",0,[0]],["_idBlacklist",[],[[]]]];


    _layerBlacklist pushBack "layer 7";

     

    private _allWhitelisted = _layerWhiteList isEqualTo [];
    private _layerRoot = (_allWhitelisted || {true in _layerWhiteList}) && {!(true in _layerBlackList)};
    private _layer101 = (_allWhitelisted || {"layer 7" in _layerWhiteList}) && {!("layer 7" in _layerBlackList)};
    private _layer82 = (_allWhitelisted || {"roadblock" in _layerWhiteList}) && {!("roadblock" in _layerBlackList)};
    private _layer70 = (_allWhitelisted || {"camp courage" in _layerWhiteList}) && {!("camp courage" in _layerBlackList)};

     

     

    I didn't find what is the use of _idBlackList (in exported script). Perhaps some future functionality.

    Some for pushing back a number (id) for each object in _objectIds.

     

    You can customize the loadout of your units. Example:

    Spoiler

    private _item2 = objNull;
    if (_layerRoot) then {
      _item2 = _item0 createUnit ["B_soldier_AR_F",[1719.89,5438.72,0],[],0,"CAN_COLLIDE"];
      _this = _item2;
      _objects pushback _this;
      _objectIDs pushback 2;
      _this setPosWorld [1719.89,5438.77,5.50144];
      _this setVectorDirAndUp [[0,1,0],[0,0,1]];
      _this setUnitLoadout [["arifle_MSBS65_F","","acc_pointer_IR","",["30Rnd_65x39_caseless_msbs_mag",30],[],""],[],["hgun_esd_01_F","","","",[],[],""],["U_B_CombatUniform_tshirt_mcam_wdL_f",[["FirstAidKit",1],["HandGrenade",1,1],["SmokeShell",1,1],["SmokeShellGreen",1,1],["Chemlight_green",1,1],["30Rnd_65x39_caseless_msbs_mag",1,30]]],["V_PlateCarrier2_wdl",[["Chemlight_green",1,1],["30Rnd_65x39_caseless_msbs_mag",2,30]]],["B_AssaultPack_mcamo",[["30Rnd_65x39_caseless_msbs_mag",7,30],["MiniGrenade",6,1]]],"H_Cap_blu","G_Tactical_Clear",["Rangefinder","","","",[],[],""],["ItemMap","B_UavTerminal","ItemRadio","ItemCompass","ChemicalDetector_01_watch_F","O_NVGoggles_grn_F"]];
      addSwitchableUnit _this;
      _this setSkill 0.4;
      _this setname "Callum Thompson";;
      _this setface "WhiteHead_17";;
      _this setspeaker "male12eng";;
      _this setpitch 1.01593;;
    };

    I duno why there is a double ;; at the end of setName, setFace... but that shouldn't be a problem.
    You can see how things work for creating units,groups, waypoints, crew, vehicles,modules.... btw.

    As little example, if you set the presence to false (or 0%) you will see an added conditions (if (false) then {...} (or if (random 1 < 0) then {...}).

     

    There is no menu/function to "import" this stuff. You just have to create and execVm this sqf.

    - after saving + exporting to sqf, just create a new mission;

    - save this empty mission (no player, nothing). You'll create a folder with a short mission.sqm inside (very basic with the position of camera in fact). Say your mission name is:  emptyMission;

    - In the file explorer create two new files (it's a working example): one named init.sqf, one named whatYouWant.sqf, in the folder of emptyMission (where the mission.sqm is);

    - in whatYouWant.sqf, paste the code you exported to clipboard;

    - in init.sqf , just:  [] execVM "whatYouWant.sqf";

    Just Try this emptyMission. All the stuff comes from the whatYouWant.sqf. The mission.sqm stays light.

     

    More than this, you can spawn some layers during the mission. It's a way to spawn exactly what you did in editor, when you want. Play with the layers, avoid double, i.e. just one root layer. So, all spawned layers but the first must have :

    private _layerRoot = false;

    instead of;

    private _layerRoot = (_allWhitelisted || {true in _layerWhiteList}) && {!(true in _layerBlackList)};

     

     

     

     

     

    • Like 3
×