Cost Prereq

Cost Prereq

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

Moderator: Moderators

Post Reply
SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1948
Joined: 21 Sep 2004, 08:25

Cost Prereq

Post by SpikedHelmet »

There already exists prerequisite style LUA/gamecode/etc where you can set prerequisites for units; ie "this must be built before this can be built" C&C Tech style (except in our case, unavailable units are greyed out, which is perfect anyway)

So I'm requesting something very similar but my simple mind can't fathom how to do it -- that is to use cost prerequisites, ie unless you can afford the total metal/energy cost of a unit, it is greyed out in a similar fashion, so that you can only build units you have the resources to fully buy.

FYI this would be combined with instant buildtimes for those who may wonder "why bother?", so that a system of instant construction can be made without being constantly lagged by stalling.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: Cost Prereq

Post by bobthedinosaur »

Instead of using the resource system, do it all lua wise, where you can only active the feature if you have the x y cost amount and once you do it takes that out of the players resource pool and spawns the bought unit.


You could even throw in a short delay timer to have some kind of animation before it spawns.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Cost Prereq

Post by KDR_11k »

Gundam resource system. It does a full cost up front approach and is designed to adapt easily to different resource counts.. There's also a research system included in case you want that.
SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1948
Joined: 21 Sep 2004, 08:25

Re: Cost Prereq

Post by SpikedHelmet »

I don't need an animation (the units literally just appear), but do want units to be invulnerable for a period of time after being made.

What I'm going for is Men of War-style unit aquisition, where there's a simple buildmenu where each unit is seperated into a variety (5) different "types" with a simple, always-present UI (similar to Buildbar widget). You click on the menu, click on the unit, and it magically (and instantly) appears at its spawn location (ie player start position), the cost being immediately extracted -- and units that you can't afford in one lump sum unavailable.

Unfortunately my Lua knowledge borders on mental retardation, but I actually did manage to create my very first gadget today (with loads of help, but still), though it turned out to be completely useless. \o/

I'll check Gundam/bug smoth.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Cost Prereq

Post by KDR_11k »

Of course an alternative would be to give all units a build time of 1 and the constructor a workertime of 32, then it's all built in one chunk.
SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1948
Joined: 21 Sep 2004, 08:25

Re: Cost Prereq

Post by SpikedHelmet »

That will only make it so that the resource is used in one immediate chunk, but the queued unit will still appear as in the process of being built at the factory, though that is at least a step in the right direction.
Post Reply

Return to “Lua Scripts”