Linked Units
Moderator: Moderators
Linked Units
Is it possible to have it when you build a powerplant (or a turret like in c&c 3) you build a hub, then several nodes coming off it (preferably joint by wires or something). If you destroy the hub, all nodes are destroyed too. If you destroy a node, only that node is destroyed.
Re: Linked Units
How would I do it?Cheesecan wrote:Yes.
Re: Linked Units
Start hacking lua scripts. Begin somewhere small, say a script that prints out something in the console. Then maybe a script that detects when you built a specific building. Then work your way up to more complex things. In your Spring/LuaUI/Widgets directory is a ton of samples to get you started.kalda341 wrote:How would I do it?Cheesecan wrote:Yes.
Re: Linked Units
i do not know if it is still in ZK, but CA had shields that were linked together by some energy beam thing, when they were close, so you may copy&paste from them.
Re: Linked Units
I think you misunderstand what he meant by linked units:a powerplant (or a turret like in c&c 3)
Afaik the only way to do this in spring is that the base unit has to be a transporter and loads the other unit. The UI would be a bit complicated to do...http://cnc.wikia.com/wiki/Component_Tower wrote:The tower itself was just a plug into which a a defensive weapon could be installed. This allowed a GDI commander to place a number of empty towers and install the actual defenses later on.
If you really mean something like this:
There is a "defense center" that can build turrets in some radius around it.
If the defense center is destroyed, all its turrets also explode.
Then that is easier to do ie like this:
Code: Select all
local turret_belongs_to = {} --for each turret store which defense center built it
UnitCreated(unitID, unitDefID, teamID, builderID)
local new_unit_is_turret = blablabla
if (new_unit_is_turret==true) then
turret_belongs_to[unitID] = builderID
end
end
UnitDestroyed(unitID, unitDefID, teamID, attackerID)
local destroyed_unit_is_defense_center = blabla
if (destroyed_unit_is_defense_center==true) then
loop (through turret table)
if (turret_belongs_to[turretUnitID]= unitID) then
destroyedUnit (turret[turretUnitID)
turret_belongs_to[turretUnitID] = nil
end
end
end
Re: Linked Units
You can do it with movectrl or even just show/hide pieces too, depending on what is really wanted.
Re: Linked Units
Answer for a casual player: Yes this is possible, but it isn't built-in functionality (I know of no such structure existing at the moment - though that doesn't mean noone has it..) , so there's a bit of scripting / coding you'd have to do to get it to work.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: Linked Units
Would I be right in saying you want to be able to build one structure which can then deploy a fixed number of sub structures around it? Like Nod towers in c&c3?
This is pretty simple to do with minimal gadget work. Your hub structure can have the node structures in it's buildlist and a certain build range that dictates how far away the sub structure can be. The hub and nodes need to be non-assistable to prevent them taking part in other built in economy things that you might have. From here the player can simply select the hub and place nodes, you can control the cost and buildtime of nodes.
The only lua gadgetting required would be to destroy all nodes when the hub is destroyed, disable the hubss build options when it is controlling the maximun number of nodes and optionally to draw wires between the hub and nodes.
The gadget side of this is far easier than others would have you think.
This is pretty simple to do with minimal gadget work. Your hub structure can have the node structures in it's buildlist and a certain build range that dictates how far away the sub structure can be. The hub and nodes need to be non-assistable to prevent them taking part in other built in economy things that you might have. From here the player can simply select the hub and place nodes, you can control the cost and buildtime of nodes.
The only lua gadgetting required would be to destroy all nodes when the hub is destroyed, disable the hubss build options when it is controlling the maximun number of nodes and optionally to draw wires between the hub and nodes.
The gadget side of this is far easier than others would have you think.
Re: Linked Units
When you put it like that, it does sound quite simple. I should be able to manage that.Google_Frog wrote:Would I be right in saying you want to be able to build one structure which can then deploy a fixed number of sub structures around it? Like Nod towers in c&c3?
This is pretty simple to do with minimal gadget work. Your hub structure can have the node structures in it's buildlist and a certain build range that dictates how far away the sub structure can be. The hub and nodes need to be non-assistable to prevent them taking part in other built in economy things that you might have. From here the player can simply select the hub and place nodes, you can control the cost and buildtime of nodes.
The only lua gadgetting required would be to destroy all nodes when the hub is destroyed, disable the hubss build options when it is controlling the maximun number of nodes and optionally to draw wires between the hub and nodes.
The gadget side of this is far easier than others would have you think.
Re: Linked Units
And it really is that simple.
See my previous posting with the pseudo code.
So anyway, I decided to do this because I wanted something similiar.
For every unitname you can define several other unitnames. Those "linked"
Units will explode if their builder dies. In this example there is a "turret center" that
Controlls the turrets it built. If this "turret center" is
Killed, all its turrets also die.
By writing this sentence I
Add a hidden message.
- Attachments
-
- tp_linked_unit_explo.lua
- (2.83 KiB) Downloaded 162 times