Jump to content
Ryko

Dynamically spawned zeus modules: everything works but editing. Help?

Recommended Posts

Hi folks,

 

I'm trying to get away from editor-placed zeus modules, and I've got everything working except editing units.  With the following code, a connected player is assigned a curator module that's dynamically created, and can create/delete/move/issue waypoints to spawned units: but double-clicking on the unit does not produce the editing dialog.  What am I missing?

curatorGroup = createGroup sideLogic;

addMissionEventHandler ["PlayerConnected", {
	params ["_id", "_uid", "_name", "_jip", "_owner"];
	
	_player = (allPlayers select {owner _x == _owner}) select 0;
	
	private _curatorModule = curatorGroup createunit ["ModuleCurator_F", [0, 90, 90], [], 0.5, "NONE"];
	_player assignCurator _curatorModule;
	_player setVariable ['curatorModule', _curatorModule];
}];

(My code is a bit more elaborate than this, but this stripped-down version produces the same results.)

 

Thanks,

Ryko

  • Like 1

Share this post


Link to post
Share on other sites

following up: I think I've gotten around it by adding code from the fn_moduleCurator.sqf function in the curator addon:

_curatorModule addeventhandler ["curatorObjectDoubleClicked",{(_this select 1) call bis_fnc_showCuratorAttributes;}];
_curatorModule addeventhandler ["curatorGroupDoubleClicked",{(_this select 1) call bis_fnc_showCuratorAttributes;}];
_curatorModule addeventhandler ["curatorWaypointDoubleClicked",{(_this select 1) call bis_fnc_showCuratorAttributes;}];
_curatorModule addeventhandler ["curatorMarkerDoubleClicked",{(_this select 1) call bis_fnc_showCuratorAttributes;}];

Though strictly speaking, I don't think this should be necessary.

 

Edit: works in local multiplayer, but doesn't on dedicated server.

  • Like 1

Share this post


Link to post
Share on other sites

Basically you should add variables to module object as module settings and than spawn a function like normal modules  created in editor doing during initialisation process

 

Share this post


Link to post
Share on other sites
56 minutes ago, JasperRab said:

I believe, at least I do it, you need to add the object to the curator using addCuratorEditableObjects for each unit/object.
https://community.bistudio.com/wiki/addCuratorEditableObjects

 

 

Thanks for the responses. As stated, everything works (moving, adding, deleting, assigning waypoints) but double clicking does not produce the edit dialog.

Share this post


Link to post
Share on other sites

Curator modules to initialise properly, especially when setting allowed addons, need to be created before time > 0.

It would be best to create as many curators as needed (playableSlotsNumber ?) in a preInit function.

When a clients connects request to be assigned to a curator by the server. When the client disconnects un-assign the curator.

 

TEST_MISSION working MP hosted and dedicated inc. JIP

  • Like 1

Share this post


Link to post
Share on other sites

Thanks, Larrow.

 

Adding the following allowed edit functionality to work properly:

 

_curatorModule setVariable ["owner", str _owner, true];
_curatorModule setVariable ["curatorUnitOwner", str _owner];

 

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

×