Problem: Initial movement states

S44 Version: Pre-1.59 Morgenrote
Spring 88.0 (OMP)
OS: Linux 2.6.32-220.13.1.el6.x86_64 #1 SMP

Description of problem:
The initial movement state of armed units is not inherited from factories.

Steps to Reproduce:

  1. Select “Infantry Training & Housing Facility” or any other factory.
  2. Set the initial movement state to “Roam”.
  3. Build platoon or any other armed unit.
  4. When unit is built select it.

Actual results:
The initial movement state is “Hold Position”

Expected results:
The initial movement state should be “Roam”

Additional information:
When I disable cmd_holdpos.lua it works.

File: /LuaUI/Widgets/cmd_holdpos.lua
name = “Hold position v2”,
desc = "Sets all units without firearcs (and don’t fly) to Hold Position by default.

Questions:
Is this Script a Bug or a Feature ?
If it is a Feature. Why should all armed units holdpos ?

It’s a feature, not a bug :slight_smile:

Nearly all players set their factories to Hold Pos anyway, because S44 units behave much better that way. Limited fire arcs and slow turret turn rates don’t work well with Roam and Maneuver. So the widget was added to automate the command that was given in 99% of games anyway.

It does cause problems sometimes though - short ranged US rifle infantry, for example, prefer to stand around and get shot rather than move in.

Suggestion:
-Change the UnitDef files.
-Remove widget

Example:
Factories moveState = 0,” (MOVESTATE_HOLDPOS)
[b]Builder/bmoveState = 1,” (MOVESTATE_MANEUVER)

Advantage:
The same default behaviour as before.
You can change the moveState state in factory.

The biggest reason to use Hold position is that whenever the Line of Fire is blocked for a unit on manouver it will try to go against the enemy unit to gain free Line of Fire.

Say there is a hill between you and the enemy. If the unit is on manouver it will try to go against the enemy behind the hill if it is in range. Even if there are other targets that are not behind the hill it will “chase” the unit behind the hill and drive around or over the hill to attack the target behind the hill thus exposing itself to enemy fire while it drives over the hill.

I definitely understand your arguments. But sometimes it is usefull to use
Maneuver or Roam. Especially when your are using mixed units(short and longrange).
So i think the best option is to let the user choose.

In my understanding these could be achieved by changing the unitdefs Files.
Without any sideeffects, so that the default behavoiur would not change.

The biggest Problem i see is that there are many Files who have to be changed.
A possible solution could be class based approch like in weapondefs_pre.lua.
So we can use inheritance. What would make it really easy to changed units.

I have tried it. By “creating” /gamedata/unitdefs_pre.lua
copy the content from /gamedata/weapondefs_pre.lua and changing a few
Supply_Structures to “classes”. It seems to be working.

This is what i did:
(Sorry i didnt get to manage to create a Mutator)

Removed:
/buildings/*SIDE"Storage.fbi
/buildings/*Resource.fbi
/buildings/*SupplyDepot.fbi

Created:
/gamedata/unitdefs_pre.lua and cut&paste the content from weapondefs_pre in there
/units/storage.lua

I’m sorry for the bad copy and paste but i have very limited knowledge about Lua and metatables.
I didnt really understand how the last part of the script works(to expose the class).

What do you think ?

I think my preferred solution would be to set all units to hold position in unitdefs_post.lua, unless the tag is already set in the def file, then set it only on those units which behave better on maneuver.