Page 1 of 1

Adding a new Vehicle to an existing Country

Posted: Sat Oct 16, 2010 1:01 pm
by raminator
Adding a new Vehicle to OpenRa is pretty easy.

First of all you need Graphics for your new unit. You can simply extract one of the units and an icon from conquer.mix using xcc mixer or you create yourself some new gfx.
I extracted 3TNK.shp and gave it a new turret (3dsm+xcc+ps...) + 1tnkicon.shp.

Now you need to rename them. e.g. 5tnk.shp and 5tnkicon.shp
Place both files in "OpenRA\mods\ra\bits" folder.

Now open vehicles.yaml ("OpenRA\mods\ra\rules") and search for "1tnk".
Copy all the related code and paste it at the end of vehicles.yaml.
Now change this code to fit your needs and change 1tnk to 5tnk.

That´s what i got.

Code: Select all

	Inherits: ^Tank
		Queue: Vehicle
		BuildPaletteOrder: 60
		Prerequisites: weap
		Owner: soviet
		Cost: 700
		Name: Light Tank
		Description: Soviet Light Tank, good for scouting.\n  Strong vs Light Vehicles\n  Weak vs Tanks, Aircraft
		HP: 350
		Type: Heavy
		Speed: 7
		Range: 4
		ROT: 5
		PrimaryWeapon: 25mm
		Recoil: 2
		Weapon: UnitExplodeSmall
		EmptyWeapon: UnitExplodeSmall
		HuskActor: 5TNK.Husk
		Bounds: 30,30

	Inherits: ^Husk
		Name: Husk (Soviet Light Tank)
		Image: 5tnk
		Anim: turret
		Spread: 3,3
		Speed: 6
		AnimKey: turret
Now you need to add a sequence for your new unit.
Open sequences.yaml from "OpenRA\mods\ra" and copy the code from 3TNK paste it and change the entry´s name to 5tnk.

Code: Select all

		Start: 0
		Facings: 32
		Start: 32
		Facings: 32
save everything and your done.

Posted: Sat Oct 16, 2010 8:22 pm
by chrisf
This is really cool. For more polish though, you need to clone the husk too -- when it dies, it currently turns into a 2tnk husk! You can find the husk definitions near the bottom of vehicles.yaml

Posted: Mon Mar 07, 2011 1:48 pm
by Holy_Master
thank you for this tutorial i thing i should start to learn from this. :D

can i use another file format other than shp[ra] or shp[td]?. and custom palette for each shp?

Posted: Mon Mar 07, 2011 2:03 pm
by Sleipnir
We only support shp[ra] and shp[td] for units at this point. You can use a custom palette, but these custom palettes won't support player-colour remapping.

Posted: Tue Mar 08, 2011 3:12 pm
by Holy_Master
today it try to reduce build time on the building but i can't find "build speed" code in rules anymore, and it possible if i want to increase game speed by code because it too slow. :\

Posted: Wed Mar 09, 2011 11:52 am
by DvD
What's with people wanting faster gameplay these days?

If anything, we need more time to think, not less. Faster gameplay just takes the S out of RTS.

Posted: Wed Mar 09, 2011 12:32 pm
by Holy_Master
but it should not slow as Turnbase Stategy,since it's real time that's mean player need to think about the best stategy in limit time and make it happen before your opponent. i may like fast RTS but doesn't mean you can end the game in 3 second like what c&c3 or ra3 did.

and many people want to design stategy game like chess but they don't realize the game will fun to play or not.

and long time no see DVD

Posted: Mon Jul 02, 2012 11:17 pm
by UPVeNoM
Recently attempted to replicate a jeep by using the same method and I keep getting this error when I create a game and yet the icon is in the right place (bits folder) along with its shp for the actual vehicle. I know I've done something wrong but being new to this I cannot pin point where I've gone wrong. :?

And yeah, necro post but I thought it was probably something small that it wouldn't need a new thread.

Code: Select all

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: File not found: lrpvicon
File name: 'lrpvicon'
   at OpenRA.FileFormats.FileSystem.OpenWithExts(String filename, String[] exts)
   at OpenRA.Graphics.SpriteLoader.LoadSprites(String filename)
   at OpenRA.FileFormats.Cache`2.get_Item(T key)
   at OpenRA.Graphics.SpriteLoader.LoadAllSprites(String filename)
   at OpenRA.Mods.RA.Widgets.BuildPaletteWidget.<BuildPaletteWidget>m__2D3&#40;ActorInfo u&#41;
   at System.Linq.Enumerable.ToDictionary&#91;TSource,TKey,TElement&#93;&#40;IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer&#41;
   at System.Linq.Enumerable.ToDictionary&#91;TSource,TKey,TElement&#93;&#40;IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector&#41;
   at OpenRA.Mods.RA.Widgets.BuildPaletteWidget..ctor&#40;World world, WorldRenderer worldRenderer&#41;
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeConstructor&#40;Object&#91;&#93; args, SignatureStruct& signature, IntPtr declaringType&#41;
   at System.RuntimeMethodHandle.InvokeConstructor&#40;Object&#91;&#93; args, SignatureStruct signature, RuntimeTypeHandle declaringType&#41;
   at System.Reflection.RuntimeConstructorInfo.Invoke&#40;BindingFlags invokeAttr, Binder binder, Object&#91;&#93; parameters, CultureInfo culture&#41;
   at OpenRA.ObjectCreator.CreateUsingArgs&#40;ConstructorInfo ctor, Dictionary`2 args&#41;
   at OpenRA.ObjectCreator.CreateObject&#91;T&#93;&#40;String className, Dictionary`2 args&#41;
   at OpenRA.WidgetLoader.NewWidget&#40;String widgetType, WidgetArgs args&#41;
   at OpenRA.WidgetLoader.LoadWidget&#40;WidgetArgs args, Widget parent, MiniYamlNode node&#41;
   at OpenRA.WidgetLoader.LoadWidget&#40;WidgetArgs args, Widget parent, MiniYamlNode node&#41;
   at OpenRA.WidgetLoader.LoadWidget&#40;WidgetArgs args, Widget parent, String w&#41;
   at OpenRA.Widgets.Ui.OpenWindow&#40;String id, WidgetArgs args&#41;
   at OpenRA.Game.OpenWindow&#40;World world, String widget&#41;
   at OpenRA.Mods.RA.OpenWidgetAtGameStart.WorldLoaded&#40;World world&#41;
   at OpenRA.World..ctor&#40;Manifest manifest, Map map, OrderManager orderManager&#41;
   at OpenRA.Game.StartGame&#40;String mapUID, Boolean isShellmap&#41;
   at OpenRA.Network.UnitOrders.ProcessOrder&#40;OrderManager orderManager, World world, Int32 clientId, Order order&#41;
   at OpenRA.Network.OrderManager.TickImmediate&#40;&#41;
   at OpenRA.Game.<Tick>c__AnonStorey39.<>m__96&#40;&#41;
   at OpenRA.Sync.<CheckSyncUnchanged>c__AnonStorey30.<>m__65&#40;&#41;
   at OpenRA.Sync.CheckSyncUnchanged&#91;T&#93;&#40;World world, Func`1 fn&#41;
   at OpenRA.Sync.CheckSyncUnchanged&#40;World world, Action fn&#41;
   at OpenRA.Game.Tick&#40;OrderManager orderManager&#41;
   at OpenRA.Game.Tick&#40;OrderManager orderManager, Viewport viewPort&#41;
   at OpenRA.Game.Run&#40;&#41;
   at OpenRA.Program.Run&#40;String&#91;&#93; args&#41;
   at OpenRA.Program.Main&#40;String&#91;&#93; args&#41;
Cheers for any insight into it.

Edit: Fixed it somehow, might of been miss-pelt it. :oops: