New Resources

New Resources

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

Moderator: Moderators

Post Reply
PaPaPow
Posts: 3
Joined: 24 Jan 2014, 09:40

New Resources

Post by PaPaPow »

Hi all i'd like to add some new resources, and change metal and energy to different names too. is t possible? thanks in advance

-pow
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: New Resources

Post by Silentwings »

Yes it's possible, you can do this with lua. But I think you'd have to reimplement all of the mechanics of resourcing yourself in lua if you want >2 resources.
PaPaPow
Posts: 3
Joined: 24 Jan 2014, 09:40

Re: New Resources

Post by PaPaPow »

I'm willing. Just tell me how to do it
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: New Resources

Post by Anarchid »

"Lua it" means you have to write a gadget script (and possibly modify/add a few widgets).

1) Set a TeamRulesParam for each team ingame to store values for your custom resource.

2) Tap into AllowBuild / AllowBuildStep / other synced call-ins to block or slow down actions that consume this resource when they are insufficient.

3) Tap into other call-ins to increment/decrement resource values for relevant team when appropriate.

4) Create some way to represent this resource to a player. That is, write an user-interface Widget script.

---

When in doubt, google.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: New Resources

Post by knorke »

Did you get familiar with spring/spring's scripting yet? If not, do that first; otherwise confusion. (just asking since it is your first post and question is so vague)

Without too much spring-specifiques, via scripts it is possible to:
-to spawn & destroy units
-allow or disallow unit creation
-keep track of data per player/team
-draw & write whatever you want onto the screen

Basically yes, possible. Detail question would be how much stuff you want to leave to engine or not. For example you could keep "normal" factories and like Anarchid wrote then "Tap into AllowBuild / AllowBuildStep" to make them behave your way. Or you can also re-create that logic in Lua, too.
PaPaPow
Posts: 3
Joined: 24 Jan 2014, 09:40

Re: New Resources

Post by PaPaPow »

Well actually i am totally new to spring. I wanted to know if it was possible to do it. If not, then it is no good for me to learn spring. Now that i see its possible, ill learn it properly. thanks

-pow
Post Reply

Return to “Lua Scripts”