• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Modifying a Unit/Item Name

AntaresCD

Well-known member
Quick question. I was bouncing some ideas for improvements to my data files around in my head and was wondering if it is possible to have a script modify the name of an entity (say pre-pend a special character) based on a tag (specifically having a tag from a specific group). This adjustment to the name should be cosmetic only and not affect sorting and so forth.

The purpose of this change would be to help less knowledgeable users identify entities with this particular property. If it can't be done without affecting sorting, I can just add the special character to the end (not ideal, but workable).

What script would do this? I'm assuming it would be one of the global ones, but it's outside the scope of what I've had to do before or any examples or documentation I've seen.

Thanks,

~Antares
 
Is fairly straight forwards to do

1. Set up a string in the def file (that way round if anyone translates the file to another language then they only have one place to change it) - example name strChange
2. Script in the postscript section:

if (tagis[tagGroup.tagName] > 0) then

name = name + $strChange
endif

That will add it to the end, reverse order to put at start, add a space character or use a string to represent a space. Changing the name will change the sort order though when the user clicks to order by unit name.

If you wanted it to affect all units with that tag then drop the script in the entity done section
 
Back
Top