Custom RA unit in OpenRA not working quite right...

Information and discussion for custom maps and mods.
Post Reply
Sm0k383
Posts: 6
Joined: Sun May 03, 2020 5:34 am

Custom RA unit in OpenRA not working quite right...

Post by Sm0k383 »

Hi there,

Another new newb modder sorry to say it, but I did try and fix the issue with a new custom unit myself by following as best I could with the various online tutorials around this topic. First time trying to mod a unit in OpenRA, I have been playing the game for quiet awhile and have done .ini modifications before but I am completely new to this .yaml style modding.

So after many many edits to the following files...

C:\Program Files\OpenRA\mods\ra\rules\ships.yaml
C:\Program Files\OpenRA\mods\ra\sequences\ships.yaml
C:\Program Files\OpenRA\mods\ra\weapons\missiles.yaml


I've got to the stage where I can run OpenRA in a skirmish and build a naval yard and not have the game crash as soon as I click on it.

In essence I followed the following how to on getting started : https://github.com/OpenRA/OpenRA/wiki/C ... a-new-unit

But I can see this document is out of date going by the date of the post and the fact the file/code structure with in the .yaml files are different slightly.

The Jist of the error I'm facing now is when I try to build the new unit "Assault Missile Sub" is that once it finishes building I get a in game voice error of "unable to build more" even if the unit is the very first one built, setting the way point some distance away from the Naval ship yard and having it not obstructed by other units.

What causes this bug? - I do not get any logs relating to the issue, I was when the unit was crashing the game client.. but it's no longer crashing just not building the new unit at all.

Cheers in advance.

abcdefg30
Posts: 641
Joined: Mon Aug 18, 2014 6:00 pm

Re: Custom RA unit in OpenRA not working quite right...

Post by abcdefg30 »

You are missing "BuildAtProductionType: Submarine". Otherwise it can't use the "Exit"s of the sub pen. (That might sound a bit counter-intuitive but allows for example to have the dog only exit at the kennel despite being in the infantry queue.)

Btw, you shouldn't edit the base game files. That will make your install incompatible with other players in multiplayer. I recommend looking at https://github.com/OpenRA/OpenRAModSDK/ ... ng-Started.

Sm0k383
Posts: 6
Joined: Sun May 03, 2020 5:34 am

Re: Custom RA unit in OpenRA not working quite right...

Post by Sm0k383 »

abcdefg30, thank you for the reply. I was just testing for my own amusement to see if I could get anything working.

The line you stated I am missing, isn't I'll paste both the original and modified unit. Maybe it's something else..

MSUB:
Inherits: ^Ship
Inherits@AUTOTARGET: ^AutoTargetAllAssaultMove
Buildable:
Queue: Ship
BuildAtProductionType: Submarine
BuildPaletteOrder: 60
Prerequisites: ~spen, stek, ~techlevel.high
Description: Submerged anti-ground siege unit\nwith anti-air capabilities.\nCan detect other submarines.\n Strong vs Buildings, Ground units, Aircraft\n Weak vs Naval units\n Special Ability: Submerge
Valued:
Cost: 2000
Tooltip:
Name: Missile Submarine
UpdatesPlayerStatistics:
AddToArmyValue: true
Health:
HP: 40000
Armor:
Type: Light
Mobile:
TurnSpeed: 3
Speed: 42
RevealsShroud:
MinRange: 5c0
Range: 8c0
RevealGeneratedShroud: False
RevealsShroud@GAPGEN:
Range: 5c0
Targetable:
TargetTypes: Ground, Water, Ship, Submarine, Repair
RequiresCondition: !underwater
Targetable@UNDERWATER:
TargetTypes: Underwater, Submarine
RequiresCondition: underwater
Cloak:
CloakTypes: Underwater
InitialDelay: 0
CloakDelay: 100
CloakSound: subshow1.aud
UncloakSound: subshow1.aud
CloakedCondition: underwater
Palette: submerged
PauseOnCondition: cloak-force-disabled
GrantConditionOnDamageState@UNCLOAK:
Condition: cloak-force-disabled
ValidDamageStates: Critical
Armament@PRIMARY:
Weapon: SubMissile
LocalOffset: 0,-171,0, 0,171,0
FireDelay: 2
Armament@SECONDARY:
Weapon: SubMissileAA
LocalOffset: 0,-171,0, 0,171,0
FireDelay: 2
AttackFrontal:
TargetFrozenActors: True
ForceFireIgnoresActors: True
SelectionDecorations:
AutoTarget:
InitialStance: HoldFire
InitialStanceAI: ReturnFire
DetectCloaked:
CloakTypes: Underwater
Range: 4c0
RenderDetectionCircle:
Explodes:
Weapon: UnitExplodeSubmarine
EmptyWeapon: UnitExplodeSubmarine
-MustBeDestroyed:
Selectable:
DecorationBounds: 44,44

ASUB:
Inherits: ^Ship
Inherits@AUTOTARGET: ^AutoTargetAllAssaultMove
Buildable:
Queue: Ship
BuildAtProductionType: Submarine
BuildPaletteOrder: 60
Prerequisites: ~syrd, dome, ~techlevel.high
Description: Submerged anti-ground assault unit\nwith anti-air capabilities.\nCan detect other submarines.\n Strong vs Buildings, Ground units, Aircraft\n Weak vs none\n Special Ability: Submerge
Valued:
Cost: 1500
Tooltip:
Name: Assault Submarine
UpdatesPlayerStatistics:
AddToArmyValue: true
Health:
HP: 50000
Armor:
Type: Heavy
Mobile:
TurnSpeed: 3
Speed: 60
RevealsShroud:
MinRange: 5c0
Range: 8c0
RevealGeneratedShroud: False
RevealsShroud@GAPGEN:
Range: 5c0
Targetable:
TargetTypes: Ground, Water, Ship, Submarine, Repair
RequiresCondition: !underwater
Targetable@UNDERWATER:
TargetTypes: Underwater, Submarine
RequiresCondition: underwater
Cloak:
CloakTypes: Underwater
InitialDelay: 0
CloakDelay: 100
CloakSound: subshow1.aud
UncloakSound: subshow1.aud
CloakedCondition: underwater
Palette: submerged
PauseOnCondition: cloak-force-disabled
GrantConditionOnDamageState@UNCLOAK:
Condition: cloak-force-disabled
ValidDamageStates: Critical
Armament@PRIMARY:
Weapon: AllieSubMissile
LocalOffset: 0,-171,0, 0,171,0
FireDelay: 2
Armament@SECONDARY:
Weapon: AllieSubMissileAA
LocalOffset: 0,-171,0, 0,171,0
FireDelay: 2
AttackFrontal:
TargetFrozenActors: True
ForceFireIgnoresActors: True
SelectionDecorations:
AutoTarget:
InitialStance: HoldFire
InitialStanceAI: ReturnFire
DetectCloaked:
CloakTypes: Underwater
Range: 4c0
RenderDetectionCircle:
Explodes:
Weapon: UnitExplodeSubmarine
EmptyWeapon: UnitExplodeSubmarine
-MustBeDestroyed:
Selectable:
DecorationBounds: 44,44

abcdefg30
Posts: 641
Joined: Mon Aug 18, 2014 6:00 pm

Re: Custom RA unit in OpenRA not working quite right...

Post by abcdefg30 »

Oh, I see. You changed the production building from sub pen to ship yard. The ship yard doesn't have exits for submarines afaik. So you can try two things. Either change "BuildAtProductionType" from "Submarine" to "Boat", or to add "Submarine" exits to syrd.

Sm0k383
Posts: 6
Joined: Sun May 03, 2020 5:34 am

Re: Custom RA unit in OpenRA not working quite right...

Post by Sm0k383 »

Will give this a shot! - I'm guessing the last bit is added to the buildings.yaml file?

Sm0k383
Posts: 6
Joined: Sun May 03, 2020 5:34 am

Re: Custom RA unit in OpenRA not working quite right...

Post by Sm0k383 »

Okay, just tried adding Submarine to the structures.yaml for Naval yard, game crashed as soon as I placed the Naval yard down. Log file displays this.

OpenRA engine version release-20200202
Red Alert mod version release-20200202
on map 097201a01fb9137afb12eab8e9ffb0c6fc5ed97f (Dual Cold Front by PizzaAtomica).
Date: 2020-05-04 20:18:26Z
Operating System: Windows (Microsoft Windows NT 6.2.9200.0)
Runtime Version: .NET CLR 4.0.30319.42000
Exception of type `System.NullReferenceException`: Object reference not set to an instance of an object.
at OpenRA.Mods.Common.Traits.Render.ProductionBar.OpenRA.Traits.ITick.Tick(Actor self)
at OpenRA.WorldUtils.DoTimed[T](IEnumerable`1 e, Action`1 a, String text)
at OpenRA.World.Tick()
at OpenRA.Game.InnerLogicTick(OrderManager orderManager)
at OpenRA.Game.LogicTick()
at OpenRA.Game.Loop()
at OpenRA.Game.Run()
at OpenRA.Game.InitializeAndRun(String[] args)
at OpenRA.WindowsLauncher.RunGame(String[] args)

Sm0k383
Posts: 6
Joined: Sun May 03, 2020 5:34 am

Re: Custom RA unit in OpenRA not working quite right...

Post by Sm0k383 »

I think I know what's up.... will try it again soon.

Sm0k383
Posts: 6
Joined: Sun May 03, 2020 5:34 am

Re: Custom RA unit in OpenRA not working quite right...

Post by Sm0k383 »

Sorry forgot to update this. I got it working. I had to add in another line "RenderSprite: msub" otherwise it kept looking for "asub" in numerous other places.

Post Reply