• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Solved] Unit Icons Dissapearing - Need Help

Status
Not open for further replies.
Level 8
Joined
Oct 1, 2010
Messages
408
Hi,

I have a problem where the unit icons in buildings are replaced by another icon whenever a unit is made. Here's a picture to explain:

attachment.php


The problem is that the shield icon is replacing the units icon. The shield icon is an ability btw, encase that matters. Thank you for any help! +rep
 

Attachments

  • Icons dissapearing.png
    Icons dissapearing.png
    227.1 KB · Views: 6,939
Last edited:
Level 8
Joined
Oct 1, 2010
Messages
408
Well I need the rally ability, but what I want is for the shield icon to not replace the units icon. I have no problem with the cancel icon appearing, infact it is very necessary, but I don't want the sheild icon to cover up the units, like it is doing to the dreadlord icon in the picture I uploaded.

Edit: Editted the picture to make it more clear.
 
Level 13
Joined
Mar 24, 2010
Messages
950
Do you have the dread lord set to y2 x0 and the shield set to y2 x3 ? also if that for some reason doesn't work, make a trigger that when a unit is being trained remove that shield ability and then once training is complete re-add it to the building, that way it wont get bumped while units train.
 
Level 8
Joined
Oct 1, 2010
Messages
408
Yes the Dreadlord is set to 2,0 and the shield is set to 2,3. I was hoping to do this without triggers but if that's the only way.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Afaik the priority is set in which order objects are initialized for the first time. Make sure that this structure is created once before any other unit with the Shield/Rally ability. But you do not need the icon of Rally when training, as you can use it with right-clicking the terrain.
 
Level 8
Joined
Oct 1, 2010
Messages
408
Afaik the priority is set in which order objects are initialized for the first time. Make sure that this structure is created once before any other unit with the Shield/Rally ability. But you do not need the icon of Rally when training, as you can use it with right-clicking the terrain.

Sorry but what is afaik? Also, where in the world editor can I set this priority?
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
afaik = as far as i know

I have explained how to set the priority. Every object editor object is initialized upon it's first time appearing in the game, e.g. when a unit gains an ability (and this ability was never used before) or when you plant the first Lordaeron Summer Tree. And when it is initialized, it lines its button up in the priority queue.
 
Level 8
Joined
Oct 1, 2010
Messages
408
afaik = as far as i know

I have explained how to set the priority. Every object editor object is initialized upon it's first time appearing in the game, e.g. when a unit gains an ability (and this ability was never used before) or when you plant the first Lordaeron Summer Tree. And when it is initialized, it lines its button up in the priority queue.

Sorry I'm just not understanding this. The ability is added to the buildings shortly after the game starts, so wouldn't this set the priority to last? Because the ability is added after the units were since those units are the ones the building trains, which is set before the game ever starts. Yet this units icon is still being replaced by the abilities, whose priority should be set to last since it was added after the game started. At least this is what I think you mean.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Well, the "last" priority is the one that gets more likely moved.

units are the ones the building trains, which is set before the game ever starts.

Not before the game starts but when the first building of this type appears. If you already place it in editor, then it's done during map initialization from the main thread. I do not assume that you are able to rewrite the main function (JNGP, //! inject catchword). So either place the structure later via trigger or I believe the unit placement function is assembled in order of how you place them in editor, so delete the structures, add another unit with the abilities and then restore the buildings.
 
Level 8
Joined
Oct 1, 2010
Messages
408
Well, the "last" priority is the one that gets more likely moved.



Not before the game starts but when the first building of this type appears. If you already place it in editor, then it's done during map initialization from the main thread. I do not assume that you are able to rewrite the main function (JNGP, //! inject catchword). So either place the structure later via trigger or I believe the unit placement function is assembled in order of how you place them in editor, so delete the structures, add another unit with the abilities and then restore the buildings.

OK atm, in a Jass trigger, the bases are first created THEN the ability (the shield icon that keeps replacing the dreadlord) is added to the building (the building does not start off with this ability but it does start with all the units that it will train) so shouldn't the shield icon have last priority then? Since it is being added to the building after the building is created and placed and since the building starts with the units it trains?

So, building is created then ability is added. I think thats what you meant I should do? But it still does not work =/

Or do I have the order reversed? But I don't see how I could add the ability to the structure before I add the building to the map.

Also, are you saying that if I delete the building, then re-add it in the editor that it might solve this? If so, I did try this, as well as deleting, re-adding both the dreadlord unit and the shield ability and nothing worked. I didn't save and then close the editor before re-adding them though, maybe this would fix it? Sorry if I'm misunderstanding your explanation =/
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
First units, then ability. That works for me at least. But it is not only that your structure should not have the ability before. The ability should not be used ANYWHERE in the game until the units are.

Abilities of a unit are done after trains btw, so should not be required to add it via trigger.

edit: test map attached

As it is currently set, the Rally ability gets taken out. If you activate the first create unit line in trigger rax, an orcish Barracks structure will be placed beforehand, which will init Flare and Rally. The Spellbreaker will vanish then when training in human Barracks.
 

Attachments

  • ButtonPrio.w3x
    16.2 KB · Views: 93
Level 8
Joined
Oct 1, 2010
Messages
408
First units, then ability. That works for me at least. But it is not only that your structure should not have the ability before. The ability should not be used ANYWHERE in the game until the units are.

Abilities of a unit are done after trains btw, so should not be required to add it via trigger.

edit: test map attached

As it is currently set, the Rally ability gets taken out. If you activate the first create unit line in trigger rax, an orcish Barracks structure will be placed beforehand, which will init Flare and Rally. The Spellbreaker will vanish then when training in human Barracks.
Well I tried to run the map you uploaded but it nothing happened when I tested it in Wc3. I tried it with and without the first create unit line being enabled.

Also, just to clarify, I'm not having a problem with unit abilities being overriden, just buildings, like the picture shows. But what you're saying is that I need to make a trigger that adds the sheild ability to the structure only after a unit (any unit I hope) has been trained at the building? And then it should be fixed?
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
No, abilities do not need to be casted, units do not need to be trained etc. Just that their object data has to appear/be read somehow. When you place the structure, the units it can train already get initialized because they are added as values to the structure.

The first picture shows all buttons.
The second is with disabled action as the map is uploaded --> Rally ability is missing.
The third is with enabled action --> Spellbreaker unit missing.
 

Attachments

  • CmdField0.jpg
    CmdField0.jpg
    62.8 KB · Views: 1,985
  • CmdField1.jpg
    CmdField1.jpg
    59.6 KB · Views: 176
  • CmdField2.jpg
    CmdField2.jpg
    62.1 KB · Views: 222
Level 8
Joined
Oct 1, 2010
Messages
408
No, abilities do not need to be casted, units do not need to be trained etc. Just that their object data has to appear/be read somehow. When you place the structure, the units it can train already get initialized because they are added as values to the structure.

The first picture shows all buttons.
The second is with disabled action as the map is uploaded --> Rally ability is missing.
The third is with enabled action --> Spellbreaker unit missing.

OK well here is the trigger that adds the bases and then the sheild icon unit. I think this will help explain things better than I have been:

  • Else - Actions
    • Unit - Replace base[(Integer A)] with a racebase[raceplayer[(Player number of (Owner of base[(Integer A)]))]] using The old unit's relative life and mana
    • Set base[(Integer A)] = (Last replaced unit)
    • Unit - Order base[(Integer A)] to Set Rally Point To circlepos[(Integer A)]
    • Unit - Add Defend Base [Unit] to (Last replaced unit)
    • Unit - Add Invulnerable (Neutral) to (Last replaced unit)
    • Unit - Set the custom value of base[(Integer A)] to (Integer A)
So should I change it so that the Defend Base [Unit] is turned off when its initially added? (this is the sheild icon from the picture). I'm sorry I don't have more knowledge about this, but thaks a lot for being so patient with me.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Give map pls, am afraid there is incomprehensibleness. Am not sure either about your lines.

The ability should not be anywhere, not in any structure or other unit, nor be read via trigger etc. until the trainable units appear anywhere, likewise not in any structure, nor be placed, nor in triggers etc.

As soon as you somehow access an object, its data is loaded.
 
Level 8
Joined
Oct 1, 2010
Messages
408
OK the map is attached to this post. It does use Jass, but I'm pretty sure you use JNPG, just thought I'd mention.

The thing about the trigger I posted before is that I just thought that since the sequence is to first place the bases, then add the ability that it should work. Because once the bases are added the units are initialized so it would be ok to add the ability, since it's added to the base after the bases are placed.

I'm sure I must be misunderstanding something though. The map might be hard to read though, there are a lot of variables, and this map was made by Priwin (don't worry he gave me permission to edit) so I do not know a great deal about the triggers myself, and my understand of triggers in general is pretty poor.
 

Attachments

  • WoWRiskCataBeta.w3x
    2.4 MB · Views: 68
Level 26
Joined
Aug 18, 2009
Messages
4,097
Would have been better if you mentioned it was with UMSWE because it editor crashes when it loads a UMSWE map.

After browsing through your map with MPQ viewer, I was able to get a clue which is the structure in question. Really, there are hundreds of raxes with overlapping unit assortments. Guess that's also the reason why it does not bug for most other buildings.

But yeah, it seems you have not understood me. The ability is added/removed in a couple of triggers, in set the units variables for example before a Burning Legion Base comes into play. Seeing that you have more than one building with this ability and that trains units, even if you had only the above trigger, it would run once to place a Stormwind Town maybe, add the ability, on another run create a Burning Legion Base, so the trainable units that Burning Legion Base offers and that were not used before, all get initialized after the ability was accessed for the first time. I would advise you to initialize all trainable units on map init before the ability (throw all of them in an array or the structures that possess them, then loop over this array and check their classification for example, what you do does not matter, essential is that somehow the game is instructed to read the units' object data).
 
Level 8
Joined
Oct 1, 2010
Messages
408
Awesome. Thanks so much Water, it's working perfectly now. Thanks so much all for your help and for being so patient with me. You rock!!

You ever need anything from me, just ask.
 
Last edited:
Status
Not open for further replies.
Top