[ X ]
Adding a new Vehicle to an existing Country
[Tutorial]
Post new topic   Reply to topic Page 1 of 1
View previous topic :: View next topic  
Author Message
raminator
Level: 82



Position: Registered User
Joined: 15 Mar 2005
Posts: 292
Kel: 268  [ Donate ]

Online Status: Offline
PostPosted: Sat Oct 16, 2010 1:01 pm    Post subject: Adding a new Vehicle to an existing Country Reply with quote

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:
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:
5tnk:
   idle:
      Start: 0
      Facings: 32
   turret:
      Start: 32
      Facings: 32


save everything and your done.


Attachment:

newunit.png

 Filename:  newunit.png
 Description:  testing
10.65 KB :: Viewed 2181 Time(s) :: [ Download ]



Last edited by raminator on Thu May 19, 2011 9:10 am; edited 1 time in total
Back to top
View user's profile Find all posts by raminator Send private message MSN Messenger ICQ Number
chrisf
Level: 53


Position: Moderator
Joined: 06 Sep 2010
Posts: 243
Kel: 256  [ Donate ]

Online Status: Offline
PostPosted: Sat Oct 16, 2010 8:22 pm  Reply with quote

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
Back to top
View user's profile Find all posts by chrisf Send private message Send e-mail ICQ Number
Holy_Master
Level: 87



Position: Registered User
Joined: 21 Nov 2003
Posts: 333
Kel: 369  [ Donate ]

Online Status: Offline
PostPosted: Mon Mar 07, 2011 1:48 pm  Reply with quote

thank you for this tutorial i thing i should start to learn from this. Grin

can i use another file format other than shp[ra] or shp[td]?. and custom palette for each shp?
Back to top
View user's profile Find all posts by Holy_Master Send private message ICQ Number
Sleipnir
Level: 150



Position: Administrator
Joined: 10 Apr 2002
Posts: 3768
Kel: 3251  [ Donate ]

Online Status: Online
PostPosted: Mon Mar 07, 2011 2:03 pm  Reply with quote

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.
Back to top
View user's profile Find all posts by Sleipnir Send private message Send e-mail Visit poster's website MSN Messenger ICQ Number
Holy_Master
Level: 87



Position: Registered User
Joined: 21 Nov 2003
Posts: 333
Kel: 369  [ Donate ]

Online Status: Offline
PostPosted: Tue Mar 08, 2011 3:12 pm  Reply with quote

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. Worried
Back to top
View user's profile Find all posts by Holy_Master Send private message ICQ Number
DvD
Level: 44


Position: Registered User
Joined: 26 Jan 2011
Posts: 2
Kel: 3  [ Donate ]

Online Status: Offline
PostPosted: Wed Mar 09, 2011 11:52 am  Reply with quote

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.
Back to top
View user's profile Find all posts by DvD Send private message ICQ Number
Holy_Master
Level: 87



Position: Registered User
Joined: 21 Nov 2003
Posts: 333
Kel: 369  [ Donate ]

Online Status: Offline
PostPosted: Wed Mar 09, 2011 12:32 pm  Reply with quote

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
Back to top
View user's profile Find all posts by Holy_Master Send private message ICQ Number
UPVeNoM
Level: 26


Position: Registered User
Joined: 02 Jul 2012
Posts: 1
Kel: 1  [ Donate ]

Online Status: Offline
PostPosted: Mon Jul 02, 2012 11:17 pm  Reply with quote

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. Confused

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


Code:
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(ActorInfo u)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
   at OpenRA.Mods.RA.Widgets.BuildPaletteWidget..ctor(World world, WorldRenderer worldRenderer)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
   at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at OpenRA.ObjectCreator.CreateUsingArgs(ConstructorInfo ctor, Dictionary`2 args)
   at OpenRA.ObjectCreator.CreateObject[T](String className, Dictionary`2 args)
   at OpenRA.WidgetLoader.NewWidget(String widgetType, WidgetArgs args)
   at OpenRA.WidgetLoader.LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
   at OpenRA.WidgetLoader.LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
   at OpenRA.WidgetLoader.LoadWidget(WidgetArgs args, Widget parent, String w)
   at OpenRA.Widgets.Ui.OpenWindow(String id, WidgetArgs args)
   at OpenRA.Game.OpenWindow(World world, String widget)
   at OpenRA.Mods.RA.OpenWidgetAtGameStart.WorldLoaded(World world)
   at OpenRA.World..ctor(Manifest manifest, Map map, OrderManager orderManager)
   at OpenRA.Game.StartGame(String mapUID, Boolean isShellmap)
   at OpenRA.Network.UnitOrders.ProcessOrder(OrderManager orderManager, World world, Int32 clientId, Order order)
   at OpenRA.Network.OrderManager.TickImmediate()
   at OpenRA.Game.<Tick>c__AnonStorey39.<>m__96()
   at OpenRA.Sync.<CheckSyncUnchanged>c__AnonStorey30.<>m__65()
   at OpenRA.Sync.CheckSyncUnchanged[T](World world, Func`1 fn)
   at OpenRA.Sync.CheckSyncUnchanged(World world, Action fn)
   at OpenRA.Game.Tick(OrderManager orderManager)
   at OpenRA.Game.Tick(OrderManager orderManager, Viewport viewPort)
   at OpenRA.Game.Run()
   at OpenRA.Program.Run(String[] args)
   at OpenRA.Program.Main(String[] args)


Cheers for any insight into it.

Edit: Fixed it somehow, might of been miss-pelt it. Embarassed
Back to top
View user's profile Find all posts by UPVeNoM Send private message ICQ Number
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1