Transform units

using conditions and upgrades

Information and discussion for custom maps and mods.
Post Reply
Remuneration
Posts: 36
Joined: Sun Mar 09, 2014 3:49 pm

Transform units

Post by Remuneration » Wed Jul 25, 2018 10:55 pm

I have a unit transformer, it must to transform to transformedunit1 or transformedunit2 conditions by build upgrades. its looks must be changed after it.

When I trying to realise this, game is crash:

Code: Select all

OpenRA engine version release-20180307
Red Alert 2 mod version release-20180307
on map 1a848cb4377fc30745fe9ada0914e29d05dc5b8b (Arctic Circle by Westwood Studios).
Date: 2018-07-25 22:24:55Z
Operating System: Windows (Microsoft Windows NT 6.2.9200.0)
Runtime Version: .NET CLR 4.0.30319.42000
Exception of type `OpenRA.YamlException`: ActorInfo("transformedunit1") failed to initialize because of the following:
Missing:
OpenRA.Traits.IMouseBoundsInfo 
Unresolved:
OpenRA.Mods.Common.Traits.TooltipInfo: { OpenRA.Traits.IMouseBoundsInfo }

   в OpenRA.ActorInfo.TraitsInConstructOrder() в c:\games\RTS\OPENRA-ra2\engine\OpenRA.Game\GameRules\ActorInfo.cs:строка 131
   в OpenRA.Actor..ctor(World world, String name, TypeDictionary initDict) в c:\games\RTS\OPENRA-ra2\engine\OpenRA.Game\Actor.cs:строка 98
   в OpenRA.World.CreateActor(Boolean addToWorld, String name, TypeDictionary initDict) в c:\games\RTS\OPENRA-ra2\engine\OpenRA.Game\World.cs:строка 252
   в OpenRA.World.CreateActor(String name, TypeDictionary initDict) в c:\games\RTS\OPENRA-ra2\engine\OpenRA.Game\World.cs:строка 247
   в OpenRA.Mods.Common.Traits.Production.<>c__DisplayClass5.<DoProduction>b__4(World w) в c:\games\RTS\OPENRA-ra2\engine\OpenRA.Mods.Common\Traits\Production.cs:строка 91
   в OpenRA.World.Tick() в c:\games\RTS\OPENRA-ra2\engine\OpenRA.Game\World.cs:строка 359
   в OpenRA.Game.InnerLogicTick(OrderManager orderManager) в c:\games\RTS\OPENRA-ra2\engine\OpenRA.Game\Game.cs:строка 605
   в OpenRA.Game.LogicTick() в c:\games\RTS\OPENRA-ra2\engine\OpenRA.Game\Game.cs:строка 629
   в OpenRA.Game.Loop() в c:\games\RTS\OPENRA-ra2\engine\OpenRA.Game\Game.cs:строка 759
   в OpenRA.Game.Run() в c:\games\RTS\OPENRA-ra2\engine\OpenRA.Game\Game.cs:строка 799
   в OpenRA.Game.InitializeAndRun(String[] args) в c:\games\RTS\OPENRA-ra2\engine\OpenRA.Game\Game.cs:строка 253
   в OpenRA.Program.Main(String[] args) в c:\games\RTS\OPENRA-ra2\engine\OpenRA.Game\Support\Program.cs:строка 37
How to write use conditions and upgrades to make this workabe?

Code: Select all

transformer:
	Tooltip:
		Name: transformer
	Production:
		Produces: transformations
	Mobile:
		Speed: 10
	Health:
		HP: 1500
	Exit:
	RevealsShroud:
		Range: 4c0
	-Guard:
	-AttackFrontal:
	QuantizeFacingsFromSequence:
		Sequence: stand
	WithProductionOverlay@WELDING:
		Sequence: transformprocess
	GrantConditionOnPrerequisite@transformedunit1:
		Prerequisites: transformedunit1
		Condition: transformedunit1
	GrantConditionOnPrerequisite@transformedunit2:
		Prerequisites: transformedunit2
		Condition: transformedunit2
	RenderSprites@transformedunit1:
		Image: transformedunit1
		RequiresCondition: transformedunit1
	RenderSprites@transformedunit2:
		Image: transformedunit2
		RequiresCondition: transformedunit2

transformedunit1:
	AlwaysVisible:
	Tooltip:
		Name: transformedunit1
	Buildable:
		BuildPaletteOrder: 50
		Prerequisites: transformer
		Queue: transformations
		BuildDuration: 590
		BuildDurationModifier: 40
		Description: transformedunit1
	Valued:
		Cost: 50
	RenderSprites:
		Image: transformedunit1
	ProvidesPrerequisite@upgradename:

transformedunit2:
	AlwaysVisible:
	Tooltip:
		Name: transformedunit2
	Buildable:
		BuildPaletteOrder: 50
		Prerequisites: transformer
		Queue: transformations
		BuildDuration: 590
		BuildDurationModifier: 40
		Description: transformedunit2
	Valued:
		Cost: 50
	RenderSprites:
		Image: transformedunit2
	ProvidesPrerequisite@upgradename:
Last edited by Remuneration on Thu Jul 26, 2018 9:48 am, edited 1 time in total.

User avatar
MustaphaTR
Posts: 184
Joined: Mon Aug 04, 2014 6:38 am
Location: Kastamonu, Turkey

Re: Transform units

Post by MustaphaTR » Thu Jul 26, 2018 7:29 am

You need Interactable or Selectable on the unit.

Remuneration
Posts: 36
Joined: Sun Mar 09, 2014 3:49 pm

Re: Transform units

Post by Remuneration » Thu Jul 26, 2018 9:50 am

When I add Selectabe trait nothing changed, crash is hapend when transformedunit1 upgrade is finished

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

Re: Transform units

Post by abcdefg30 » Thu Jul 26, 2018 11:03 am

Try adding "Interactable:" to "transformedunit1" and "transformedunit2" (like Mustapha suggested, probably a misunderstanding here).

Remuneration
Posts: 36
Joined: Sun Mar 09, 2014 3:49 pm

Re: Transform units

Post by Remuneration » Thu Jul 26, 2018 12:21 pm

Did it, there is no crash now, but RequiresCondition: trait is not work, and unit use transformedunit1 sprites before upgrade...

hmm... add transformedunit2 code, second GrantConditionOnPrerequisite and second RenderSprites traits to transformer, and now have another crach: "Actor transformer has multiple traits of type `OpenRA.Mods.Common.Traits.Render.RenderSprites`"

i'm in confuse, how to use logic of conditions to change sprites, name, speed, armament e.t.c. of unit?

User avatar
MustaphaTR
Posts: 184
Joined: Mon Aug 04, 2014 6:38 am
Location: Kastamonu, Turkey

Re: Transform units

Post by MustaphaTR » Thu Jul 26, 2018 12:33 pm

You need ConditionManager on the actor for conditions to work.

Remuneration
Posts: 36
Joined: Sun Mar 09, 2014 3:49 pm

Re: Transform units

Post by Remuneration » Thu Jul 26, 2018 5:29 pm

Add ConditionManager on the actor, but nothing changed

User avatar
Graion Dilach
Posts: 223
Joined: Fri May 15, 2015 5:57 pm

Re: Transform units

Post by Graion Dilach » Fri Jul 27, 2018 2:27 pm

I think you're lacking a lot of basic functional traits to get your units working. Do note that all the default units all have a template to inherit from.

Remuneration
Posts: 36
Joined: Sun Mar 09, 2014 3:49 pm

Re: Transform units

Post by Remuneration » Sat Jul 28, 2018 9:36 am

1in1 nothing changed without inherits too.
"unit use transformedunit1 sprites before upgrade..."

User avatar
Nolt
Posts: 38
Joined: Fri Jun 19, 2015 10:04 pm
Location: Chile
Contact:

Re: Transform units

Post by Nolt » Mon Jul 30, 2018 4:26 am

To be honest Graion nailed it with his answer, you need to either list EVERY SINGLE TRAIT needed to make the action function or one of the basic inheritances that do the same, see this example, the first thing you see is the basic actor type inheritance, its gonna tell the unit basic things like death animations or how much space it uses on a cell. (Inherits: ^Soldier)

Code: Select all

E1:
	Inherits: ^Soldier
	Inherits@AUTOTARGET: ^AutoTargetGroundAssaultMove
	Buildable:
		Queue: Infantry
		BuildAtProductionType: Soldier
		BuildPaletteOrder: 10
		Prerequisites: ~barracks, ~techlevel.infonly
		Description: General-purpose infantry.\n  Strong vs Infantry\n  Weak vs Vehicles, Aircraft
	Selectable:
		Class: E1
	Valued:
		Cost: 100
Also, you do not have any trait that could link up the transformation on condition, just a few provides prerequisites on the main actor that are not linked to anything, afaik the vanilla OpenRA codebase does not include a transform on condition trait, (unlike Graions fork, which does)

Remuneration
Posts: 36
Joined: Sun Mar 09, 2014 3:49 pm

Re: Transform units

Post by Remuneration » Mon Jul 30, 2018 9:34 am

Yes, of course I tested with "Inherits: ^Animal" which inverit "^Soldier" and nothing changed...
" vanilla OpenRA codebase does not include a transform on condition trait"
What did it mean?
"RequiresCondition: transformedunit1" is not enoth?
maybe i need to add something like "ProvidesCondition@upgradename:" to transformedunit1&2?
Link from upgrades to buildings in vanilla d2k mod is work, i tryed repit same way...

Maybe it will be more understandable if someone show this functional on existing game unit? RA2 dog, like exaple - how can I change it name, or it sprites using upgrade?

Post Reply