Jump to content

pierremgi

Member
  • Content Count

    7379
  • Joined

  • Last visited

  • Medals

  • Medals

Everything posted by pierremgi

  1. Hi, I'm in trouble with what I guessed a simple code but my double loop doesn't work. Aim: make all foot units and land vehicles without collision. Don't crush any body. To start, i did it simple: SP context. Repeatable simple scenario: On map: a Hunter player, 1 or 2 empty Hunter. (or any vehicle you want). 3 civilians. I run this simple code: 0 = [] spawn { result = []; { _veh = _x; { _unit = _x; _veh disableCollisionWith _unit; result pushBack [_veh,_unit]; } forEach (allUnits select {isNull objectParent _x}); } forEach (vehicles select {_x isKindOf "landVehicle" && !(_x isKindOf "WeaponHolderSimulated")}); hint str result; }; I obtain the hint for every couple (vehicle,civilian) but the weird thing is: - only one vehicle is fully collision disabled with the whole civilians; (last loop checked I guess) - the other vehicles are collision disabled with the last civilian (last checked probably), but not with the other ones. I did a full day of tests, coming from MP environment, as it was supposed to loop for spawned units. then simplify everything up to this basic test. Testing further, for variables: 0 = [] spawn { result1 = []; result2 = []; private ["_veh","_unit"]; // doesn't make any difference { _veh = _x; { _unit = _x; [_veh,_unit] spawn { params ["_car","_man"]; _car disableCollisionWith _man; result1 pushBack [_car,_man]; }; result2 pushback [_veh,_unit]; } forEach (allUnits select {isNull objectParent _x}); } forEach (vehicles select {_x isKindOf "landVehicle" && !(_x isKindOf "WeaponHolderSimulated")}); hint (str result1 + str result2); }; Now, my results are: - result1 = []; - result2 is a consistent array of couple (vehicle,unit)!!! Any idea? Thanks
  2. I kindly request your skill before adding something at BIKI: So, first of all, here is a little test, simple nested loops, out of any object manipulation. All results are OK for simple variables: In debug console: 0 = [] spawn { arr1 = ["a","b","c"]; arr2 = ["x","y","z"]; private ["_datumOut","_datumIn"]; result1 = []; result2 = []; result3 = []; { _datumOut = _x; { _datumIn = _x; result1 pushback [_datumIn,_datumOut]; [_datumIn,_datumOut] call { _datumIn = _this select 0; _datumOut = _this select 1; result2 pushBack [_datumIn,_datumOut]; }; [_datumIn,_datumOut] spawn { _datumIn = _this select 0; _datumOut = _this select 1; result3 pushBack [_datumIn,_datumOut]; }; } forEach arr1; } forEach arr2; sleep 0.001; hint (str result1 + toString [92,110] + str result2 + toString [92,110] + str result3); }; Note: if no pause before hint, the spawned code (result3) returns []. The hint fires immediately and no spawned code has time to pushback something. A very little pause makes hint OK. So result3 can't be usable before the pause >> the end of the nested loops doesn't mean the spawned codes are done. Normal. Then Re-tested with some command f(x,y) type, like disableCollisionWith: replacing arr1 = allUnits; arr2 = vehicles; for 1 player in a hunter, 2 empty Hunter more to jump into them, 3 civilian foot units; // very light mission! and adding nested code in loop at core scope ( but direct method or called or spawned): _datumIn disableCollisionWith _datumOut; The behavior is always the same. For any method: direct, called, spawned code: - The last Hunter in external loop is fine: no collision at all, - all other vehicles (any number) fail with all the units but the last, in internal loop: (same last unit for all the vehicles). Just one disabled collision case by vehicle. So, I guess this kind of command can't work at core of nested loops. The failure/success for the couples of variables is predictable! (But not explainable for me). Any idea to make that work? Thanks
  3. Then, you can script for some project like: "marking the position of a player triggering a "radio Alpha" ". see this post.
  4. Mission start(s).... Very confusing! Hosted/dedicated server launching time of the mission? not only. all Local JIP "mission start"s also. And, obviously, not at the same time (in real life) because for the time command... (despite the BIKI description, I always read the same result on both hosted/JIPed watch debug console... No sure to understand). Anyway, init.sqf, but also mission.sqm (with all unit fields, edited triggers...) , will also run at the JIP mission local start. The reason why you will run all the init fields at JIP. Then, you can "reset" any scripted loadout (for example) with an init field without localization caution. Try on an hosted + client home net if you can. And test some codes, for JIP, in an init field like hint format ["hello %1", name player]; (E.L. command) (Then, commands like time , serverTime in debug consoles.... pfffff!) Good afternoon!
  5. You can easily adapt that: http://www.armaholic.com/forums.php?m=posts&q=35517
  6. the fact is player addAction... needs a player, so initPlayerLocal.sqf is a good way also (no need to wait until player). this addAction is never permanent and needs an EH Respawn, or onPlayerRespawn.sqf (running also at start if no respawnOnstart = -1 in description.ext)
  7. pierremgi

    Display exit code 104

    104? I didn't find any dik keycode with 104 (or 0x68 in fact) . Not in defineDikCodes.inc But, I can see that 104 like you, in the GUI script RscDisplayEGSpectator.sqf ... So, reserved?
  8. pierremgi

    Trigger doesn`t work correctly??

    Sorry, missing bracket ), or extra one ( , Corrected.
  9. pierremgi

    Question About Insignias

    This can't work 100% through description.ext. For any custom insignia, you need to create an addon and all players must have it loaded , if no change since my remark on the BIKI page (I guess not but I didn't test it any more).
  10. pierremgi

    Trigger doesn`t work correctly??

    or {deleteVehicle _x} forEach (nearestObjects [tr1, ["all"], 300] - units player - (vehicles select {group _x == group player})); if several vehicles.
  11. Some more ? private ["_cfg", "_cur","_idd","_result","_cfgName","_onLoad"]; _cfg = configFile; _idd = 0; _result = []; for "_i" from 0 to (count _cfg)-1 do { _cur = _cfg select _i; if(isClass _cur) then { _cfgName = configName _cur; _idd = getNumber(_cur >> "idd"); _onLoad = getText(_cur >> "onLoad"); if(_onLoad != "" && _idd >=0) then { _result set[count _result, [str _idd,_cfgName,_onLoad,toString [0x0D, 0x0A]]]; }; }; }; copyToClipboard (str (_result));
  12. Here an example I wrote for radio backpacks allowing the supports. SP/MP with respawn and team switch (often forgotten). http://www.armaholic.com/page.php?id=32165
  13. pierremgi

    Trouble with code

    You're probably right. BI sometimes changes some code regardless of what was written by scripters before. Small example: you could leave a blank condition field of a trigger (erasing this), that worked as true (always) condition before 1.68. Now, writing true is mandatory.
  14. You can always use codes in a trigger. but as any code, you need to apply some rules: - never ever comments like // bla bla. the code halts on that - you're in unscheduled environment, so no direct sleep or waitUntil, - on the other hand, do what you need with a wrap like this: 0 = [] spawn {<your great code here>}; equals a [] execVM "your.sqf" don't forget to pass some magic variables : thisList, thisTrigger is needed. thisList has no sense in "on deactivation" field (repeatable trigger).
  15. pierremgi

    Do something on unit spawn

    0 = [] spawn { while {true} do { _theUnits= allUnits; waitUntil {sleep 0.5; count (allUnits - _theUnits) > 0}; _newbies = allunits - _theUnits; { removeGoggles _x; sleep 0.2; _x addGoggles (selectRandom spawnmasks) } forEach _newbies }}; Add a short delay between remove something and add same thing; That helps in a forEach loop.
  16. pierremgi

    Do something on unit spawn

    0 = [] spawn { while {true} do { _theUnits= allUnits; waitUntil {sleep 0.5; count (allUnits - _theUnits) > 0}; _newbies = allunits - _theUnits; hint str (_newbies); }}; That works because no matter if allunits decreases due to dead men. [a,b,c] - [a,b,c,d] gives []. On the other hand, if one spawns (e) [a,b,e] - [a,b,c,d] gives [e] . Then do what you need on the array of spawned units.
  17. I'm using the EPEcontactEnd instead. It seems to me more reliable when throwing something.
  18. Not the BI priority. Just split your group into separate tank units with several waypoints.
  19. pierremgi

    Shared variable

    publicVariable is accurate. Don't forget to share (broadcast the result) every time your script changes the variable.
  20. I'm using the groundWeaponSimulated (which allow a drop) and spawn the object a little bit higher (1m).
  21. Yes, the command has, for months, unwanted behaviors like focusing on any, flying awyay, far air target instead of infantry firing at you. I opened a ticket about that...
  22. The variable name is simply the name you write in the init field of the unit/object. Say arty1 in init field of your scorcher or MK mortar. With a vehicle respawn, you keep this name. With a createvehicle, you need to work around with setVehicleVarName to keep the same reference for your links. I don't understand what you want to do with cursortarget!!! cursortarget is returning something when you point at something, while in game/pause. You can use it in a script, generally in some displays/framed scripts (loop!).
  23. params is useful to define/check/set by default parameters entry Then a little function inside the main one, frequently called, to determine what kind of "position" it is. Structure: call {if exitWith; if exitWtih, default} this returns [0,0,0] by default, treated later; Then a little code to make something coherent between the number of sides and the number of positions for respawn (you don't want everyone to respawn at the same place (but possible if you repeat the same marker). See isEqualType and pushback I obtain an array looking like [side1,position1,side2,position2,....] Then, I'm working into a endless loop (refreshing) all infantry units, on foot (select {isNull objectParent _x}) and not player. with a simple variable attached to the unit, I can check if this unit is already treated with my script if (!(_x getVariable ["MGIrespOK",false]) ... and then, avoid to treat the same unit twice! Then, the core of treatment for each unit: essentially an event handler killed which trigger a code only when the unit die. Event handlers are very powerful tools. I pass a maximum data on the unit (setvariable). It's convenient to refer to the same variable name but attached to each unit. I use the set/getUnitLoadout commands (recorded at start for initial loadout, or at death (EH firing) for dead loadout. Then I create a unit with createUnit + position, direction... I could add the behavior and skill of the unit as well.... not yet. All commands are here.
  24. What kind of error? You're probably in unscheduled scope which doesn't support any suspension. Test with: 0 = [] spawn { waitUntil { sleep 0.5; (vehicle player distanceSqr oilsplash) <= 0.25}; [vehicle player, 1, 1] execVM "HitRotate.sqf" };
  25. Perhaps with some commands like this one: https://community.bistudio.com/wiki/pixelGrid
×