Page 1 of 1

Need some help.

Posted: 11 Aug 2008, 07:03
by Cupojoe
So, I've been making a Spring mod in LUA and I was wondering if I could make it every time a con unit reclaims/repairs/builds something he gains XP for it. Is it possible? And if so how do I do it?

Re: Need some help.

Posted: 11 Aug 2008, 07:20
by Argh
Is it possible?
Should be, yes.
And if so how do I do it?
Well, you're going to need to look for FeatureDestroyed / UnitDestroyed events, then see if they occurred due to reclaim reaching 0... and then cross-check with builders to verify which ones just stopped "building"... so that the right one gets the bonus. Doing it, if you need to Reclaim Units, will be even harder to check- IIRC, there is no "reclaim" value for Units.

A better way to do the same sort of functionality, imo at least, is to write a custom command that acts like a Reclaim command, in terms of time, etc., but when it finishes, it removes the target (if valid, of course) and gives the award.

It'd be a little annoying, because once you started you'd have to lock that Unit down until it completed, but it'd work with less CPU checking every frame, which would be much better for, say, a Gauntlet-style game with powerups on the ground, etc., where it's not a long wait. For a more traditional, OTA-style reclaim, I think the first way is the only way that's going to be reliable, but I shudder to think of the large table searches involved :|

At any rate, I may have overlooked something that would really make this easy, but that's my first thought about solving this.

Re: Need some help.

Posted: 11 Aug 2008, 09:06
by Cupojoe
I'll try both and see which works best. Thanks for the help.