Idea (hack) for communicating unsynced->synced

Idea (hack) for communicating unsynced->synced

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Zpock
Posts: 1218
Joined: 16 Sep 2004, 23:20

Idea (hack) for communicating unsynced->synced

Post by Zpock »

I'm not content with using the standard TA buttons as UI for interacting with a gadget handling custom game mechanics. For implementing something like an ingame unit customizer interface, that would be very much inadequate.

The main problem is that the unsynced side is designed to interact with only the engine, and not any synced code. Synced code can communicate with the unsynced tough.

There is a backdoor tough, unitcommands. This is the only way unsynced code can actually make a difference ingame as far as I know. So to communicate from unsync -> sync, it should be possible by doing the following:

1. Create a special unit wich only purpose is to receive commands from the unsynced UI.

2. Hide this unit as well as possible from the player. This would include making the unit unselectable (is this possible?), invisible (no model or any graphics), put at a large distance away from the actual map area, and/or above it.

3. Intercept the commands in the synced code handling commands.

Obviously it would be nice if we didn't have to go trough a unit, but I can't think of any other way and it seems to me that it could work pretty well?
User avatar
Felix the Cat
Posts: 2383
Joined: 15 Jun 2005, 17:30

Re: Idea (hack) for communicating unsynced->synced

Post by Felix the Cat »

Zpock wrote:This would include making the unit unselectable (is this possible?)
Yes, LuaSyncedControl::SetUnitNoSelect(number unitID, boolean nonSelectable).

NB. You can also set the unit not to be shown on the minimap (LuaSyncedControl::SetUnitNoMinimap).
Post Reply

Return to “Lua Scripts”