How do I add unit descriptions?

Everything about mods can be found here.

Moderator: Morax

How do I add unit descriptions?

Postby Tanksy » 14 Jan 2017, 17:31

It seems simply copying everyone else isn't working. I've got a file in hook/lua/ui/help called unitdescriptions.lua with an entry such as:

Code: Select all
Description['TANKSYUNIT'] = "Test."


which is how BlackOps have entries in their file. Frustratingly, in-game this doesn't show up. I compared with a BlackOps unit ".bp" file, and they have;

Code: Select all
Description = "<LOC unitname_desc> Unit Name"


And further on in the file;

Code: Select all
HelpText = "<LOC unitname_help> Unit Name"
.

I tried to look into LOC, and have a file in hook/loc/US/ called strings_db.lua, with an entry such as:

Code: Select all
TANKSYUNIT_desc="Test."
TANKSYUNIT_help="Test."


and then in my own unit's .bp file I put the Desc and Help to use "<LOC TANKSYUNIT_desc>" and "<LOC TANKSYUNIT_help>" in the appropriate places. In-game is still no dice. "Description" changes the tiny little box that appears when you hover over the icon of the unit, but there is still no descriptive white-text appearing in the box underneath the abilities.

Further studying BlackOps' unitdescriptions.lua file, half of their entries begin with "<LOC Unit_Description_20000##>", so I have done just that. Now my unitdescriptions file reads:

Code: Select all
Description['TANKSYUNIT'] = "<LOC Unit_Description_Tanksy>Test."


and my strings_db.lua file has been updated to have a "Unit_Description_Tanksy="Test." field.

Why is nothing working for me, but even less effort works fine for everyone else? What am I doing wrong, when I've been carefully making sure to be doing the same as everybody else?
Tanksy
Avatar-of-War
 
Posts: 75
Joined: 31 Aug 2016, 11:39
Has liked: 1 time
Been liked: 14 times

Re: How do I add unit descriptions?

Postby Sprouto » 15 Jan 2017, 01:53

Hello !

Just from a quick lookover your post -- note that the hooked file should be called 'unitdescription.lua' rather than the plural that you used in your post.

Of course, I assume that 'TANKSYUNIT' is the unit ID from both the blueprint AND script of the unit.

Don't let the <LOC> tags get you confused. If it's easier - just assume they aren't there at all - they are only used to translate one language to another and have no bearing on the basic function.

The in-unit descriptions you have already worked out -- the Description is just the basic name of the unit, and the HelpText entry seems to be used primarily by the Unit Console for directly spawning in units (cheat mode). The additional descriptions that go with the factory build rollover come from the Display section of the blueprint, specifically the Abilities field. For example;

Display = {
Abilities = { 'Suicide Weapon' },
}


I hope this helps.
Sprouto
Priest
 
Posts: 366
Joined: 08 Sep 2012, 05:40
Has liked: 54 times
Been liked: 74 times
FAF User Name: Sprouto

Re: How do I add unit descriptions?

Postby Krapougnak » 15 Jan 2017, 10:26

Hi,

I don't know why but for me Blackops system didn't work either.

Try this :
Code: Select all
['TANKSYUNIT'] = "Test.",


Don't forget the coma at the end.

It worked for me, I hope it works for you.
User avatar
Krapougnak
Contributor
 
Posts: 340
Joined: 12 Jul 2012, 11:03
Has liked: 193 times
Been liked: 24 times
FAF User Name: Krapougnak

Re: How do I add unit descriptions?

Postby Dudekahedron » 15 Jan 2017, 20:26

EDIT: SKIP THIS


I'm also having trouble with this, and I'm not sure what parts of this thread work and don't.

In unit.bp do we need the <LOC unitname_desc>, <LOC unitname_help>, and <LOC unitname_name> ?
Do we need hook/loc/strings_db.lua?

I was looking through BrewLan (I don't have the newest blackops yet) and noticed that Balthazar used a totally different set of numbers in unitdescription.lua and strings_db.lua:
from unitdescription.lua:
Code: Select all
Description['saa0105'] = "<LOC Unit_Description_BrewLAN_T1A001>Light Guship. Primary role is base defense. Effective against low-level ground units."

from strings_db.lua:
Code: Select all
sair0105="Light Gunship" -- no idea what this is for
saa0105_name="Respirer"
Unit_Description_BrewLAN_T1A001="description here"
Check out my mod (in development): /viewtopic.php?f=41&t=13326
User avatar
Dudekahedron
Avatar-of-War
 
Posts: 118
Joined: 10 Apr 2016, 22:01
Has liked: 42 times
Been liked: 54 times
FAF User Name: Dudekahedron

Re: How do I add unit descriptions?

Postby Dudekahedron » 15 Jan 2017, 20:41

Serves us all right for not searching existing threads:
/viewtopic. ... ns#p134924

Uveso came to the rescue in September. We can't use capital letters in the unitdescription.lua file because supcom hates us.

I just tested this format with my stuff and it worked:
Code: Select all
Description['daa201'] = "Inspired by the UEF Deadbolt, the locust is an air based emp-platform. The locust relies on anti-gravity drives and gentle propulsion to direct its motion. Unable to ground itself, the unit fires infrequently and the effect is short lived."


Edit: Oops; I also didn't need any of the <LOC ...> tags in my unit blueprints, and didn't need the string_dp.lua file!
Check out my mod (in development): /viewtopic.php?f=41&t=13326
User avatar
Dudekahedron
Avatar-of-War
 
Posts: 118
Joined: 10 Apr 2016, 22:01
Has liked: 42 times
Been liked: 54 times
FAF User Name: Dudekahedron

Re: How do I add unit descriptions?

Postby Sprouto » 15 Jan 2017, 21:27

Yep -- lower case. Figures.
Sprouto
Priest
 
Posts: 366
Joined: 08 Sep 2012, 05:40
Has liked: 54 times
Been liked: 74 times
FAF User Name: Sprouto

Re: How do I add unit descriptions?

Postby Tanksy » 16 Jan 2017, 17:15

Wow, the solution seems so obvious!

Thanks for all the help, guys.
Tanksy
Avatar-of-War
 
Posts: 75
Joined: 31 Aug 2016, 11:39
Has liked: 1 time
Been liked: 14 times


Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest