Page 1 of 1

Figure out who is being reclaimed?

Posted: 22 Nov 2010, 20:29
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
}

Re: Figure out who is being reclaimed?

Posted: 23 Nov 2010, 00:03
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.

Re: Figure out who is being reclaimed?

Posted: 23 Nov 2010, 00:26
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.

Re: Figure out who is being reclaimed?

Posted: 23 Nov 2010, 17:06
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

Re: Figure out who is being reclaimed?

Posted: 23 Nov 2010, 17:34
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:

Re: Figure out who is being reclaimed?

Posted: 24 Nov 2010, 13:53
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.

Re: Figure out who is being reclaimed?

Posted: 24 Nov 2010, 15:29
by aegis
not if you know the reclaim speed and issue the command on exactly the right gameframe?

Re: Figure out who is being reclaimed?

Posted: 24 Nov 2010, 16:03
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.