Jump to content

pierremgi

Member
  • Content Count

    7274
  • Joined

  • Last visited

  • Medals

  • Medals

Everything posted by pierremgi

  1. pierremgi

    Fill ammobox

    Not tested, but if you code a crate in config, you could add the line: postinit = "params ['_crate']; if (local _crate) then {_crate addEventHandler ['ContainerOpened', {params ['_crate','_unit']; _magazinesPri = primaryWeapon _unit call BIS_fnc_compatibleMagazines; _magazinesSec = handgunWeapon _unit call BIS_fnc_compatibleMagazines; {_crate addMagazineCargoGlobal [_x,10]} forEach _magazinesPri; {_crate addMagazineCargoGlobal [_x,10]} forEach _magazinesSec;}]; _crate addEventHandler ['ContainerClosed',{params ['_crate','_unit']; clearMagazineCargoGlobal _crate}]}"; Perhaps, work also with init = "..."; instead of postInit.
  2. pierremgi

    Warlords

    @Jezuro There is an error in fn_WLInit.sqf: referring to the code: The code should be: { _x spawn { _veh = _this; sleep 2; if (!isNull _veh) then { _pos = getPosATL _veh; _depth = _pos # 2; if (_depth < -0.7 || (_depth < -0.55 && surfaceIsWater _pos)) then { { if (!isNull _x) then { _x setPos position _veh; _grp = group _x; if (isPlayer _x) then {_x setDamage 1} else {deleteVehicle _x}; if (count units _grp == 0) then {deleteGroup _grp}; } } forEach crew _veh; deleteVehicle _veh; } } } } forEach _vehiclesBelowGround; or even: { _x spawn { _veh = _this; sleep 2; if (!isNull _veh) then { _pos = getPosATL _veh; _depth = _pos # 2; if (_depth < -0.7 || (_depth < -0.55 && surfaceIsWater _pos)) then { deleteVehicleCrew _veh; deleteVehicle _veh; } } } } forEach _vehiclesBelowGround; Other issue about selection of sector for drop zone. Clicking on an owned sector can lead to error in drawIcon (sometimes, after several drops OK, Can't say why): Thanks for your attention.
  3. Just to complete the answer, of course you can add the code inside the hold action, but you need to call the action, then the AI stops... Not easy and you need to release it at a moment... You can test: [_unit, "Interroger", "\a3\missions_f_oldman\data\img\holdactions\holdAction_talk_ca.paa", "\a3\missions_f_oldman\data\img\holdactions\holdAction_talk_ca.paa", "_this distance _target < 5", "_caller distance _target < 5", {params ["_target"]; [_target, "path"] remoteExec ["disableAi",0,TRUE]}, {}, {params ["_target"]; [_target, "path"] remoteExec ["enableAi",0,TRUE]; execVm "Sound\intero.sqf"}, {params ["_target"]; [_target, "path"] remoteExec ["enableAi",0,TRUE]}, [],2,0,false,false ] remoteExec ["BIS_fnc_holdActionAdd", 0, _unit];
  4. Hello, You could try, in initPlayerLocal.sqf or any sqf for clients, once player exists, something like: player spawn { params ["_plyr","_unit"]; while {true} do { sleep 1; if (_plyr nearEntities ["Civilian",10] isnotEqualTo []) then { _unit = (_plyr nearEntities ["Civilian",10])#0; [_unit, "path"] remoteExec ["disableAi",0,TRUE]; waitUntil {sleep 1; _unit distance2D _plyr > 10}; [_unit, "path"] remoteExec ["enableAI",0,TRUE]; } } }; You can add an extra condition for stopping civilian, only IF Interroger holdAction on it: if ("Interroger" in (_unit actionParams 0)#0) Then {...}; // Case SenSiTiVe!
  5. if (east knowsAbout player > 0) then.... You don't need that. I tested this code and it works; It can take a long time to make the AIs move again. So, add the allowFleeing command, set the timer to 30 sec (not less) and condition _newKA > 1 instead of 1.5 (more reactive with lower value) _ReconTeams allowFleeing 0; _ReconTeams addEventHandler ["KnowsAboutChanged", { params ["_grp", "_target", "_newKA","_oldKA"]; if (_target == vehicle player && _newKA > 1 ) then { private _currWp = currentWaypoint _grp; if (_currWp == count waypoints _grp or {_currWp == 0}) then {private _wp =_grp addWaypoint [getPos player,0]}; [_grp,currentWaypoint _grp] setWaypointPosition [player,0]; if (isNil {_grp getVariable "timer"}) then { _grp setVariable ["timer",diag_tickTime]; _grp spawn { waitUntil {diag_tickTime > (_this getVariable "timer") + 30}; _this forgetTarget player; _this setVariable ["timer",nil] }; }; }; }]; Marker & KA test (if needed): _ReconTeams spawn {private _mk = createMarker [str random 1, getpos leader _this]; _mk setMarkerType "mil_dot"; _mk setMarkerColor "colorRed"; while {true} do {sleep 1; _mk setMarkerpos getpos leader _this; hintSilent str (_this knowsAbout player)}}
  6. Tweak just a waypoint and change its position. Add it if no current move. Forget the while true loop and use an EH: _ReconTeams addEventHandler ["KnowsAboutChanged", { params ["_grp", "_target", "_newKA","_oldKA"]; if (_target == vehicle player && _newKA > 1.5 ) then { _grp allowFleeing 0; private _currWp = currentWaypoint _grp; if (_currWp == count waypoints _grp or {_currWp == 0}) then {private _wp =_grp addWaypoint [getPos player,0]}; [_grp,currentWaypoint _grp] setWaypointPosition [player,0]; if (isNil {_grp getVariable "timer"}) then { _grp setVariable ["timer",diag_tickTime]; _grp spawn { waitUntil {diag_tickTime > (_this getVariable "timer") + 180}; // for 3 minutes. Set as you want _this forgetTarget player; _this setVariable ["timer",nil] }; }; }; }];
  7. You can't do that. You need to spawn the module. The condition of presence (if any) is always checked at start and not further. Some modules, like BI support must be synced with player(s). So you can sync/desync with specific commands/functions like BIS_fnc_addSupportLink It's a specific case anyway. Perhaps you can script something equivalent, along with conditions. (The reason why I usually add a (looped) condition field in my own MGI modules).
  8. pierremgi

    Quick Travel

    P1 setPos somewhere; P2 setPos somewhere else; What else? Note: if a player is in a vehicle, the vehicle + crew teleport.
  9. pierremgi

    Edit AI skill in config

    There are several commands/functions for skill, even a BI module (not useful,imho). Nothing in the config of unit itself (cfgVehicles). You have a global cfgAiSkill, you can tweak for all AIs. Not sure it's interesting. You can do what you want with commands or functions. If you want to create a mod with skill thingies, why not? Start to script what you need and create a function call by mod... You also have the cfgBrains. Not sure you can add a "brain" and refer to it in your mod (instead of defaultSoldierBrain) Not tested. See also interesting pages on BIKI for AIs.
  10. pierremgi

    Change class name?

    Should work and it's same as writing something in role description of the unit (in editor). In single player, that doesn't work in switch menu.
  11. Event handlers are "waiting" for an event. So, most of the time you don't need loop. anyway if you have an extra condition which should be checked more often than the event occurs, you need to loop this check. Here, adding a vehicle in a group can help for finding its locality (but not fine if 2 players in the same group if they drive at their turn). The check for position in your protected area's) are not correlated with that, so you need an extra check (loop, as far as the position changes). No immediate solution. Other test, in init field of vehicle (edited): this addEventHandler ["Local", { params ["_veh", "_isLocal"]; if _isLocal then { _veh spawn { while {alive _veh && local _veh} do { waitUntil {sleep 1; _veh inArea [center,a,b,0,false, c]}; _veh allowDamage FALSE; waitUntil {sleep 1; !(_veh inArea [center,a,b,0,false,c])}; _veh allowDamage TRUE; }; }; }; }]; [center,a,b,0,false,c] must be like : [getMarkerPos "mk1",200,200,0,false,200] (no local variable).
  12. Not so easy. You can use (or script something similar) /BIS_fnc_ambientAnimCombat for starting with specific animations and fall into combat. But the further step: back to position/state, needs extra code. You can save position, direction and anim parameters for a unit, then wait for it until back to aware state (example) then move to former position and set the animation again.
  13. /* bis_fnc_LinkTerminal_Animations */ As you can see, the main command of this BI function is animateSource which is GA GE (can run from any pc and global effect) So no problem on dedicated. If you want to apply this function on a different object, make sure animateSource works on it.
  14. You don't broadcast anything like this. Broadcasting doesn't mean "apply on all crew members"! A crew can be located on server, or on one PC (same group, and leader is client player), or even several PCs (more than one player in crew). I don't know when/while you are running this code, but the check must be looped as far as players can join/leave the crew. Usually, an EH doesn't need a loop anyway, so your code is not right. For a vehicle, the vehicle is always on DRIVER's PC. The vehicle can stay a little time on driver's PC when the played driver disembark, then return to server (its side changes, and probably its group changes, EH not tested). NOTE: the EH vehicle added will fire as soon as the vehicle belongs to your group. That means as soon as you "give" a driver to it. If you order an AI to jump as driver, the EH fires even if the AI is still far from the vehicle.I can't say if this occurs after the locality of the vehicle changes. So, perhaps, you need a step more, just to be sure the locality has changed. See Larrow's code for broadcasting. If you don't want to broadcast a code, think about initPlayerLocal.sqf where you can run code for all players locally. It's a good place for EHs like "vehicleAdded" which will fire locally and easily such command as allowdamage. For debug, make sure the vehicle is added by a simple hint like: hint format ["a %1 is added",typeOf _newVehicle]; So, in initPlayerLocal.sqf, the little code: group player addEventHandler ["vehicleAdded", { params ["_grp","_newVeh"]; _newVeh spawn { params ["_newVeh"]; waitUntil {local _newVeh}; _newVeh allowDamage FALSE } }]; Once again, not sure the waitUntil local is mandatory... not deeply tested. The protected area is a looped condition as Larrow wrote.
  15. No. You can't create/spawn extra playable units, by script for MP. All playable units must be edited in 3den, so appear in lobby. What you can do with them is on your side, as I mentioned above. Don't forget the possibility for hidding, disabling sim... on them until... a player joins on one of them. You can even "make them back in game" with any condition (a player reaching positions, meeting conditions..). You should tell, "creating", enabling in fact, playable units, what for? Which context? If your scenario can run in SP or MP, don't forget playable units (so, from editor) are just switchable units in SP. You can write for SP, something different from MP, checking for isMultiplayer
  16. Just to be sure: Are you writing for MP or single player? For single player scenario, you can addSwitchableUnit For MP, you set all playable units from lobby via 3den, but you can disable AIs in lobby (this way, these slots/units don't exist (as variable) before a player jump into it. Not present til played. You can also keep these AIs as playable and not disabled from lobby, but hide them/disable their simulation/make them invincible until a player joins on it.
  17. Just for precision : Did you test BIS_fnc_unitCaptureFiring ?
  18. the allowDamage command is LA GE. So, yes, you need to re-apply it when the vehicle's owner shifts (driver's PC). You can use an EH such as: group player addEventHandler ["VehicleAdded", { params ["_group", "_newVehicle"]; _newVehicle allowDamage FALSE}]; or even using "handleDamage" EH, everywhere! yourVehicle addEventHandler ["HandleDamage", { params ["_veh","","_damage"]; if (condition for inside base && local _veh) then {_damage = 0}; _damage }]; // always end by (return) _damage value. This EH fires on every PC (place it in init.sqf for example, or init field on an edited vehicle...) (and is persistent no extra code after respawn). That's for the principle.
  19. No, you can't do anything for adding playable units in MP.
  20. pierremgi

    Player Side Triggers

    Lol, "captive" doesn't mean anything about mobility in Arma. Just a way to toggle on/off civilian side and retrieve the native side when off. Biki is your friend. Read the link.
  21. pierremgi

    forEach

    Yes, sure. Use _x as specific variable for element (unit) inside code, like {_x setDamage 1} forEach (units WEST + units resistance); Next time, post at the right forum section: Editing and scripting
  22. pierremgi

    Player Side Triggers

    You should share your code for better help on it. Don't tweak sides. Just make your player(s) captive (by setCaptive command) TRUE in camp, FALSE outside.
  23. Depending on the loaded mods/DLCs. So, you can build arrays for that. private _allUniforms = ("getNumber (_x /'scope') == 2 && getNumber (_x /'itemInfo'/'type')== 801" configClasses (configFile /"cfgWeapons") apply {configName _x}); private _allVests = ("getNumber (_x /'scope') == 2 && getNumber (_x /'itemInfo'/'type')== 701" configClasses (configFile /"cfgWeapons") apply {configName _x}); private _allBackacks = ("getNumber (_x /'scope') == 2 && getText (_x /'vehicleClass') == 'backpacks'" configClasses (configFile /"cfgVehicles") apply {configName _x}); private _allHeadgears = ("getNumber (_x /'scope') == 2 && getNumber (_x /'itemInfo'/'type')== 605" configClasses (configFile /"cfgWeapons") apply {configName _x}); private _allFacewears = ("getNumber (_x /'scope') == 2" configClasses (configFile /"cfgGlasses") apply {configName _x}); private _allNVGs = ("getText (_x /'simulation') == 'NVGoggles'" configClasses (configFile /"cfgWeapons") apply {configName _x}); private _allBinoculars = ("getText (_x /'simulation') == 'Binocular'" configClasses (configFile /"cfgWeapons") apply {configName _x}); private =allMaps = ("getText (_x /'simulation') == 'ItemMap'" configClasses (configFile /"cfgWeapons") apply {configName _x}); private _allCommunication = ("getText (_x /'simulation') == 'ItemRadio'" configClasses (configFile /"cfgWeapons") apply {configName _x}); private _allNavigation = ("getText (_x /'simulation') == 'ItemCompass'" configClasses (configFile /"cfgWeapons") apply {configName _x}); private _allWatches = ("getText (_x /'simulation') == 'ItemWatch'" configClasses (configFile /"cfgWeapons") apply {configName _x}); private _allOptics = ("getNumber (_x /'scope') == 2 && getNumber (_x /'itemInfo' /'type') == 201" configClasses (configFile /"cfgWeapons") apply {configName _x}); private _allRails = ("getNumber (_x /'scope') == 2 && getNumber (_x /'itemInfo' /'type') == 301" configClasses (configFile /"cfgWeapons") apply {configName _x}); private _allSuppressors = ("getNumber (_x /'scope') == 2 && getNumber (_x /'itemInfo' /'type') == 101" configClasses (configFile /"cfgWeapons") apply {configName _x}); private _allBipods = ("getNumber (_x /'scope') == 2 && getNumber (_x /'itemInfo' /'type') == 302" configClasses (configFile /"cfgWeapons") apply {configName _x});
  24. Probably depending on context.... like map and place. Then, how did you order the move? Which enemy/behavior/speed/formation... First of all, did you test it on VR map, in a simple move, then load progressively your scenario to your final goal?
  25. pierremgi

    Arma 3 Notepad++ Syntax Highlighting

    Mine looks like (Poseidon):
×