There's three (3) essential parts to create a new unit.
1) Modeling/Texturing: this includes getting a simple object and giving it features. Once you have your object and you want to texture it look at this tutorial: viewtopic.php?f=9&t=10612. Once you're finished with that part move along to this tutorial: viewtopic.php?f=14&t=13034. They're both very good tutorials and not outdated so there's no excuse there. *Your finished myunit.s3o should go into your "Objects3d" folder of your mod*
*Do NOT go on to step 2 if you have not completed step 1*
2) FBI & Tags: this part is where you define your unit and tell it what it CAN do. I won't go over all of the tags because there is a beautiful document with those already here for us (http://spring.clan-sy.com/wiki/Units:FBI). All of these tags are very thoroughly explained. *If your model is a .s3o file your objectName tag should look like this: objectName=myunit.s3o* If you're a complete noob and you did not understand what an FBI is then read along, otherwise you may move on to step 3. An FBI is just a simple text (.txt) with an .fbi ending instead of .txt. A simple application like notepad will suffice. So, when you finish your myunit.fbi file you should put it in the "Units" folder of your mod.
3) Coding: this is where players see whether your mod is worth their time. This defines HOW your unit does what it does. You will need Scriptor. There's one thing you MUST check before compiling any script. When you open Scriptor select the menu "Script," and click "Settings." Once there, make sure your Linear constant is set to 65536.000000 and your Angular constant is set to 182.000000. Since most of what the newbie "modders" are doing nowadays is making a blob that shoots a laser or a projectile I took the liberty to go ahead and comment the Arm Stumpy script from BA 6.31 here. EVERY SINGLE ONE OF THOSE FUNCTIONS IS ESSENTIAL FOR YOUR UNIT TO WORK! Once you are done with your script you may go ahead and compile it. Make sure it's saved to the "Scripts" folder of your mod.
*The model, fbi, and script names MUST all be the same!!!*
Now that I have my unit, how can I use it in game? This is the easiest part.
1) First, you must define it in the Armor file. Just open the Armor text file and add your unit where it first best. Eg: A level 2 plane fighter should go under the [L2FIGHTERS] group. All you need to do is type the model's name and an armor value (always 99?). So we can go ahead and type in myunit = 99; *Do NOT forget to put a semilcolon (;)!*
2) Unless your new unit is the Commander, you want a factory or another unit to be able to build this unit. For this, we go into the SIDEDATE.TDF file inside the "gamedate" folder of your mod. You can open and edit this file with Notepad or a similar application. So lets say I just made a unit for the Core faction and I want my Commander to be able to build it. I will go under the group [CORECOM] and add my unit in there. The easiest thing to do is to add it to the end of the line, that was we don't have to retype numbers. So now (using BA 6.31) your [CORECOM] group should have a new canbuild26=myunit; Once you are done with this you may save it and close all that.
Your new unit is now complete and ready to be tested. If you want to share this exciting new addition with your buddies you should compile the mod. How to do this? I've found that the most compatible format for testing is .sdz, which is just a simple Zip file. So, open your Mod folder and put everything in it into a new Zip file. Once you have all the folders in the Zip file you should rename it so it reads "MyMod.sdz" instead of "MyMod.zip."
You are now ready to share this with your friends and play with your new laser-shooting blob.
I hope this helps all of you beginners. If you have any more questions you may post them here.
Getting a Finished Model in Game
Moderator: Moderators
- Pressure Line
- Posts: 2283
- Joined: 21 May 2007, 02:09
Re: Getting a Finished Model in Game
technically SmokeUnit, RockUnit, HitByWeapon and SetMaxReloadTime are optional (as long as you dont need/want the functions that they give the unit, SetMaxReloadTime is mainly for units with multiple weapons of differing reload times)
afaik Sweetspot is where you have to click on the unit to select it, and serves no other function, but i may well be wrong.
if you have no need for firing animation (recoil etc), sfx emission or anything else (firepoint switching for example) you dpont need this at all, or alternatively you can use ShotX which is called when each round of a burst is fired (flash emg for ex)
wrong. this tells spring where to measure the heading and pitch parameters in AimWeaponX(heading,pitch) from (using Aim/AimFrom/Fire/Query WeaponX is recommended, otherwise you end up with a mixture of AimPrimary type functions and AimWeapon4 functions which is sloppy [and confusing, esp if english isnt your native language])AimFromPrimary(piecenum) // tells Spring which piece to move when aiming primary weapon
wrong again. that is defined at the line "emit-sfx smoketype from base;" in SmokeUnit in this script.SweetSpot(piecenum) // determines which piece smoke is going to emit from or other units will fire at
afaik Sweetspot is where you have to click on the unit to select it, and serves no other function, but i may well be wrong.
nope, that is covered in HitByWeapon. Rockunit is when the unit is shooting.RockUnit(anglex, anglez) // if your unit is shot this determines which way it should rock
should read "Is called when Weapon1(primary) is fired"FirePrimary() // fire primary weapon
if you have no need for firing animation (recoil etc), sfx emission or anything else (firepoint switching for example) you dpont need this at all, or alternatively you can use ShotX which is called when each round of a burst is fired (flash emg for ex)
Last edited by Pressure Line on 25 Jul 2008, 08:33, edited 2 times in total.
Re: Getting a Finished Model in Game
I'm fairly certain sweetspot is unimplemented in spring. IIRC it was where enemy units aimed on the unit in ta.
- Pressure Line
- Posts: 2283
- Joined: 21 May 2007, 02:09
Re: Getting a Finished Model in Game
you may want to add a comment to RestoreAfterDelay, and say that it is what is used to turn/move pieces back o their rest positions.
its not strictly necessary however (although it or something that does the same thing is if you want this functionality in your unit) the static defenses (llt hlt etc) in *A mods tend not to use this
its not strictly necessary however (although it or something that does the same thing is if you want this functionality in your unit) the static defenses (llt hlt etc) in *A mods tend not to use this
Re: Getting a Finished Model in Game
Sweetspot isn't read by Spring. Back in OTA times, it indeed was used to determine where enemy units will aim when shooting at this unit (and so some tricks were possible, like randomly moving sweetspot piece around so enemy often misses, making for an 'evasive' unit of sorts).
RestoreAfterDelay() is a completely 'user' function. That is, it is not called by the engine, but only by other COB fucntions (and so can be named whatever you wish, I personally like to call it RestoreTurrets(). Same for SmokeUnit() - you call that yourself (usually it's started in Create(), and you can name it any way you like).
ShotX is different from FireWeaponX in more that just behaviour with burts-fire weapons. Any calls to show piece; and hide piece; in FireWeapon() will be treated like those for the muzzleflare (and a default flare sfx will be automatically created at that point), while ShotX() does no such things.
RestoreAfterDelay() is a completely 'user' function. That is, it is not called by the engine, but only by other COB fucntions (and so can be named whatever you wish, I personally like to call it RestoreTurrets(). Same for SmokeUnit() - you call that yourself (usually it's started in Create(), and you can name it any way you like).
ShotX is different from FireWeaponX in more that just behaviour with burts-fire weapons. Any calls to show piece; and hide piece; in FireWeapon() will be treated like those for the muzzleflare (and a default flare sfx will be automatically created at that point), while ShotX() does no such things.
- Pressure Line
- Posts: 2283
- Joined: 21 May 2007, 02:09
Re: Getting a Finished Model in Game
i wasnt going to get into that, but yeah thats also true. i was more worried about the blatant 'wrongs' in the script comments
Re: Getting a Finished Model in Game
only function needed for the unit to work is Create()