Adding a new Vehicle to an existing Country

[Tutorial]

Information and discussion for custom maps and mods.
Post Reply
raminator
Posts: 106
Joined: Tue Mar 15, 2005 6:31 pm
Location: Stuttgart

Adding a new Vehicle to an existing Country

Post by raminator » Sat Oct 16, 2010 1:01 pm

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

5TNK:
	Inherits: ^Tank
	Buildable:
		Queue: Vehicle
		BuildPaletteOrder: 60
		Prerequisites: weap
		Owner: soviet
	Valued:
		Cost: 700
	Tooltip:
		Name: Light Tank
		Description: Soviet Light Tank, good for scouting.\n  Strong vs Light Vehicles\n  Weak vs Tanks, Aircraft
	Health:
		HP: 350
	Armor:
		Type: Heavy
	Mobile:
		Speed: 7
	RevealsShroud:
		Range: 4
	Turreted:
		ROT: 5
	AttackTurreted:
		PrimaryWeapon: 25mm
		Recoil: 2
	RenderUnitTurreted:
	AutoTarget:
	Explodes:
		Weapon: UnitExplodeSmall
		EmptyWeapon: UnitExplodeSmall
	LeavesHusk:
		HuskActor: 5TNK.Husk
	Selectable:
		Bounds: 30,30

5TNK.Husk:
	Inherits: ^Husk
	Tooltip:
		Name: Husk (Soviet Light Tank)
	RenderUnit:
		Image: 5tnk
	ThrowsParticle@turret:
		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

5tnk:
	idle:
		Start: 0
		Facings: 32
	turret:
		Start: 32
		Facings: 32
save everything and your done.
Attachments
newunit.png
testing
newunit.png (10.65 KiB) Viewed 5767 times
Last edited by raminator on Thu May 19, 2011 9:10 am, edited 1 time in total.

chrisf
Posts: 246
Joined: Mon Sep 06, 2010 4:59 am

Post by chrisf » Sat Oct 16, 2010 8:22 pm

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

User avatar
Holy_Master
Posts: 62
Joined: Fri Nov 21, 2003 10:04 am

Post by Holy_Master » Mon Mar 07, 2011 1:48 pm

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?

User avatar
Sleipnir
Posts: 784
Joined: Wed Apr 10, 2002 11:52 pm
Contact:

Post by Sleipnir » Mon Mar 07, 2011 2:03 pm

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.

User avatar
Holy_Master
Posts: 62
Joined: Fri Nov 21, 2003 10:04 am

Post by Holy_Master » Tue Mar 08, 2011 3:12 pm

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. :\

DvD
Posts: 14
Joined: Wed Jan 26, 2011 6:45 pm

Post by DvD » Wed Mar 09, 2011 11:52 am

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.

User avatar
Holy_Master
Posts: 62
Joined: Fri Nov 21, 2003 10:04 am

Post by Holy_Master » Wed Mar 09, 2011 12:32 pm

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

UPVeNoM
Posts: 1
Joined: Mon Jul 02, 2012 2:41 pm

Post by UPVeNoM » Mon Jul 02, 2012 11:17 pm

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:

Post Reply