• 🏆 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!

[GUI] Take Aim - Dynamic Range Change

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
"Kardel uses his dwarf engineering skills to make modifications to his rifle, enhancing the range of his rifle, as well as muffle shots for better cover. Targets can be attacked from an extended range, for every positive difference of elevation."

Range Bonus: 100/200/300/400
Elevation difference range bonus: 150
Maximum Elevation: 3

Note:
- Elevation range bonus = (Sniper elevation - target elevation) x elevation difference range bonus.
- Maximum range is 1400
- The limit of elevation is 3, that is 650/750/850/950 + 450 = 1400 max.

Credits: The6thMessenger (Me), FightFightFight

Crazy as it seems, with the help of FightFightFight, i managed to make an ability that allows you to dynamically alter the unit's attack range safely (Meaning no fuss). This is achieved by dynamic transformation.

This simply dynamically transforms your unit upon certain conditions met, without disjointing projectiles or removing negative buffs unintended.

What happens is that whenever attacking, or ordered to attack, the elevation of you in respect to the unit is checked. If it is positive, or different than your previous unit, then the transformation occurs -- transforming to a replica of the unit that the only difference is a different attack range. Now if you acquired a target, then should you require to chase it then it references your elevation in respect to that last target you are still ordered to attack, so as you chase your attack range changes dynamically. Should you cancel the chase, or attack another unit, then the loop is refreshed.

For the "Not revealed when attacking from the fog" feature is much harder to pull off. Basically, i disabled such reveal when attacking or dying from the fog, and then just built it from the ground up upon the triggers.

I apologize deeply that this is somewhat hardcoded. I just found no way around it.

This is simply a suggestion for Dota, not yet implemented. But please support and follow this suggestion at Playdota Forums.

These triggers are NOT advisable to alter. Seriously, this is a mess, and it's hard to explain, because i haven't seen a way around it. The function below is not in play, but this is referenced for the sake of your use.

For the Not revealable attacking, the Visibility is triggered instead of defaultly active. Because there is no way to hide your unit when attacking or casting a spell or dying in the fog, aside from preventing it globally, and just manually doing it..

This Take Aim just implements constant transformation, if you want to change the bonus attack range, you have to change the Upgrade "Take Aim Base", as well as edit the Transformee units' attack range manually. Or you can make new Upgrades that will also give bonus range to the transformees, allowing scaling bonus attack range with level.

After doing everything you wanted, you just have to replace the transformation Queries upon the Triggers: Order, Attack, and Loop, and that should work. Also you have to change the Temp Integer of every variable referencing an arrayed unit, A = Loop, B = Order, C = Attack.

NOTE: this is very very very very hardcoded, i think. There is just no way around it, do not edit anything in the triggers unless you know what you are doing.
Loop Interval = This is how many times does the Loop

Decay = This is times loop Interval. If you have 100 Decay, with 0.03 loop interval, then you have 3s of decay.

Radius_Attack = Is the radius of the reveal when attacking.

Radius_Attack = Is the radius of the reveal when Dying.

NOTE: For each levels, you have to increase the Elevation_Max, and then put another set of "SaveIntegerBJ" with the ability codes, while each set will have an additional line of code. As well as you have to do an additional errand at the Transformation trigger. Not only you have to put additional unit types, you have to increase the possible levels of the Temp_Integer_B at the Transformation Trigger.

[Previous Elevation Unit] > (To) > [Next Elevation Unit]

A000 = 0 > 1
A004 = 0 > 2
A005 = 0 > 3
A002 = 1 > 0
A009 = 1 > 2
A00A = 1 > 3
A008 = 2 > 0
A007 = 2 > 1
A006 = 2 > 3
A00B = 3 > 0
A00C = 3 > 1
A003 = 3 > 2
  • Constants
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hero - Learn skill for Dwarven Sniper 0099 <gen>: Sniper - Take Aim
      • Unit - Set level of Sniper - Take Aim for Dwarven Sniper 0099 <gen> to 4
      • -------- ------------------------ --------
      • Hashtable - Create a hashtable
      • Set C_DS_TA_Hashtable = (Last created hashtable)
      • -------- ------------------------ --------
      • -------- This is your unit types you transform to. --------
      • -------- ------------------------ --------
      • Set C_DS_TA_Unit_Types[0] = Dwarven Sniper
      • Set C_DS_TA_Unit_Types[1] = Dwarven Sniper (+1)
      • Set C_DS_TA_Unit_Types[2] = Dwarven Sniper (+2)
      • Set C_DS_TA_Unit_Types[3] = Dwarven Sniper (+3)
      • -------- ------------------------ --------
      • Custom script: call SaveIntegerBJ( 'A000', 0, 1, udg_C_DS_TA_Hashtable )
      • Custom script: call SaveIntegerBJ( 'A004', 0, 2, udg_C_DS_TA_Hashtable )
      • Custom script: call SaveIntegerBJ( 'A005', 0, 3, udg_C_DS_TA_Hashtable )
      • -------- ------------------------ --------
      • Custom script: call SaveIntegerBJ( 'A002', 1, 0, udg_C_DS_TA_Hashtable )
      • Custom script: call SaveIntegerBJ( 'A009', 1, 2, udg_C_DS_TA_Hashtable )
      • Custom script: call SaveIntegerBJ( 'A00A', 1, 3, udg_C_DS_TA_Hashtable )
      • -------- ------------------------ --------
      • Custom script: call SaveIntegerBJ( 'A008', 2, 0, udg_C_DS_TA_Hashtable )
      • Custom script: call SaveIntegerBJ( 'A007', 2, 1, udg_C_DS_TA_Hashtable )
      • Custom script: call SaveIntegerBJ( 'A006', 2, 3, udg_C_DS_TA_Hashtable )
      • -------- ------------------------ --------
      • Custom script: call SaveIntegerBJ( 'A00B', 3, 0, udg_C_DS_TA_Hashtable )
      • Custom script: call SaveIntegerBJ( 'A00C', 3, 1, udg_C_DS_TA_Hashtable )
      • Custom script: call SaveIntegerBJ( 'A003', 3, 2, udg_C_DS_TA_Hashtable )
      • -------- ------------------------ --------
      • Set C_DS_Elevation_Max = 3
      • Set C_DS_Elevation_Min = 0
      • Set C_DS_TA_Loop_Interval = 0.03
      • Set C_Visibility_Decay = 100
      • Set C_Visibility_Loop_Interval = 0.03
      • Set C_Visibility_Radius_Attack = 200.00
      • Set C_Visibility_Radius_Death = 500.00
      • -------- ------------------------ --------
      • Trigger - Add to Visibility Loop <gen> the event (Time - Every C_Visibility_Loop_Interval seconds of game time)
      • Trigger - Add to Take Aim Loop <gen> the event (Time - Every C_DS_TA_Loop_Interval seconds of game time)
  • Take Aim Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Level of Sniper - Take Aim for (Attacking unit)) Greater than 0
          • ((Attacking unit) is in DS_TA_Learned) Equal to True
    • Actions
      • -------- -------------------------- --------
      • -------- This system checks which of the registered user triggered the function. --------
      • -------- -------------------------- --------
      • For each (Integer DS_TA_Temp_Integer_C) from 1 to DS_TA_MUI, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Attacking unit) Equal to DS_TA_Unit[DS_TA_Temp_Integer_C]
            • Then - Actions
              • Set DS_TA_Target[DS_TA_Temp_Integer_C] = (Attacked unit)
              • Set TempLoc00 = (Position of DS_TA_Unit[DS_TA_Temp_Integer_C])
              • Set TempLoc01 = (Position of DS_TA_Target[DS_TA_Temp_Integer_C])
              • Set DS_TA_Elevation = ((Terrain cliff level at TempLoc00) - (Terrain cliff level at TempLoc01))
              • -------- -------------------------- --------
              • -------- Transformation Query --------
              • -------- -------------------------- --------
              • Set Temp_Integer = DS_TA_Temp_Integer_C
              • Trigger - Run Take Aim Transform <gen> (ignoring conditions)
              • -------- -------------------------- --------
              • -------- Eliminating Leaks --------
              • -------- -------------------------- --------
              • Custom script: call RemoveLocation (udg_TempLoc00)
              • Custom script: call RemoveLocation (udg_TempLoc01)
              • -------- -------------------------- --------
              • Set DS_TA_Order[DS_TA_Temp_Integer_C] = (Current order of DS_TA_Unit[DS_TA_Temp_Integer_C])
              • Unit Group - Add DS_TA_Unit[DS_TA_Temp_Integer_C] to DS_TA_Attacking
            • Else - Actions
      • -------- -------------------------- --------
  • Take Aim Loop
    • Events
    • Conditions
    • Actions
      • For each (Integer DS_TA_Temp_Integer_A) from 1 to DS_TA_MUI, do (Actions)
        • Loop - Actions
          • Player - Set the current research level of Take Aim Base to (Level of Sniper - Take Aim for DS_TA_Unit[DS_TA_Temp_Integer_A]) for (Owner of DS_TA_Unit[DS_TA_Temp_Integer_A])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (DS_TA_Unit[DS_TA_Temp_Integer_A] is in DS_TA_Attacking) Equal to True
            • Then - Actions
              • Set TempLoc00 = (Position of DS_TA_Unit[DS_TA_Temp_Integer_A])
              • Set TempLoc01 = (Position of DS_TA_Target[DS_TA_Temp_Integer_A])
              • Set DS_TA_Elevation = ((Terrain cliff level at TempLoc00) - (Terrain cliff level at TempLoc01))
              • -------- -------------------------- --------
              • -------- Transformation Query --------
              • -------- -------------------------- --------
              • Set Temp_Integer = DS_TA_Temp_Integer_A
              • Trigger - Run Take Aim Transform <gen> (ignoring conditions)
              • -------- -------------------------- --------
              • -------- Eliminating Leaks --------
              • -------- -------------------------- --------
              • Custom script: call RemoveLocation (udg_TempLoc00)
              • Custom script: call RemoveLocation (udg_TempLoc01)
              • -------- -------------------------- --------
              • -------- Turning off --------
              • -------- -------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • DS_TA_Target[DS_TA_Temp_Integer_A] Equal to No unit
                      • (DS_TA_Target[DS_TA_Temp_Integer_A] is dead) Equal to True
                      • (DS_TA_Target[DS_TA_Temp_Integer_A] is visible to (Owner of DS_TA_Unit[DS_TA_Temp_Integer_A])) Equal to False
                      • (DS_TA_Target[DS_TA_Temp_Integer_A] is hidden) Equal to True
                      • (DS_TA_Target[DS_TA_Temp_Integer_A] is fogged to (Owner of DS_TA_Unit[DS_TA_Temp_Integer_A])) Equal to True
                      • (DS_TA_Unit[DS_TA_Temp_Integer_A] is dead) Equal to True
                      • (Current order of DS_TA_Unit[DS_TA_Temp_Integer_A]) Not equal to DS_TA_Order[DS_TA_Temp_Integer_A]
                • Then - Actions
                  • Unit Group - Remove DS_TA_Unit[DS_TA_Temp_Integer_A] from DS_TA_Attacking
                  • Set DS_TA_Target[DS_TA_Temp_Integer_A] = No unit
                  • Set DS_TA_Elevation = 0
                  • Trigger - Run Take Aim Transform <gen> (ignoring conditions)
                • Else - Actions
            • Else - Actions
  • Take Aim Transformation
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DS_TA_Elevation Greater than C_DS_Elevation_Max
        • Then - Actions
          • Set DS_TA_Elevation = C_DS_Elevation_Max
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DS_TA_Elevation Less than C_DS_Elevation_Min
            • Then - Actions
              • Set DS_TA_Elevation = C_DS_Elevation_Min
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of DS_TA_Unit[Temp_Integer_A]) Equal to C_DS_TA_Unit_Types[0]
        • Then - Actions
          • Set Temp_Integer_B = 0
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of DS_TA_Unit[Temp_Integer_A]) Equal to C_DS_TA_Unit_Types[1]
            • Then - Actions
              • Set Temp_Integer_B = 1
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of DS_TA_Unit[Temp_Integer_A]) Equal to C_DS_TA_Unit_Types[2]
                • Then - Actions
                  • Set Temp_Integer_B = 2
                • Else - Actions
                  • -------- Copy Paste this upon the "else" area of this if-then-else; replace the value of the variable below to 4 (or above) --------
                  • -------- and the index of the C_DS_TA_Unit_Types to 4 (or above) --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of DS_TA_Unit[Temp_Integer_A]) Equal to C_DS_TA_Unit_Types[3]
                    • Then - Actions
                      • Set Temp_Integer_B = 3
                    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of DS_TA_Unit[Temp_Integer_A]) Not equal to C_DS_TA_Unit_Types[DS_TA_Elevation]
        • Then - Actions
          • Custom script: set udg_Temp_Ability = LoadIntegerBJ(udg_Temp_Integer_B, udg_DS_TA_Elevation, udg_C_DS_TA_Hashtable)
          • Unit - Add Temp_Ability to DS_TA_Unit[Temp_Integer_A]
          • Unit - Remove Temp_Ability from DS_TA_Unit[Temp_Integer_A]
        • Else - Actions
  • Visibility Death Reveal
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set TempLoc00 = (Position of (Triggering unit))
      • Player Group - Pick every player in (All enemies of (Triggering player)) and do (Actions)
        • Loop - Actions
          • Set Visibility_MUI_Index = (Visibility_MUI_Index + 1)
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility from TempLoc00 to a radius of C_Visibility_Radius_Death
          • Set Visibility_Modifier[Visibility_MUI_Index] = (Last created visibility modifier)
          • Set Visibility_Modifier_Counter[Visibility_MUI_Index] = C_Visibility_Decay
      • Custom script: call RemoveLocation (udg_TempLoc00)
      • Trigger - Turn on Visibility Loop <gen>
  • Visibility Attack Reveal
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Attacking unit) is A ranged attacker) Equal to True
          • (Level of Sniper - Take Aim for (Attacking unit)) Less than or equal to 0
          • ((Attacking unit) belongs to an enemy of (Triggering player)) Equal to True
    • Actions
      • Set TempLoc00 = (Position of (Attacking unit))
      • Player Group - Pick every player in (All allies of (Triggering player)) and do (Actions)
        • Loop - Actions
          • Set Visibility_MUI_Index = (Visibility_MUI_Index + 1)
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility from TempLoc00 to a radius of C_Visibility_Radius_Attack
          • Set Visibility_Modifier[Visibility_MUI_Index] = (Last created visibility modifier)
          • Set Visibility_Modifier_Counter[Visibility_MUI_Index] = C_Visibility_Decay
      • Custom script: call RemoveLocation (udg_TempLoc00)
      • Trigger - Turn on Visibility Loop <gen>
  • Visibility Cast Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Target unit of ability being cast) belongs to an enemy of (Triggering player)) Equal to True
    • Actions
      • Set TempLoc00 = (Position of (Triggering unit))
      • Player Group - Pick every player in (All enemies of (Triggering player)) and do (Actions)
        • Loop - Actions
          • Set Visibility_MUI_Index = (Visibility_MUI_Index + 1)
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility from TempLoc00 to a radius of C_Visibility_Radius_Attack
          • Set Visibility_Modifier[Visibility_MUI_Index] = (Last created visibility modifier)
          • Set Visibility_Modifier_Counter[Visibility_MUI_Index] = C_Visibility_Decay
      • Custom script: call RemoveLocation (udg_TempLoc00)
      • Trigger - Turn on Visibility Loop <gen>
  • Visibility Loop
    • Events
    • Conditions
    • Actions
      • For each (Integer Visibility_Temp_Integer_A) from 1 to Visibility_MUI_Index, do (Actions)
        • Loop - Actions
          • Set Visibility_Modifier_Counter[Visibility_Temp_Integer_A] = (Visibility_Modifier_Counter[Visibility_Temp_Integer_A] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Visibility_Modifier_Counter[Visibility_Temp_Integer_A] Less than or equal to 0
            • Then - Actions
              • Visibility - Destroy Visibility_Modifier[Visibility_Temp_Integer_A]
              • Set Visibility_Modifier[Visibility_Temp_Integer_A] = Visibility_Modifier[Visibility_MUI_Index]
              • Set Visibility_Modifier_Counter[Visibility_Temp_Integer_A] = Visibility_Modifier_Counter[Visibility_MUI_Index]
              • Set Visibility_MUI_Index = (Visibility_MUI_Index - 1)
              • Set Visibility_Temp_Integer_A = (Visibility_Temp_Integer_A - 1)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Visibility_MUI_Index Less than or equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
Keywords:
take, aim, kardel, sniper, dota, suggestion, passive, attack, range
Contents

Take Aim - Elevation Range Bonus (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 15:38, 2nd Jan 2015 Maker: Check the replies in this thread.

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

15:38, 2nd Jan 2015
Maker: Check the replies in this thread.
 
Level 5
Joined
Sep 11, 2010
Messages
56
Level 25
Joined
Jun 5, 2008
Messages
2,572
This has been known for a while afaik (changing unit range via upgrades) and the biggest problem is that it isnt configurable/generic enough to be a system.

Edit:

The code is kind of a big mess imo, should find a way to do without so many if/then/else (Arrays come to mind).
I noticed this isnt a system which i originally though.
 
Level 5
Joined
Sep 11, 2010
Messages
56
This has been known for a while afaik (changing unit range via upgrades) and the biggest problem is that it isnt configurable/generic enough to be a system.

Edit:

The code is kind of a big mess imo, should find a way to do without so many if/then/else (Arrays come to mind).
I noticed this isnt a system which i originally though.

I never said that it is a system.

And no, this is not UPGRADES alone. Upgrades increase the attack range, transformation changes the unit to another form of unit without interruption, allowing you to either implement or revert any changes. So you can add 150 range, and take away. Which is impossible to upgrades, because you can't remove upgrades, while you can just transform back with -150 range.

Also, i'm sorry if everything is such a mess, i just never found any way around it - i brainstormed and found nothing other than that technique to make the transformation system work. I tried arrays but i couldn't find any good way in making them much easier. I'm still looking a good way to fix them, but i just don't have that luck.

If it makes you feel any better, i'm trying Hashtable.
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
Well here is a way:
1. Save indexes bound to unit type into a hashtable, for example SaveInteger(hashtable, unitTypeId, elevationIndex0, index0), etc
2. Make 3 (or whatever number of levels you want) sized arrays to hold Take Aim abilities. (make multiples for different elevation modes)
3. In the loop (transformation trigger that is), load index by unitTypeId, and use it to add/remove ability.

That would reduce code clutter a lot and it would look a lot better (since all those IF/THEN/ELSE branches would be replaced by a single case). At least that is the minimal work you can do to improve the code, without changing a lot of stuff.
 
Level 5
Joined
Sep 11, 2010
Messages
56
Well here is a way:
1. Save indexes bound to unit type into a hashtable, for example SaveInteger(hashtable, unitTypeId, elevationIndex0, index0), etc
2. Make 3 (or whatever number of levels you want) sized arrays to hold Take Aim abilities. (make multiples for different elevation modes)
3. In the loop (transformation trigger that is), load index by unitTypeId, and use it to add/remove ability.

That would reduce code clutter a lot and it would look a lot better (since all those IF/THEN/ELSE branches would be replaced by a single case). At least that is the minimal work you can do to improve the code, without changing a lot of stuff.

Yes, i know, that is my approach. But i hit a snag with the Hashtable, turns out that the Save Ability will cause the WE to crash, and i don't know how to put it into custom script. I know how to work with hashtables, i know how to load a unit or anything at all, but i'm having problems registering the abilities that were to be used.

i suggest use 0.03125 instead using 0.03

In Constant
just remove this
  • Hero - Learn skill for Dwarven Sniper 0099 <gen>: Sniper - Take Aim
  • Unit - Set level of Sniper - Take Aim for Dwarven Sniper 0099 <gen> to 4
just put them in other triggers

No. So far, people all over taught me never to have a loop below 0.03, therefore such is the minimum i put, because it has the safest and most trigger count.

And no, if they are to import, they need to at least know how to remove such lines of code. That is required to show how the "not revealed when attacking behind the fog" deal.
 
Use the the AbilityId (integer), but not the ability type, for hashtable.
The AbilityId equals the rawcode that you can see in object editor.

Then for loading you can load value of key GetSpellAbilityId().
Of course this function now will also return an integer value, not an ability.

Edit:

No. So far, people all over taught me never to have a loop below 0.03,
The suggestion was to use 0.0312500. And 0.03 is smaller, so you it would not be below. :p
 
Level 5
Joined
Sep 11, 2010
Messages
56
Use the the AbilityId (integer), but not the ability type, for hashtable.
The AbilityId equals the rawcode that you can see in object editor.

Then for loading you can load value of key GetSpellAbilityId().
Of course this function now will also return an integer value, not an ability.

Can someone give me the codes to be used in a custom script?

Also, there is an additional Axxx within, so it's really confusing.

Edit:


The suggestion was to use 0.0312500. And 0.03 is smaller, so you it would not be below. :p

Yes, and the point was, it's already faster to the safest limit, yet he/she wanted to complicate things.
 
Level 5
Joined
Sep 11, 2010
Messages
56
I see you created a thread about this problem, let's move the discusson there if still needed.
And using 0.0312500 would not really complicate it. :eek:

Well, i have to change it when it's not needed.

Oh and i managed to clean things up with the hashtable, just give me a moment.

She/he dont know what is the different in 0.03125 in 0.03 :(

And i don't care. But okay:

http://www.hiveworkshop.com/forums/lab-715/0-03-vs-0-03125-a-240479/#post2410684

0.03125 adds up to 1, with 32 updates per second, while 0.03 does not add up to 1, and with 33.3333 updates per second. But the thing is that it's not necessary, because there is no timing calculated here.
 
Last edited:
Level 13
Joined
Jul 16, 2012
Messages
679
i add something...

Take Aim Attack, Visibility Attack Reveal, Visibility Cast Spell

In Take Aim Attack
(Level of Sniper - Take Aim for (Attacking unit)) Greater than 0

Visibility Attack Reveal
(Level of Sniper - Take Aim for (Attacking unit)) Less than or equal to 0

You must save the Ability in variable then change the (Level of Sniper - Take Aim for (Attacking unit), (Level of Sniper - Take Aim for (Attacking unit)

so like this
(Level of AbilityVar for (Attacking unit), (Level of AbilityVar for (Attacking unit)

===============

In your Visible Cast Spell
add Ability Cast equal to AbilityVar
 
Level 5
Joined
Sep 11, 2010
Messages
56
i add something...

Take Aim Attack, Visibility Attack Reveal, Visibility Cast Spell

In Take Aim Attack
(Level of Sniper - Take Aim for (Attacking unit)) Greater than 0

Visibility Attack Reveal
(Level of Sniper - Take Aim for (Attacking unit)) Less than or equal to 0

You must save the Ability in variable then change the (Level of Sniper - Take Aim for (Attacking unit), (Level of Sniper - Take Aim for (Attacking unit)

so like this
(Level of AbilityVar for (Attacking unit), (Level of AbilityVar for (Attacking unit)

===============

In your Visible Cast Spell
add Ability Cast equal to AbilityVar

What.
 
I think you have to be more patient, because it might take a while until a moderator reviews it. There are also some older resources waiting to be reviewed.

  • Take usage of hashtable instead of looping in trigger "Take Aim Attack".
  • This And - All block is not needed at all:
    • (And - All (Conditions) are true)
      • Conditions
        • (Level of Sniper - Take Aim for (Attacking unit)) Greater than 0
        • ((Attacking unit) is in DS_TA_Learned) Equal to True
    You just can move them out. Same here:
    • (And - All (Conditions) are true)
      • Conditions
        • ((Attacking unit) is A ranged attacker) Equal to True
        • (Level of Sniper - Take Aim for (Attacking unit)) Less than or equal to 0
        • ((Attacking unit) belongs to an enemy of (Triggering player)) Equal to True
  • Hardcoded things like following with using pre-placed units in main code is not acceptable:
    • Hero - Learn skill for Dwarven Sniper 0099 <gen>: Sniper - Take Aim
    • Unit - Set level of Sniper - Take Aim for Dwarven Sniper 0099 <gen> to 4
  • Again, you can use hashtable and save index for all UnitTypes. This would prevent not needed checks. (Take Aim Transformation - trigger)
  • Don't use the BJ functions of hashtable if you use custom script.
  • In your init trigger you can use a hardcoded loop through all UnitTypes to save into hashtable, so the user has not to bother with it.
  • Following should be in destroy & deindex part:
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Visibility_MUI_Index Less than or equal to 0
      • Then - Actions
        • Trigger - Turn off (This trigger)
      • Else - Actions
  • You leak player groups
  • Cast/Death/Visibility Attack Reveal trigger are to general. They would fire each time in a normal game even they are not needed.
  • Combine both triggers with same event "A Unit Is Attacked".
  • I'm in opinion naming of variables should be shorter and just more simple. Something like "MUI_INDEX" is not needed. Just call it Index. Also all these Temp_Integer_A/B/C for example, just unnecessarily long.
    You should use a general prefix that is used for all variables of your system, then one underscope and then a short and simple variable name.

Have a nice day. :csmile:
 
Last edited:
Level 5
Joined
Sep 11, 2010
Messages
56
I think you have to be more patient, because it might take a while until a moderator reviews it. There are also some older resources waiting to be reviewed.

  • Take usage of hashtable instead of looping in trigger "Take Aim Attack".
  • This And - All block is not needed at all:
    • (And - All (Conditions) are true)
      • Conditions
        • (Level of Sniper - Take Aim for (Attacking unit)) Greater than 0
        • ((Attacking unit) is in DS_TA_Learned) Equal to True
    You just can move them out. Same here:
    • (And - All (Conditions) are true)
      • Conditions
        • ((Attacking unit) is A ranged attacker) Equal to True
        • (Level of Sniper - Take Aim for (Attacking unit)) Less than or equal to 0
        • ((Attacking unit) belongs to an enemy of (Triggering player)) Equal to True
  • Hardcoded things like following with using pre-placed units in main code is not acceptable:
    • Hero - Learn skill for Dwarven Sniper 0099 <gen>: Sniper - Take Aim
    • Unit - Set level of Sniper - Take Aim for Dwarven Sniper 0099 <gen> to 4
  • Again, you can use hashtable and save index for all UnitTypes. This would prevent not needed checks. (Take Aim Transformation - trigger)
  • Don't use the BJ functions of hashtable if you use custom script.
  • In your init trigger you can use a hardcoded loop through all UnitTypes to save into hashtable, so the user has not to bother with it.
  • Following should be in destroy & deindex part:
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Visibility_MUI_Index Less than or equal to 0
      • Then - Actions
        • Trigger - Turn off (This trigger)
      • Else - Actions
  • You leak player groups
  • Cast/Death/Visibility Attack Reveal trigger are to general. They would fire each time in a normal game even they are not needed.
  • Combine both triggers with same event "A Unit Is Attacked".
  • I'm in opinion naming of variables should be shorter and just more simple. Something like "MUI_INDEX" is not needed. Just call it Index. Also all these Temp_Integer_A/B/C for example, just unnecessarily long.
    You should use a general prefix that is used for all variables of your system, then one underscope and then a short and simple variable name.

Have a nice day. :csmile:

Yeah, the other ones i can take. Leave my variable naming alone.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You could get rid of the hashtable bj functions (use natives) and the map specific unit actions in the initialization trigger.
Do the rest of the stuff IcemanBo mentioned.
Use a variable for the ability.

I really recommend using a hashtable for this since if there are lots of unit types and upgrades for each unit type, the system can become a nightmare to set up.

Needs Fix
 
Level 5
Joined
Sep 11, 2010
Messages
56
You could get rid of the hashtable bj functions (use natives) and the map specific unit actions in the initialization trigger.
Do the rest of the stuff IcemanBo mentioned.
Use a variable for the ability.

I really recommend using a hashtable for this since if there are lots of unit types and upgrades for each unit type, the system can become a nightmare to set up.

Needs Fix

Just hold on...
 
Top