Jump to content

pierremgi

Member
  • Content Count

    7273
  • Joined

  • Last visited

  • Medals

  • Medals

Everything posted by pierremgi

  1. 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
  2. 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}; }];
  3. 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.
  4. anyPlayer present condition: {vehicle _x == CHINOOK} count thisList >0
  5. 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
  6. 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] }; }; }];
  7. 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
  8. 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) ).
  9. 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.
  10. 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.
  11. 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)
  12. Hi, This should be evident: keep the same voice (and pitch) after respawn. It's not the case if you choose a voice in editor. Is there any code to keep the voice of a player (in MP) after respawn? Tks
  13. [_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.
  14. 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.
  15. Probably because your predators are enemySide (renegade) and not OPFOR... Could you elaborate which side or in which context these units are killing teammates? If you want to prevent unwanted collateral damage for OPFOR only, the EH handleDamage is a good way. Are you sure you apply it on units you want? Are you spawning them? For edited ones: { _x addEventHandler ["HandleDamage",{ params ["_unit", "", "_damage","_source"]; if (side _source isEqualTo EAST) then {_damage = 0}; _damage }]; } forEach units OPFOR; If you spawn them, you need to apply the EH on them also.
  16. Hello, Not sure to understand your problem. If you are sure that the spawned group in named grp_predator, so, I can't see why you couldn't make Yautja1, ..2, ..3 join it. joinSilent is a GA GE command, so you can make it work from anywhere. First thing to do is verify this group exists with it's name grp_predator, before you try to join some extra units. By the way: When you spawn a group with another function than yours (if yours, you can easily add a code on it), and if you don't have a name for this group, you need to wait for some group created. The useful event handler, here, is the MEH "groupCreated" In init.sqf: addMissionEventHandler ["GroupCreated", { params ["_group"]; if (your condition here) then { do something on this group}; }];
  17. Far less. I'm busy these weeks.
  18. Triggers can be server only. In this case the activation code runs on server only. May need some remote execution for desired effect on another PC (client), depending on how argument(s) and effect(s) work in commands of the code . May be not so handy. Non-server only triggers are firing locally but the code runs everywhere the condition is met. Blufor Present, anyPlayer Present are met everywhere. bob inArea thisTrigger , bob in thisList (need pre-condition like above) are met everywhere bob is defined (everywhere if variable name in editor) but: player inArea thisTrigger, player in thisList fires on player's PC only Then, the activation code itself is effect global whatever the edited trigger is (see more info : makeGlobal in createTrigger command). That means all PCs will be finally sync about the effect of the code. If you need a specific effect on a specific PC (using local effect commands), you need to script the makeGlobal false version of the createTrigger command.
  19. vehicle someDude == daChoppa or for any helo: vehicle someDude isKindOf "helicopter" //(but works also for parachute, as chutes are helos in arma. You can add a filter if required)
  20. That's because your ship is server local. When you remoteExec addaction for all clients, it's OK but the script of action itself stays local: run on client who called the action. As your boat is on server, you need to remoteExec (on server : 2) also each command of this code which have a local Argument (LA), as setVelocity Simple as that. Note: Now, if you have another player as driver, waiting for your push, he is the owner of the boat. You need to remoteExec setVelocity on his PC, where the boat is owned (target for remote exec is _boat) not tested.
  21. Schatten's code works for me. You need to wait for the delta time you set (here 10 sec), even at start. Cond. : this && {time - (thisTrigger getVariable ["ActivatedAt",0]) > 10} example on act: thisTrigger setVariable ["ActivatedAt", time]; hint str time As said above, my code works only for repeatable triggers except for radio triggers which don't have deactivation code.
  22. MGI ADVANCED MODULES Hi all, Here is an addon for mission makers. If you need to easily spawn some factions, some civilian life or just add randomized weapons loot in houses... If you want an advanced AI heal & revive, for SP or MP mission, able to heal players or bros.. ... or respawning AIs, in waves or at once.. If you want a transport support on any vehicle... A vehicle respawn system with crew, waypoints, loadouts, addActions, arsenal.... Friendly kill sanction... AI cannons able to fire HE shells on infantry... Some generators able to switch on/off a district... or adapt silencers to combat behavior... or perhaps a simple tool for reading all map object classes/display names/p3d model names... Other tools like tire puncture on barbed wires? ... And of course, MP compatible, favorite mods compatible... Here you are. MODULES on Steam: https://steamcommunity.com/sharedfiles/filedetails/?id=1682280809 The summary is just here. The modules are described and explained in an updated documentation: DOCUMENTATION LINK Have fun! Pierre MGI
  23. Welcome to forum. Which sound? How do you run it (playSound or else)?
  24. With a radio trigger thisList is always equal to [] (there is no preset condition like blufor present), so you can't refer to this variable. thisTrigger works. So, you can sort the units in a trigger area: {_x playMoveNow "AmovPercMstpSnopWnopDnop_exercisePushup"} count (allUnits select {_x inArea thisTrigger}); Note: count is little bit faster than forEach... but you must check the inside code don't return a variable. Here playMoveNow returns nothing. So, cool.
×