Composite Vehicle/Unit/Turret issues
Posted: Sun Oct 16, 2016 11:12 pm
I'm working on this mod [MOD 0.14] Programmable Warfare - command units via signals and I'm having a few problems with the composite unit/vehicle setup.
The current setup is a car-type vehicle (a tank) and a unit-type entity with no collision that sits on top of the vehicle and acts like a turret. You can control the vehicle's angle and speed remotely and the unit stays locked to the vehicle. If you give a go-to type command the the collision settings swap so the unit can move with pathfinding an vehicle entity is positioned underneath the unit as it travels. So far that's working ok(ish) but there are some issues that I can't find good ways to work around.
I want the unit/vehicle to use ammo:
I can't find a way of making the unit's weapon use actual ammo or give it an ammo slot.
I can't control the vehicle's built-in turret/weapon with lua.
If I try to attach an actual turret-type entity on top of the vehicle then it can fire and use ammo but when the vehicle is moving the turret can only face in 1 of 4 directions, orientation does not work and I cant direct the turret part of the turret to the right direction.
In theory I could use an invisible turret-type as the turret and have a fake display that can be controlled, but if the fake display is a unit then it might target the wrong thing. If the fake display is a vehicle then I would have more control over the direction, but as far as I can tell there's no way to tell what direction a turret if facing or what it's attacking.
Is there some way to detect a turret's current target, or even IF a turret or unit is firing/attacking?
If anyone has ideas on a better solution, or tips and tricks that would be great.
The current setup is a car-type vehicle (a tank) and a unit-type entity with no collision that sits on top of the vehicle and acts like a turret. You can control the vehicle's angle and speed remotely and the unit stays locked to the vehicle. If you give a go-to type command the the collision settings swap so the unit can move with pathfinding an vehicle entity is positioned underneath the unit as it travels. So far that's working ok(ish) but there are some issues that I can't find good ways to work around.
I want the unit/vehicle to use ammo:
I can't find a way of making the unit's weapon use actual ammo or give it an ammo slot.
I can't control the vehicle's built-in turret/weapon with lua.
If I try to attach an actual turret-type entity on top of the vehicle then it can fire and use ammo but when the vehicle is moving the turret can only face in 1 of 4 directions, orientation does not work and I cant direct the turret part of the turret to the right direction.
In theory I could use an invisible turret-type as the turret and have a fake display that can be controlled, but if the fake display is a unit then it might target the wrong thing. If the fake display is a vehicle then I would have more control over the direction, but as far as I can tell there's no way to tell what direction a turret if facing or what it's attacking.
Is there some way to detect a turret's current target, or even IF a turret or unit is firing/attacking?
If anyone has ideas on a better solution, or tips and tricks that would be great.