Page 1 of 1

Units firing multiple weapons

Posted: 25 Jul 2013, 06:18
by Excelsior2
How do I get a unit to be able to fire more than one weapon such as a ship being able to fire both missiles and a railgun?

When I use: weapons = {
[1]={name = "coaxialrailgun1" and "cmissile",

},
},

} It causes a randomly causes either the railgun or the missile to be the only one that fires.
When I use: weapons = {
[1]={name = "coaxialrailgun1", "cmissile",

},
},

} The one listed first is the only one that fires.

When I use: weapons = {
[1]={name = "coaxialrailgun1",
[2]={name = "cmissile",

},
},

}
It becomes a invalid unit def.

Re: Units firing multiple weapons

Posted: 25 Jul 2013, 07:17
by KingRaptor

Code: Select all

weapons = {
[1]={name = "coaxialrailgun1"}, 
[2]={name = "cmissile"},
},
Make sure your curly braces are paired properly!

Re: Units firing multiple weapons

Posted: 25 Jul 2013, 09:26
by dansan
If you use a proper source code editor, that knows text highlighting for Lua, it will indent your code in a way, that you see that kind of mistakes quicker. It will also highlight the closing/opening bracket that corresponds to the one where your cursor currently is. Really helpful!

Re: Units firing multiple weapons

Posted: 26 Jul 2013, 01:42
by Excelsior2
Thanks, assault corvettes now have missiles and the heavy cruiser and mothership now have a secondary railgun battery.