rkemsley 10 Posted June 5, 2021 (edited) In its simplest form, is to add/remove the ability for different curators to interact with man/unmanned vehicles. Let us say that the FIA player (BLUFOR) has placed a turret in the trees for an ambush on the AAF player (Independent). While the turret is controlled by the FIA player, the AAF player is unable to interact with it in curator mode. As soon as the FIA unit manning the turret dies (or is told to leave it), the turret can now be accessed by all curators on the map while they are in curator mode (e.g. moved, deleted…). If the AAF player decides that he wants to man the turret, while controlled by the AAF player, no other curator can interact with it while they are in curator mode. In simplest terms, an unmanned vehicle is shown to all curators with the yellow circle in-game. Once the vehicle’s ownership has changed, it no longer shows up to all curators until it is empty again. I have put together the start of the script, but my knowledge of scripting is limited (still learning really). Was wondering if anyone could give me a hand/advice? Quote //init.sqf if ( isServer ) then { [] spawn { while { true } do { { _x addCuratorEditableObjects [ vehicles, false ]; sleep 0.5; } forEach allCurators; }; }; }; if ( isServer ) exitWith{}; [] spawn { while { true } do { sleep 0.5; { if ( side _x == independent ) then { ZeusBLUFOR001_Curator removeCuratorEditableObjects [ [ _x ], true ]; ZeusBLUFOR002_Curator removeCuratorEditableObjects [ [ _x ], true ]; ZeusBLUFOR003_Curator removeCuratorEditableObjects [ [ _x ], true ]; ZeusBLUFOR004_Curator removeCuratorEditableObjects [ [ _x ], true ]; }; } foreach allUnits; }; }; if ( isServer ) exitWith{}; [] spawn { while { true } do { sleep 0.5; { if ( side _x == west ) then { ZeusIndependent001_Curator removeCuratorEditableObjects [ [ _x ], true ]; }; } foreach allUnits; }; }; Edited June 13, 2021 by rkemsley Solved Share this post Link to post Share on other sites
pierremgi 4900 Posted June 6, 2021 You could try that: { _x addEventHandler ["CuratorObjectSelectionChanged", { params ["_curator", "_entity"]; if (side getAssignedCuratorUnit _curator != side _entity && side _entity != civilian) then { _curator removeCuratorEditableObjects [[_entity],true] } else { if !(_entity in curatorEditableObjects _curator) then { _curator addCuratorEditableObjects [[_entity],true] } }; }]; } forEach allCurators; Share this post Link to post Share on other sites
rkemsley 10 Posted June 6, 2021 11 hours ago, pierremgi said: You could try that: { _x addEventHandler ["CuratorObjectSelectionChanged", { params ["_curator", "_entity"]; if (side getAssignedCuratorUnit _curator != side _entity && side _entity != civilian) then { _curator removeCuratorEditableObjects [[_entity],true] } else { if !(_entity in curatorEditableObjects _curator) then { _curator addCuratorEditableObjects [[_entity],true] } }; }]; } forEach allCurators; Gave this a try, it stops other players from moving entities around which are owned by the opposing team. However, they still appear on the Edit list, left of the screen, and can be told to dismount by the opposing team. The Zeus editor seems to have a problem with empty vehicles, civilian entities. It does not seem to register/follow the same custom of saying that all empty vehicles are civilian entities for some reason. Share this post Link to post Share on other sites
mountjameson 0 Posted June 7, 2021 On 6/5/2021 at 6:15 AM, rkemsley said: In its simplest form, is to add/remove the ability for different curators to interact with man/unmanned vehicles. Let us say that the FIA player (BLUFOR) has placed a turret in the trees for an ambush on the AAF player (Independent). While the turret is controlled by the FIA player, the AAF player is unable to interact with it in curator mode. As soon as the FIA unit manning the turret dies (or is told to leave it), the turret can now be accessed by all curators on the map while they are in curator mode (e.g. moved, deleted…). If the AAF player decides that he wants to man the turret, while controlled by the AAF player, no other curator can interact with it while they are in curator mode. In simplest terms, an unmanned vehicle is shown to all curators with the yellow circle in-game like this aussie online casino. Once the vehicle’s ownership has changed, it no longer shows up to all curators until it is empty again. I have put together the start of the script, but my knowledge of scripting is limited (still learning really). Was wondering if anyone could give me a hand/advice? I do not quite understand your request, are you interested in how to do this through the code, or is it just an interesting question about the game? I will wait for an answer. Share this post Link to post Share on other sites
rkemsley 10 Posted June 7, 2021 On 6/7/2021 at 6:30 AM, mountjameson said: I do not quite understand your request, are you interested in how to do this through the code, or is it just an interesting question about the game? I will wait for an answer. I have attempted to do this through code, but it doesn't really work. Because there are probably hundreds of ways of doing what I want (some more efficiently some less), it would be useful to see another way of maybe writing the script. I am currently attempting to use a loop that checks the whole map for empty vehicles and adds them to all curators (no matter their side). I think I need another loop that then checks the map for vehicles which are no longer empty, and removes them from the curators which are not on the side of the now owned vehicle (e.g. BLUFOR curator orders a unit to enter an empty car, the car can no longer be edited by the Independent curator, and the marker on said unit disappears for the Independent curator). Share this post Link to post Share on other sites
rkemsley 10 Posted June 10, 2021 Spoiler if ( !isServer ) exitWith {}; while {true} do { sleep 0.5; { if ( ( { alive _x } count crew _x == 0 ) && ( _x isKindOf "AllVehicles" ) && !( _x isKindOf "Man" ) && ( alive _x ) ) then { ZeusBLUFOR001_Curator addCuratorEditableObjects [ [ _x ], false ]; ZeusBLUFOR002_Curator addCuratorEditableObjects [ [ _x ], false ]; ZeusBLUFOR003_Curator addCuratorEditableObjects [ [ _x ], false ]; ZeusBLUFOR004_Curator addCuratorEditableObjects [ [ _x ], false ]; ZeusIndependent001_Curator addCuratorEditableObjects [ [ _x ], false ]; }; if ( ( ( side _x ) == west ) && ( _x call BIS_fnc_isCuratorEditable isEqualTo true ) && ( alive _x ) ) then { ZeusBLUFOR001_Curator addCuratorEditableObjects [ [ _x ], true ]; ZeusBLUFOR002_Curator addCuratorEditableObjects [ [ _x ], true ]; ZeusBLUFOR003_Curator addCuratorEditableObjects [ [ _x ], true ]; ZeusBLUFOR004_Curator addCuratorEditableObjects [ [ _x ], true ]; ZeusIndependent001_Curator removeCuratorEditableObjects [ [ _x ], true ]; }; if ( ( ( side _x ) == independent ) && ( _x call BIS_fnc_isCuratorEditable isEqualTo true ) && ( alive _x ) ) then { ZeusBLUFOR001_Curator removeCuratorEditableObjects [ [ _x ], true ]; ZeusBLUFOR002_Curator removeCuratorEditableObjects [ [ _x ], true ]; ZeusBLUFOR003_Curator removeCuratorEditableObjects [ [ _x ], true ]; ZeusBLUFOR004_Curator removeCuratorEditableObjects [ [ _x ], true ]; ZeusIndependent001_Curator addCuratorEditableObjects [ [ _x ], true ]; }; if ( ( !alive _x ) ) then { ZeusBLUFOR001_Curator removeCuratorEditableObjects [ [ _x ], true ]; ZeusBLUFOR002_Curator removeCuratorEditableObjects [ [ _x ], true ]; ZeusBLUFOR003_Curator removeCuratorEditableObjects [ [ _x ], true ]; ZeusBLUFOR004_Curator removeCuratorEditableObjects [ [ _x ], true ]; ZeusIndependent001_Curator removeCuratorEditableObjects [ [ _x ], true ]; }; } foreach allUnits + vehicles; }; So this script seems to be more or less working. I am just wondering if there is a better way of writing it. I was also wondering if there was a way to detect if a unit is editable by a certain Curator and give everyone on the said Curator's side the ability to also edit the unit. For example, if a BLUFOR Curator places a mine, I'd like to be able to give all other BLUFOR Curators access to the mine, while not allowing the Independent Curator access. Share this post Link to post Share on other sites
rkemsley 10 Posted June 13, 2021 On 6/6/2021 at 4:34 AM, pierremgi said: You could try that: { _x addEventHandler ["CuratorObjectSelectionChanged", { params ["_curator", "_entity"]; if (side getAssignedCuratorUnit _curator != side _entity && side _entity != civilian) then { _curator removeCuratorEditableObjects [[_entity],true] } else { if !(_entity in curatorEditableObjects _curator) then { _curator addCuratorEditableObjects [[_entity],true] } }; }]; } forEach allCurators; Ok, so I took what you did here and expanded on it to get a pretty reliable script. Spoiler // Remove "things" from Curator when placed { _x addEventHandler [ "CuratorObjectPlaced", { params [ "_curator", "_entity" ]; if ( ( _entity isKindOf "Thing" ) ) then { _curator removeCuratorEditableObjects [ [ _entity ], true ]; }; } ]; } forEach allCurators; // Add units to allied Curators or add empty "AllVehicles" to everyone { _x addEventHandler [ "CuratorObjectPlaced", { params [ "_curator", "_entity" ]; if ( ( ( side _entity ) == west ) ) then { ZeusBLUFOR001_Curator addCuratorEditableObjects [ [ _entity ], true ]; ZeusBLUFOR002_Curator addCuratorEditableObjects [ [ _entity ], true ]; ZeusBLUFOR003_Curator addCuratorEditableObjects [ [ _entity ], true ]; ZeusBLUFOR004_Curator addCuratorEditableObjects [ [ _entity ], true ]; }; if ( ( ( side _entity ) == independent ) ) then { ZeusIndependent001_Curator addCuratorEditableObjects [ [ _entity ], true ]; }; if ( ( ( side _entity ) == civilian ) && ( _entity isKindOf "AllVehicles" ) && !( _entity isKindOf "Man" ) ) then { ZeusBLUFOR001_Curator addCuratorEditableObjects [ [ _entity ], true ]; ZeusBLUFOR002_Curator addCuratorEditableObjects [ [ _entity ], true ]; ZeusBLUFOR003_Curator addCuratorEditableObjects [ [ _entity ], true ]; ZeusBLUFOR004_Curator addCuratorEditableObjects [ [ _entity ], true ]; ZeusIndependent001_Curator addCuratorEditableObjects [ [ _entity ], true ]; }; } ]; } forEach allCurators; // Add "GetInMan" to all "Men" placed { _x addEventHandler [ "CuratorObjectPlaced", { params [ "_curator", "_entity" ]; { _entity addEventHandler [ "GetInMan", { params [ "_unit", "_role", "_vehicle", "_turret" ]; if ( ( ( side _unit ) == west ) ) then { ZeusBLUFOR001_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR002_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR003_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR004_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusIndependent001_Curator removeCuratorEditableObjects [ [ _vehicle ], true ]; }; if ( ( ( side _unit ) == independent ) ) then { ZeusBLUFOR001_Curator removeCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR002_Curator removeCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR003_Curator removeCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR004_Curator removeCuratorEditableObjects [ [ _vehicle ], true ]; ZeusIndependent001_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; }; } ]; } forEach allUnits + vehicles; } ]; } forEach allCurators; // Add "GetOutMan" to all "Men" placed { _x addEventHandler [ "CuratorObjectPlaced", { params [ "_curator", "_entity" ]; { _entity addEventHandler [ "GetOutMan", { params [ "_unit", "_role", "_vehicle", "_turret" ]; if ( ( { alive _vehicle } count crew _vehicle == 0 ) ) then { ZeusBLUFOR001_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR002_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR003_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR004_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusIndependent001_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; }; } ]; } forEach allUnits + vehicles; } ]; } forEach allCurators; // Add "GetOut" to all "AllVehicles" placed then add "GetInMan" and "GetOutMan" to all "Men" attachedObject { _x addEventHandler [ "CuratorObjectPlaced", { params [ "_curator", "_entity" ]; { _entity addEventHandler [ "GetOut", { params [ "_vehicle", "_role", "_unit", "_turret" ]; { _unit addEventHandler [ "GetInMan", { params [ "_unit", "_role", "_vehicle", "_turret" ]; if ( ( ( side _unit ) == west ) ) then { ZeusBLUFOR001_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR002_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR003_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR004_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusIndependent001_Curator removeCuratorEditableObjects [ [ _vehicle ], true ]; }; if ( ( ( side _unit ) == independent ) ) then { ZeusBLUFOR001_Curator removeCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR002_Curator removeCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR003_Curator removeCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR004_Curator removeCuratorEditableObjects [ [ _vehicle ], true ]; ZeusIndependent001_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; }; } ]; } forEach allUnits + vehicles; { _unit addEventHandler [ "GetOutMan", { params [ "_unit", "_role", "_vehicle", "_turret" ]; if ( ( { alive _vehicle } count crew _vehicle == 0 ) ) then { ZeusBLUFOR001_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR002_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR003_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR004_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusIndependent001_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; }; } ]; } forEach allUnits + vehicles; if ( ( { alive _vehicle } count crew _vehicle == 0 ) ) then { ZeusBLUFOR001_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR002_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR003_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusBLUFOR004_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; ZeusIndependent001_Curator addCuratorEditableObjects [ [ _vehicle ], true ]; }; } ]; } forEach allUnits + vehicles; } ]; } forEach allCurators; Share this post Link to post Share on other sites
pierremgi 4900 Posted June 13, 2021 allUnits + vehicles can be a huge array while in game, especially if you spawn a lot of them on each sides. Note: this array includes players, module entities like HQs, crates, weaponholders of dead units. (a little bit far from infantry + vehicles to be manned!) Anyway, it's a waste of code and not a good practice running again and again the same code for all these objects (or even for one object, for nut!). Your code does that, each time a curator place something on game. 1 - the "curatorObjectPlaced" EH is a way to run a code on the curator and/or object when object is placed. You can choose what to do for other curators, I gave you the way to couple curators and the playableUnits as potential owners of the curator logics, because you can't cope with all curators in game before a first one decide to place an asset (so there was a problem for identifying the side of the non-played curators). 2- the "CuratorObjectSelectionChanged" is a mean to detect if a curator does something on a placed object. This way you can refine a code on curator and/or object if necessary. All other mean, loops for updating properties of your object, shouldn't be done on each allUnits + vehicles. Share this post Link to post Share on other sites