Jump to content

pierremgi

Member
  • Content Count

    7275
  • Joined

  • Last visited

  • Medals

  • Medals

Community Reputation

4740 Excellent

About pierremgi

  • Rank
    Major

Profile Information

  • Location
    Tahiti

Recent Profile Visitors

14403 profile views
  1. pierremgi

    How to turn init code in to a script?

    btw, you could use a hashmap , probably better for preparing such script(s). Something like: CB_Factions_data = createHashMapFromArray [ ["BLU_F", [ [ "WhiteHead_01", "WhiteHead_05", "WhiteHead_04",...], [ "U_I_L_Uniform_01_tshirt_black_F", .5, "U_I_L_Uniform_01_tshirt_olive_F", .5, "U_I_L_Uniform_01_tshirt_skull_F", .5,....], [ "\a3\characters_f_gamma\Civil\Data\c_cloth1_black.paa", "A3\Characters_F\Civil\Data\c_cloth1_kabeiroi_co.paa", ....], [ "V_LegStrapBag_olive_F", "V_LegStrapBag_coyote_F", "V_LegStrapBag_black_F", "V_Pocketed_black_F", ...], [ "H_Beret_blk", "H_Bandanna_gry", "H_Bandanna_blu", "H_Bandanna_cbr", "H_Booniehat_taiga", "H_Booniehat_wdl",....], [ "arifle_AKM_F", "arifle_AKS_F", "arifle_AK12U_F", "arifle_CTAR_blk_F" ,...], [....] ], ], ["BLU_CTRG_F", [[...],[...],...]] ], .... ]; This way, you can see the whole things you want and the codes are faster. You create the hashmap once for all, then use it multiple times. Usage is a little bit different from testing a condition and running a script. Just: private _factionData = CB_Factions_Data get faction _unit; _unit setFace selectRandom (_factionData #0); _unit forceAddUniform selectRandomWeighted (_factionData #1); if (_factionData == "IND_G_F" && {uniform _unit == "U_IG_Guerilla1_1"} && {random 10 > 5} ) then { _unit setObjectTextureGlobal [0, _fiaFatigues]; _unit setobjectTextureGlobal [1, "#(argb,8,8,3)color(0.33,0.31,0.24,0.3)"] }; _unit addVest selectRandom (_factionData #3); There is no delay whatever the key (faction here) could be. Of course, it's a dirty example. Adapt and mind for the arrays and the global structure of the hashmap. Have fun
  2. pierremgi

    How to turn init code in to a script?

    if (_unit IsKindOf "CAManBase") then { call { if (faction _unit isEqualTo "BLU_F") exitwith {[_unit] spawn CB_fnc_loadout_BLUFORnato}; // standard NATO if (faction _unit isEqualTo "BLU_CTRG_F") exitWith {[_unit] spawn CB_fnc_loadout_BLUFORspecops}; // CTRG if (faction _unit isEqualTo "BLU_G_F") exitWith {[_unit] spawn CB_fnc_loadout_BLUFORion}; // FIA as IoN security if (faction _unit isEqualTo "OPF_F") exitWith {[_unit] spawn CB_fnc_loadout_OPFORcsat}; // standard CSAT if (faction _unit isEqualTo "OPF_R_F") exitWith {[_unit] spawn CB_fnc_loadout_OPFORspecops}; // Spetznaz as Viper guys if (faction _unit isEqualTo "IND_G_F") exitWith {[_unit] spawn CB_fnc_loadout_INDFORfia}; // standard FIA if (faction _unit isEqualTo "IND_C_F") exitWith {[_unit] spawn CB_fnc_loadout_INDFORspecops}; // Syndikat as common criminals if (faction _unit isEqualTo "CIV_F") exitWith {[_unit] spawn CB_fnc_loadout_CIV}; }; };
  3. pierremgi

    How to turn init code in to a script?

    {_x .... } forEach allUnits; is OK at start, on server only (no need to re-run that at each JIP) Note: For MP scenario, you must check if your sqf are ok for all commands with global effect GE . Multiplayer needs more attention for many things. See multiplayer threads. and https://community.bistudio.com/wiki/Multiplayer_Scripting Once in MEH "entityCreated", just use _entity for all you want to do. As there are plenty of different entities (objects like rabbits, projectiles,...), you need to filter. For example: if (faction _entity isEqualTo "BLU_F" && {_entity isKindOf "CAManBase"}) then { [_entity] execVM "scripts\loadouts\BLUFOR\NATO.sqf"}; Here, you check for faction, which is a strong filter, then (lazy evaluation) you filter only unit ("CAManBase", because rabbits & snakes are "man") and you skip the vehicles of the faction. Note: execVMing an sqf is not the best way for performance saving, because you're recompiling the same code again and again. Create a function instead and call or spawn it. (there threads about that and BIKI is your friend). https://community.bistudio.com/wiki/Script_File https://community.bistudio.com/wiki/Function https://community.bistudio.com/wiki/Description.ext especially : https://community.bistudio.com/wiki/Arma_3:_Functions_Library
  4. pierremgi

    How to turn init code in to a script?

    _newUnits is just allUnits - _checkedUnits ... but _checkedUnits is also allUnits ... further more, your variable _units seems to be useless. If I'm right you want to treat edited units and the spawned ones. An event handler is usually better than a loop. Here, the easy way is to treat in two parts, in init.sqf: { _x spawn ...} forEach allUnits; // or add a filter: ... forEach (allUnits select {!isplayer _x}) (alive _x is useless with allUnits) addMissionEventHandler ["EntityCreated", { params ["_entity"]; if (_entity isKindOf "CAManBase") then { do something on _entity}; }];
  5. We already discussed about that in an other thread. I mentioned this code with MEH "entityRespawned" when I thought you tried to REspawn some playable units. After discussion, if I'm right, you are trying to REspawn spawned AI units. This MEH doesn't work for simple AI (spawned or edited) because they are not playable so not eligible for the respawn system. Usually, moders and scripters use a code for re-creating an AI replacing the dead one, with more or less traits and behaviors (face, waypoints if single unit in group, loadout,...), with options like position (at start, at death...). You can also find some codes/modules for triggering a new AI unit/AI wave with same path(s), under conditions or timers. It's something near from your goal. The fact is your demand for same face and speaker is not usual, and probably need specific lines about that, on existing codes. I understand and respect your choice for Jebus system. Tell me if you are interested in MGI modules.
  6. anyPlayer present condition: {vehicle _x == CHINOOK} count thisList >0
  7. pierremgi

    [SOLVED] Waypoint Trigger help

    If you're speaking about MGI module Spawn Groups attack, yes. You just need to build your group in editor, as you want, with the loadout you want for each unit/vehicle, then link one of the unit to the module. Don't forget to set the side, the repetition, condition... and the spawning area(s) you want in module. Documentation is here: MGI ADVANCED MODULES by Pierre MGI
  8. pierremgi

    [SOLVED] Waypoint Trigger help

    The trigger activates when an indep unit enters its area or spawns in. This trigger must be deactivated before it runs again (rearmed). So, your first unit/group must leave the area or must be treated for exiting thisList (need a variable for example). What I suggest: 1. If you know how to apply a code on spawned unit/group by your spawned module, add your waypoint this way (no trigger). I don't know if these units/groups are identified somewhere. 2. Far simpler : use MGI advanced modules, especially spawn Groups attack which allows you any group(s), of any side, of any mod, and any behavior (not only attack)... and code straight in module (here just write : (_this #0) addWaypoint [getMarkerPos "TaskAssault_Mark",0]; in code for group(s) field.) Simple as that. 3. Try to hack your spawned group. Name your trigger (the area one, say: spawningZone) addMissionEventHandler ["GroupCreated", { params ["_grp"]; _grp spawn { params ["_grp"]; sleep 0.5; if (side _grp == INDEPENDENT && units _grp inAreaArray spawningZone isNotEqualTo []) then { _grp addWaypoint [getMarkerPos "TaskAssault_Mark",0] }; }; }];
  9. That doesn't exist. Try in init.sqf but remove the if (!hasInterface) exitWith {}; if you test on dedicated server. (or place this line after if you are sure you need it for something else). All line with player (createDiaryRecord) should be in initPlayerLocal.sqf
  10. if (!hasInterface) exitWith {}; means dedicated server are out. That means you can't apply from server some MEH for playable (non-played units, but respawnable by Arma engine) as far as they stay on server. As rule of thumb, all codes for player should be in initPlayerLocal.sqf (initPlayerServer can help when code concerns player but should run on server. Some commands need that). player is defined straight in initPlayerLocal.sqf Init.sqf is fine for general code, in accordance with Initialisation_Order every time a code must run on every PC (and it runs locally each time a player joins. then, if a command/function is Effect Global, you can have multiple times for this/these effect(s) ).
  11. Well, I don't know why. Try: addMissionEventHandler ["entityRespawned",{ params ["_new","_old"]; if (_new isKindOf "CAManBase") then { [_new,face _old] remoteExec ["setFace"]; [_new,speaker _old] remoteExec ["setSpeaker"]; } }]; just to be sure.
  12. init.sqf is OK. The MEH is LE (local effect) and the commands are also LE, so, in init.sqf, the code fires everywhere, locally. That doesn't hurt without interface like dedicated server.
  13. addMissionEventHandler ["entityRespawned", { params ["_new", "_old"]; if (_new isKindOf "CAManBase") then { _new setFace face _old; _new setSpeaker speaker _old } }]; If this MEH already exists, you just have to add the code (with the right variables)
  14. [_this] is probably undefined here. change _this variable for this (group leader in waypoint activation field), if I understand your context. I'm not using CBA, so check for leader or group and point at the right thing.
  15. I can't say how jebus work. We can't speak about limitation so far. Probably due to commands used for setting face (setFace?) and voice (setSpeaker?) , which are both Effect Local so you need to remoteExec them everywhere.
×