• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Cloaking System with Events

A system for making units have out of combat invisibility without the confusing side effect of the unit's portrait being partially faded but the unit is still visible to enemies. Also supports events when a unit cloaks or decloaks via the system. See trigger comments for how to import.
Contents

Cloaking System with Events (Map)

Reviews
Wrda
I might have not been when I said this: What I mean is that you have to choose: 1) use the function UnitAddAbility(u, abilcode) inside, to actually add the ability to the unit. or 2) tell the user to add the ability manually (if the unit doesn't have...

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
In the example Map Initialization event won't work, when adding units to the system. However, a 0s timer will be enough.
Either CloakingSystemAddUnit should add the ability 'abilcode' to the unit or the user has to manually add it, while at same time passing the ability id to the function. The instructions weren't very clear on this part. You can optimize CloakingSystemAddUnit function further by caching GetUnitUserData(u).
In CloakingSystemRemoveUnit, you can if BlzGroupGetSize(udg_cloaking_system_unitgroup) == 0 then instead CountUnitsInGroup, since it's faster and better because it doesn't loop through all units. Also, the timer should be destroyed (pause first).
In Cloaking System Periodic trigger, you can also use BlzGroupGetSize and cache Picked Unit too.

It does seem like a nice alternate approach to deal with the invisibility transition, although I like the standard one.

Very few things to be fixed, but some are quite important.
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
I might have not been when I said this:
Either CloakingSystemAddUnit should add the ability 'abilcode' to the unit or the user has to manually add it, while at same time passing the ability id to the function.
What I mean is that you have to choose: 1) use the function
JASS:
UnitAddAbility(u, abilcode)
inside, to actually add the ability to the unit.
or 2) tell the user to add the ability manually (if the unit doesn't have yet) and then use the ability id in one of the arguments of the system's function.

I've come to realise dead units will have data attached to them that might not be removed, particularly the timer. I think it's worth to mention the remove function in instructions, even if it is somewhat obvious.

A bit of nitpicking, but no longer a reason for not being approved as this can be done swiftly.

Approved
 

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,804
Why do I get "Failed to parse map data. The map is possibly corrupt or protected." when trying to Preview triggers?
 
I actually almost made a thread about that today. A lot of recent resources can’t have their triggers previewed, but older resources (mine for example) aren’t affected. So far not sure what exactly causes it.
It seems there are changes to the trigger files that causes parsing for 1.35 to break. I recall 1.32 and 1.33 seems to parse correctly, but I need to double check those.
 
Top