The new map scripting is brilliant. But it is not perfect. I have heard that it is still under heavy development, so im gonna suggest some ideas:
Have an array(table in LUA-speak) that stores every unit on the map. So I can go 'Unit' to access properties of any unit on the map.
Have the Unit[] variables have the following information in them
.x - X-position
.y - Y-position
.z - Z-position
(Could alternativley be in the float3() format)
.UnitName - eg: ARMCOM
.MaxHealth - Maximum unit health
.CurrentHealth - 0-1, their current health
.CanBuild - is is a builder?
.CanAttack - Can it attack
.CanGuard - Can it guard
(ect. Those tags from the FBI files would be good)
.Alive - is it alive?
Make a GetUnitsAt() function that returns the units at a specified point, instesd of how many there are.
Make a GetNumUnitsInRect() function that returns the number of units in a rectangle. Eg: GetNumUnitsInRect(float3() corner1, float3() corner2). Also a GetUnitsInRect() function. See above.
A ClearArea() function that removes trees/wrekage from an area.
Documentation on what all of the different functions do, and how to use them.
Dunno if Lua supports this, but does it support custom classes(like the unit thing mentioned earlier. Think its caleld a class)? And if it does, how do you use them. If it does not, how hard would it be to implement?
Everyone else, post requests in here if you have them. Map scripting has the potential to be really cool, and we want to help the SY's achive this as much as possible.
LUA Scripting Wishlist
Moderator: Moderators
Lua scripts
Really, for units, there's no reason not to allow read-access to all the unit's designed stats and tags. Then, all you have left to ask for is the position, owner, and health (and any status changes, like if it's stunned or not). There's the complete information querying. Plus, if iterating over every unit is too slow, then there needs to be a way to define a "zone" and test for the presence of units within it (and examine only those units).
After that, you need functions for actually doing stuff. Think about all the stuff that needs to be done for basic map scripting.
Creating units, setting ownership, setting status (health, stun, etc.) relocating units, destroying units... that's the basics of unit functions.
Also, for scripted encounters, you need a way for the script to take player control away from one of his units and give it orders. That way you can have characters. You also need a way to make units invulnerable and untargetable - possibly on a player-by-player basis (player X can't harm player Y) - this is very useful in complex mission scripts.
Also, there's faction issues. You need to be able to force alliances, disallow alliances, and create AI-driven players with controllable behavior.
Finally, you need UI additions - you need to be able to configure which scripts will be used from the launcher. You also may need to have a briefing, since some missions may have complex explanations. If your adventure has a complex plot, then some way to have units "talk" might be needed.
Of course, this is all pie-in-the-sky thinking. What's really needed are the basics: query unit attributes and status (so you can get information on what kind of unit, where it is, and how it's doing), console output (dead simple), create/teleport/set status/set ownership on units, alter resources, create/manage AI players, force/manage alliances, declare a victor, and set units to be "unattackable" by some or all players. Most of that's pretty simple, actually - it just involves binding to the existing functionality (except the "unattackable" flag - but that's pretty necessary for many scripts). The hard part is (a) network support for such scripts, and (b) a GUI framework for managing such scripts.
After that, you need functions for actually doing stuff. Think about all the stuff that needs to be done for basic map scripting.
Creating units, setting ownership, setting status (health, stun, etc.) relocating units, destroying units... that's the basics of unit functions.
Also, for scripted encounters, you need a way for the script to take player control away from one of his units and give it orders. That way you can have characters. You also need a way to make units invulnerable and untargetable - possibly on a player-by-player basis (player X can't harm player Y) - this is very useful in complex mission scripts.
Also, there's faction issues. You need to be able to force alliances, disallow alliances, and create AI-driven players with controllable behavior.
Finally, you need UI additions - you need to be able to configure which scripts will be used from the launcher. You also may need to have a briefing, since some missions may have complex explanations. If your adventure has a complex plot, then some way to have units "talk" might be needed.
Of course, this is all pie-in-the-sky thinking. What's really needed are the basics: query unit attributes and status (so you can get information on what kind of unit, where it is, and how it's doing), console output (dead simple), create/teleport/set status/set ownership on units, alter resources, create/manage AI players, force/manage alliances, declare a victor, and set units to be "unattackable" by some or all players. Most of that's pretty simple, actually - it just involves binding to the existing functionality (except the "unattackable" flag - but that's pretty necessary for many scripts). The hard part is (a) network support for such scripts, and (b) a GUI framework for managing such scripts.
Forgot to mention that this was on top of current stuff already there. We do have a way of spawning units, and a few other things.
Setting alliances is definatley needed. A very high priority.
AI is also important, but AI control is not as important. Just having an AI with a prebuilt base would be enough to get it started.
Also, I suggest another class(?) like the unit class. The Player Class.
.Metal
.Energy
.MetalStorage
.EnergyStorage
.Allies
.AI
Console output is kinda already inplace. The print() fuction will write a message to the chat window.
Player information, Unit information, AI, and setting victory would all be very good.
Some of that information your dismissing as usless could be quite usefull. For example, you want a mission where you have to build a certain structure in a certain area. As soon as you move a construction unit in, the area gets attacked. But you dont want this to happen with normal units. Obscure stuff like that. If its not in there people will eventually complain.Really, for units, there's no reason not to allow read-access to all the unit's designed stats and tags. Then, all you have left to ask for is the position, owner, and health (and any status changes, like if it's stunned or not).
Thats what I was asking for with the GetUnitsAt() function. There is already a GetNumUnitsAt() function that returns the number of units within a radius of a certain point, but like you said, there needs to be a way to get WHICH untis are in the area.There needs to be a way to define a "zone" and test for the presence of units within it (and examine only those units).
Creating taken care of. Setting ownership would be good. And with that Unit[] class I was hoping to just change the Unit.x to move the unit, or change health, or ownership. Special functions specifically designed to do that seem a bit usless.Creating units, setting ownership, setting status (health, stun, etc.) relocating units, destroying units... that's the basics of unit functions.
Setting alliances is definatley needed. A very high priority.
AI is also important, but AI control is not as important. Just having an AI with a prebuilt base would be enough to get it started.
Also, I suggest another class(?) like the unit class. The Player Class.
.Metal
.Energy
.MetalStorage
.EnergyStorage
.Allies
.AI
Console output is kinda already inplace. The print() fuction will write a message to the chat window.
Player information, Unit information, AI, and setting victory would all be very good.
Maelstrom wrote:Forgot to mention that this was on top of current stuff already there. We do have a way of spawning units, and a few other things.
Some of that information your dismissing as usless could be quite usefull. For example, you want a mission where you have to build a certain structure in a certain area. As soon as you move a construction unit in, the area gets attacked. But you dont want this to happen with normal units. Obscure stuff like that. If its not in there people will eventually complain.Really, for units, there's no reason not to allow read-access to all the unit's designed stats and tags. Then, all you have left to ask for is the position, owner, and health (and any status changes, like if it's stunned or not).
Thats what I was asking for with the GetUnitsAt() function. There is already a GetNumUnitsAt() function that returns the number of units within a radius of a certain point, but like you said, there needs to be a way to get WHICH untis are in the area.There needs to be a way to define a "zone" and test for the presence of units within it (and examine only those units).
Creating taken care of. Setting ownership would be good. And with that Unit[] class I was hoping to just change the Unit.x to move the unit, or change health, or ownership. Special functions specifically designed to do that seem a bit usless.Creating units, setting ownership, setting status (health, stun, etc.) relocating units, destroying units... that's the basics of unit functions.
Setting alliances is definatley needed. A very high priority.
AI is also important, but AI control is not as important. Just having an AI with a prebuilt base would be enough to get it started.
Also, I suggest another class(?) like the unit class. The Player Class.
.Metal
.Energy
.MetalStorage
.EnergyStorage
.Allies
.AI
Console output is kinda already inplace. The print() fuction will write a message to the chat window.
Player information, Unit information, AI, and setting victory would all be very good.
Oh, I didn't know what was iplemented already. By "AI control" I just meant some basic things to tell the AI to do with their faction. Just basic functions like "Porc" "Attack Players (Playerlist)" "Do Nothing" - Do Nothing + a one-way alliance would allow for a nice way to have neutral, unclaimed units that you could "capture".
And as for attributes, what I meant was to skip the peacemeal stuff you were mentioning and jump straight to being able to access every tag set, every attribute in the unit definition - query for for what weapons it has, how much damage each weapon does, how much health it gets, whether it's immune to paralysis, how much worker time it has, etc. With that much information, the unit name would be unnecessary.
How does one check if a unit has been destroyed? Is there an "ondestroy" event one can bind to?
You should really be requesting that IAICallback be binded to the lua itnerace, it'd give you all you've asked for and much much more.
As for AI player designation, all 3 AI's(JCAI,NTAI and ZcAIn) work in such a way that starting them off after spawning a abse might be a little unprudent, for all i know it could ignore the existence of the spawned base and try to build a new one.
As for AI player designation, all 3 AI's(JCAI,NTAI and ZcAIn) work in such a way that starting them off after spawning a abse might be a little unprudent, for all i know it could ignore the existence of the spawned base and try to build a new one.