Unitmarkers [SP/MP modification for 1.12/1.13]

The place to post your WML questions and answers.

Moderators: Developers, Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.

Unitmarkers [SP/MP modification for 1.12/1.13]

Postby Paulomat4 » December 19th, 2013, 11:13 pm

Some time ago, for my UMC Campaign, I created a Unitmarker system, which lets you label your units, to make it easier to keep track of important ones, that you don't want to lose. (because of a special trait combination, or an item that was given to it for example)
Then I saw, that Admant14 apparently liked the idea, and included the same into his campaign. Thus, after reading about Dugi's article, about how to hack events into other scenarios I decided to create a modification which allows these unitmarkers for every single-player campaign.

Unitmarker example.JPG
Unitmarker example.JPG (16.8 KiB) Viewed 1966 times


My goal for now is to add more possibilities labels and to support changing overlays for units who already have some (with the possibility to bring the orignal ones back), so if you have any suggestions, want to try your hand at creating such a label, or discovered some bug with it you're welcome to post your thoughts here.

It currently only works for singleplayer, I'm going to test if it works for multiplayer too.
many thanks to dugi btw for helping me with it :lol:
Last edited by Paulomat4 on December 4th, 2016, 10:48 pm, edited 5 times in total.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
 
Posts: 658
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Global Unitmarkers for 1.11.x

Postby Dugi » December 20th, 2013, 10:52 am

Why are you making your add-on 1.11 only? It's right that the custom icons will show on the recall list only on 1.11.8 and later, but the rest will work on 1.10 exactly as on 1.11. Don't let yourself be confused by the fact that multiplayer modifications work only on 1.11, the trick I've found will work also on 1.10 (and should work also on 1.8 after a rewrite of the lua code).

It should work in multiplayer, but better fear OoS that would happen if not everyone uses that feature (setting up the event as a 1.11 multiplayer modification is a better option for multiplayer).

If you slightly improved the code, you might be able to solve its problem with existing campaign-specific overlays. The list of overlays is a comma-separated list, that can be split using set_variables with the split subtag, then easily manipulated, removing your overlays, then adding the new one and then creating the comma-separated list again with set_variable with the join subtag.
Author of Legend of the Invincibles.
I am human, stronger than any god. -Joe Tiberi
User avatar
Dugi
 
Posts: 4696
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains

Re: Global Unitmarkers for 1.11.x

Postby Paulomat4 » December 20th, 2013, 4:17 pm

Why are you making your add-on 1.11 only? It's right that the custom icons will show on the recall list only on 1.11.8 and later, but the rest will work on 1.10 exactly as on 1.11. Don't let yourself be confused by the fact that multiplayer modifications work only on 1.11, the trick I've found will work also on 1.10 (and should work also on 1.8 after a rewrite of the lua code).

No that wasn't the reason, the reason is simply that I didn't think of it. I'll upload it on the 1.10 servers too.

It should work in multiplayer, but better fear OoS that would happen if not everyone uses that feature (setting up the event as a 1.11 multiplayer modification is a better option for multiplayer).

That's what I want to test. normally modified unit graphics don't cause OoS but, i fear that the way it is set up might create Oos.

If you slightly improved the code, you might be able to solve its problem with existing campaign-specific overlays. The list of overlays is a comma-separated list, that can be split using set_variables with the split subtag, then easily manipulated, removing your overlays, then adding the new one and then creating the comma-separated list again with set_variable with the join subtag.

I'll see what I can do there. The hero-icon seems to work as overlay, but the leader crown behaves differently. It doesn't disappear for example if I add another overlay, contrary to the hero-icon.

I'll see what I can do, thanks for your suggestions.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
 
Posts: 658
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Global Unitmarkers for 1.11.x

Postby Dugi » December 20th, 2013, 4:27 pm

I'll see what I can do there. The hero-icon seems to work as overlay, but the leader crown behaves differently. It doesn't disappear for example if I add another overlay, contrary to the hero-icon.
It's not an overlay, though its appearance and implementation is similar to overlays.
Author of Legend of the Invincibles.
I am human, stronger than any god. -Joe Tiberi
User avatar
Dugi
 
Posts: 4696
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains

Re: Global Unitmarkers for 1.11.x

Postby Paulomat4 » December 20th, 2013, 4:34 pm

Than how does it work? The unit has canrecruit set to yes, i know, but i wouldn't know what to do to take away the crown. Also I think that leaders, and heroes should have their own icons to identify them. I could on the other hand imagine, to give give the player the chance to chose between different crowns for his heroes and leaders. (There already a bronze variation shipped with the game for 1.11.7, and there will be new ones in 1.11.8 apparently.)
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
 
Posts: 658
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Global Unitmarkers for 1.11.x

Postby Dugi » December 20th, 2013, 4:56 pm

No. The leader icon displays on all units who can recruit, no matter what. The hero and loyal icons are normal overlays added by the campaign's WML, maybe in a bit obfuscated way (the {IS_HERO} macro represents adding the hero overlay, same with loyal).
Author of Legend of the Invincibles.
I am human, stronger than any god. -Joe Tiberi
User avatar
Dugi
 
Posts: 4696
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains

Re: Global Unitmarkers for 1.11.x

Postby Paulomat4 » December 20th, 2013, 5:00 pm

No. The leader icon displays on all units who can recruit, no matter what. The hero and loyal icons are normal overlays added by the campaign's WML, maybe in a bit obfuscated way (the {IS_HERO} macro represents adding the hero overlay, same with loyal).

I understood that already, I just wondered how you wanted to change the canrecruit overlay. But that may be actually possible if the overlay is simply bigger than the original one (and might solve the need to reconstitute the old normal crown)
I might have not expressed myself clearly enough, sry for that :oops:
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
 
Posts: 658
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Global Unitmarkers for 1.11.x

Postby tekelili » December 21st, 2013, 11:40 am

@Paulomat4: I took a look to your code and would suggest a simple improvement: Dont filter units with already overlays in show_if tag. Instead do it in the commands tags and if they have an overlay you can flip your own owerlay image to be displayed in the upper right corner. When removing it, dont set unit.overlays to "", instead use remove_overlay and write the very name of your image overlayed (if you have problems for this, write into unit.variables.my_custom_overlay the value of your images overlayed).

~FLIP is described in imagepathfunction on the wiki, if you wonder.
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
User avatar
tekelili
 
Posts: 1025
Joined: August 19th, 2009, 9:28 pm

Re: Global Unitmarkers

Postby Paulomat4 » December 21st, 2013, 2:53 pm

First of all, know that I excluded unit's with overlays, just for simplicity. I am already working on being able to mark units with overlays.
I thought about your flip proposal already, but I don't like having overlays on the right upper corner. I don't know why, but this has always distracted me in dead water. It feels to me, that these overlays are good and visible enough when they are on the left side, because they don't take space as there are already the hp and exp bar, and the colored orb.
Also I don't want to spam the units on the field with overlays. One is enough I think. I'd rather store the unit overlays, and give the possibility to bring back the original overlays later.
thx for the suggetion though. :)
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
 
Posts: 658
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Global Unitmarkers

Postby Paulomat4 » December 21st, 2013, 10:25 pm

Version 1.1.0 is on the servers now. this version features specialized overlays for leaders, heroes and loyal units. Also on 1.11 this has now the hotkeys ctrl+u. I haven't got to support other overlays, but I guess i'll get to it this vacation.
1.1.0 example.JPG
1.1.0 example.JPG (12.8 KiB) Viewed 1854 times
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
 
Posts: 658
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Global Unitmarkers

Postby Paulomat4 » January 8th, 2014, 9:09 pm

I have updated this to support the new [feedback] tag on from 1.11.8.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
 
Posts: 658
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Global Unitmarkers

Postby kiss » October 1st, 2014, 2:19 pm

Paulomat4, I've tried it in The South Guard - A Desparate Errand - Soldier (Normal) 1.11.16.

With Deoran, I can choose a custom flag and when I clear it, the default one comes back.
With Moreth, the default one never comes back and I do not have flag anymore. (Same behaviour with Mage in AOI Lineara the Quick)
With Sir Gerrick, when selecting the option in the menu, no window appears.

Perhaps it is the way it should be?
kiss
 
Posts: 124
Joined: July 9th, 2014, 5:50 pm

Re: Global Unitmarkers

Postby Paulomat4 » October 6th, 2014, 1:01 pm

With Deoran, I can choose a custom flag and when I clear it, the default one comes back.
With Moreth, the default one never comes back and I do not have flag anymore. (Same behaviour with Mage in AOI Lineara the Quick)
With Sir Gerrick, when selecting the option in the menu, no window appears.

Yes, there are still some flaws that i need to work out. I'm currently overhauling the entire system. The problem is that the Leader crown (the golden one) is hard-coded while the other ones like the silver one are not. Currently I need to make a decision:

should clearing an overlay that was already set before the unitmarker (loyal units, hero units and leaders) behave like it's currently doing with leader-crowns?
(so clearing the icon would set the icon back to the old one)

or:
clearing the overlay really delete's all overlays (except for leader crown's, that's impossible), but the unit is stored and can restore it's old overlay/icon later on.

What do you and others think of this? The first method seems more intuitive, as all overlays would behave the same but on the other hand when I click "delete icon" I would think that it really deletes the old icon, not restores the old one.

btw: I have already coded a flip function that will allow you to change the side of your Icon in the next version.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
 
Posts: 658
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Global Unitmarkers

Postby beetlenaut » October 6th, 2014, 3:28 pm

Paulomat4 wrote:when I click "delete icon" I would think that it really deletes the old icon, not restores the old one.
If you named it "Revert", it's function would be obvious.
Campaigns: Dead Water
The Founding of Borstep
Secrets of the Ancients
User avatar
beetlenaut
Developer
 
Posts: 1979
Joined: December 8th, 2007, 3:21 am
Location: Oaxaca, Mexico

Re: Global Unitmarkers

Postby Paulomat4 » October 6th, 2014, 5:45 pm

How about something like: "restore original overlay"?
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
 
Posts: 658
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Next

Return to WML Workshop

Who is online

Users browsing this forum: No registered users and 1 guest