Jump to content

Recommended Posts

Quote

{

    _x addEventHandler [ "CuratorObjectPlaced", {

        params [ "_curator", "_entity" ];

        if ( ( _entity in curatorEditableObjects ZeusBLUFOR001_Curator ) || ( _entity in curatorEditableObjects ZeusBLUFOR002_Curator ) || ( _entity in curatorEditableObjects ZeusBLUFOR003_Curator ) || ( _entity in curatorEditableObjects ZeusBLUFOR004_Curator ) ) then {

            ZeusBLUFOR001_Curator addCuratorEditableObjects [ [ _entity ], true ];

            ZeusBLUFOR002_Curator addCuratorEditableObjects [ [ _entity ], true ];

            ZeusBLUFOR003_Curator addCuratorEditableObjects [ [ _entity ], true ];

            ZeusBLUFOR004_Curator addCuratorEditableObjects [ [ _entity ], true ];

            }

        }

    ];

} forEach allCurators;

This script adds every unit placed, by one of the four BLUFOR Curators, to every BLUFOR Curator on the map.

 

I was wondering how I would make it so that this script would add Curator-placed units to all allied Curators on the map. For example, if I had three teams, who are all enemies, (BLUFOR, OPFOR and Independent) and each team has three players (ZeusBLUFOR001_Curator for BLUFOR, ZeusOPFOR001_Curator for OPFOR and so on). How would I add these players to a "group" which can then be used in the above script to add each placed unit by one of the players to all their allies?

 

Do I need to create three arrays and add the Curators (so if I plan to create or remove Curators, I can adjust appropriately), and if so, how?

 

Something like:

 

Array 1 - Curator_west

Array 2 - Curator_east

Array 3 - Curator_independent

 

Then I was hoping I could write:

Quote

        if ( ( _entity in curatorEditableObjects Curator_west ) || ( _entity in curatorEditableObjects Curator_east ) || ( _entity in curatorEditableObjects Curator_independent ) ) then {

Then addCuratorEditableObjects to the Curators which are in their associated array (group).

Share this post


Link to post
Share on other sites

The problem is curator unit (getAssignedCuratorUnit) is null (and side unknown) till a player choose to play the curator.

If you place a playable unit named bob, then a curator module with bob as owner, you can work on curator (module) with the curator commands and EHs but not on the owner til he's played (can be at start or by JIP).

Spoiler

Furthermore, the owner variable (<logic module> getvariable "owner")  is not accessible by script because for safety reason (anticheat), BI decided to delete this variable once passed inside bis_fnc_moduleCurator.

So no way to know the side of the owner before he is played....

 

... but one thing you can do, is to set an array, coupling [module,owner] along with you wrote in editor. For example:
in init.sqf:
private _curatorIds = [[curat1,ownr1], [curat2,ownr2],.....];  // where ownr1 is the unit owning the zeus module curat1....

then:

private _curatorWest = _curatorIds select {side (_x#1) == WEST} apply {_x#0};

 

Share this post


Link to post
Share on other sites
Spoiler

 

17 hours ago, pierremgi said:

The problem is curator unit (getAssignedCuratorUnit) is null (and side unknown) till a player choose to play the curator.

If you place a playable unit named bob, then a curator module with bob as owner, you can work on curator (module) with the curator commands and EHs but not on the owner til he's played (can be at start or by JIP).

  Reveal hidden contents

Furthermore, the owner variable (<logic module> getvariable "owner")  is not accessible by script because for safety reason (anticheat), BI decided to delete this variable once passed inside bis_fnc_moduleCurator.

So no way to know the side of the owner before he is played....

 

... but one thing you can do, is to set an array, coupling [module,owner] along with you wrote in editor. For example:
in init.sqf:
private _curatorIds = [[curat1,ownr1], [curat2,ownr2],.....];  // where ownr1 is the unit owning the zeus module curat1....

then:

private _curatorWest = _curatorIds select {side (_x#1) == WEST} apply {_x#0};

 

I couldn't get the array assignment working.

 

I am a bit of a novice when it comes to coding, however, I found that this piece of code seems to be a pretty reliable substitute.

Quote

{

    _x addEventHandler [ "CuratorObjectPlaced", {

        params [ "_curator", "_entity" ];

        if ( ( side getAssignedCuratorUnit _curator == west ) ) then {

                ZeusBLUFOR001_Curator addCuratorEditableObjects [ [ _entity ], true ];

                ZeusBLUFOR002_Curator addCuratorEditableObjects [ [ _entity ], true ];

                ZeusBLUFOR003_Curator addCuratorEditableObjects [ [ _entity ], true ];

                ZeusBLUFOR004_Curator addCuratorEditableObjects [ [ _entity ], true ];

            }

        }

    ];

} forEach allCurators;

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×