Figure out who is being reclaimed?

Figure out who is being reclaimed?

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

Moderator: Moderators

Post Reply
User avatar
Pithikos
Posts: 146
Joined: 26 Dec 2008, 14:26

Figure out who is being reclaimed?

Post by Pithikos »

The question of the day: How can I check whick wreckage is being reclaimed?
There are so many callouts/callins for everything else but nothing for reclaiming. Or else it's just not documented. Anyway I used a checking in the metal making and energy making to figure out if a unit is reclaiming. Now I am stuck as to how figure out WHAT it is reclaiming :S

Here is part of the code http://pastebin.com/j366zf69

The table "reclaimers" just keeps the UnitID of builders/com/nanos/resurrectors as identifier and a boolean that is always true as value. example:

Code: Select all

reclaimers={
170=true,
1023=true
}
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Figure out who is being reclaimed?

Post by Beherith »

I dont know, but I would look into jKs healthbars widget, as that knows when stuff is being reclaimed. You can even spot enemy rezzers with it on cooper.
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: Figure out who is being reclaimed?

Post by Niobium »

You could use something like this: (Note: Untested)

Code: Select all

function GetReclaimTarget(unitID)
	local unitCommands = Spring.GetUnitCommands(unitID, 1)
	if #unitCommands > 0 then
		local firstCommand = unitCommands[1]
		if firstCommand.id == CMD.RECLAIM and #firstCommand.params == 1 then
			return firstCommand.params[1]
		end
	end
end
Which will return the unitID or featureID of what the unit is reclaiming, or it will return nil, so there wouldn't be a need to check the units resources beforehand.
UAF
Posts: 96
Joined: 02 Jan 2008, 19:25

Re: Figure out who is being reclaimed?

Post by UAF »

I wonder if this can be used to prevent smart nanos from reclaiming stuff like dead commanders automatically.
Some things are worth rezzing
User avatar
Pithikos
Posts: 146
Joined: 26 Dec 2008, 14:26

Re: Figure out who is being reclaimed?

Post by Pithikos »

UAF wrote:I wonder if this can be used to prevent smart nanos from reclaiming stuff like dead commanders automatically.
Some things are worth rezzing
That's what I'm into.. I make a widget so reclaimers stop reclaiming commanders when there is 1 metal left :twisted:
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Figure out who is being reclaimed?

Post by Google_Frog »

That's what I'm into.. I make a widget so reclaimers stop reclaiming commanders when there is 1 metal left :twisted:
Watch out widgets run unsynced to are liable to the same latency you are. You'll probably end up stopping your reclaim slightly too late in any game you don't host.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Figure out who is being reclaimed?

Post by aegis »

not if you know the reclaim speed and issue the command on exactly the right gameframe?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Figure out who is being reclaimed?

Post by knorke »

you should add in something that reclaiming on 1-metal wrecks is not even started.
otherwise one con stops reclaiming at 1 metal, then another con comes along and accidently the whole thing.
Post Reply

Return to “Lua Scripts”