Need some help.

Need some help.

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

Moderator: Moderators

Post Reply
Cupojoe
Posts: 2
Joined: 11 Aug 2008, 06:55

Need some help.

Post 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?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Need some help.

Post 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.
Cupojoe
Posts: 2
Joined: 11 Aug 2008, 06:55

Re: Need some help.

Post by Cupojoe »

I'll try both and see which works best. Thanks for the help.
Post Reply

Return to “Lua Scripts”