Units firing multiple weapons

Units firing multiple weapons

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
Excelsior2
Posts: 7
Joined: 21 Jul 2013, 22:17

Units firing multiple weapons

Post 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.
User avatar
KingRaptor
Zero-K Developer
Posts: 838
Joined: 14 Mar 2007, 03:44

Re: Units firing multiple weapons

Post by KingRaptor »

Code: Select all

weapons = {
[1]={name = "coaxialrailgun1"}, 
[2]={name = "cmissile"},
},
Make sure your curly braces are paired properly!
dansan
Server Owner & Developer
Posts: 1203
Joined: 29 May 2010, 23:40

Re: Units firing multiple weapons

Post 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!
Excelsior2
Posts: 7
Joined: 21 Jul 2013, 22:17

Re: Units firing multiple weapons

Post by Excelsior2 »

Thanks, assault corvettes now have missiles and the heavy cruiser and mothership now have a secondary railgun battery.
Post Reply

Return to “Game Development”