SetUnitSelectableOverride

Started by Relli, May 19, 2014, 08:54:49 PM

Previous topic - Next topic

Relli

This shiny new 2.04 update added many things, including several interesting new CRPL commands. One of which is the one in the title, which can be used to make a player's unit unselectable.
Is there any chance this same command could be used to make a non-player unit selectable? It would be a huge step towards a map-maker's ability to create their own custom units that a player can control, even if the only thing it really does is allow commands like Disarm, Deactivate and Destroy.
Also, a command to check whether a unit is selected or not would be an even huger step, and would help my own CRPL project immeasurably.

Thank you for your consideration.  :)

knucracker

It's a whole other can of worms to allow crpl cores to be selected.  I'd have to expose the selected "State" to CRPL and probably provide callbacks for each state change.  The selection indicator also would have to be adaptable (size wise), etc.

The API I added works independently of the select state.  I called it "override" meaning that it is an override for a unit that already supports selection.  So for now, it is only useful for changing the select-ability regular units.

Relli

Understood. I had a feeling it'd be far more complex than I guessed. Thank you anyway, though.
I should be able to accomplish a lot of what I need with the code that already exists. It just would have been nice to have a shortcut.

stewbasic

It would probably be sufficient to expose the state via GetScriptVar(0 ...) without the need for callbacks. Certainly it would open a lot of doors if custom player units could make use of inbuilt unit behaviour (selecting, disabling, moving etc) rather than trying to mimic it all with CRPL (very inefficient) and ultimately falling short anyway (eg if the player selects both regular units and cores and clicks "disable", there's currently no way to make it work correctly in CRPL). But yeah, obviously that's a lot to ask. Anyway no harm in putting ideas out :P.