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

[Need Info] Doing it right?

Status
Not open for further replies.

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
'Ello.

I just bought HotS to try out the editor in SC II once more. Gotta say I love some of the features. Anyway, I have created two systems which are MUI and seems to work with my limited testing.

I have nice knowledge in wc3 which is why I want to know the differences.

1. Do we need to null locals?
2. Do we need to remove point variables after usage?

I am open for general improvements, though do not be too harsh as this is merely training and nothing serious as of yet xD


  • Enters Map
    • Events
      • Unit - Any Unit Enters (Entire map)
    • Local Variables
    • Conditions
      • ((Unit type of (Triggering unit)) is Missile) != True
    • Actions
      • Unit - Set (Triggering unit) custom value custom value channel to number of indexes
      • Variable - Set indexed Units[number of indexes] = (Triggering unit)
      • Variable - Set number of indexes = (number of indexes + 1)
  • Dies
    • Events
      • Unit - Any Unit dies
      • Unit - Any Unit Leaves (Entire map)
    • Local Variables
      • i = 0 <Integer>
    • Conditions
    • Actions
      • General - For each integer i from (Integer((Custom value 0 of (Triggering unit)))) to (number of indexes - 1) with increment 1, do (Actions)
        • Actions
          • Variable - Set indexed Units[i] = indexed Units[(i + 1)]
          • Unit - Set indexed Units[i] custom value custom value channel to i
      • Variable - Set number of indexes = (number of indexes - 1)
  • Test
    • Events
      • UI - Player Any Player presses Space key Down with shift Allow, control Allow, alt Allow
    • Local Variables
      • i = 0 <Integer>
    • Conditions
    • Actions
      • General - For each integer i from 0 to (number of indexes - 1) with increment 1, do (Actions)
        • Actions
          • Debug - Display ("Indexed: " + ((Name of (Unit type of indexed Units[i])) + (Text((Custom value 0 of indexed Units[i])) with Any Precision decimal places))) as debug output using Type 01, and Do display it in the game window


  • Apply
    • Events
    • Local Variables
      • id = (Integer((Custom value custom value channel of Target))) <Integer>
    • Conditions
    • Actions
      • Variable - Set Destination[id] = Loc
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • (All units in Group are dead) == True
        • Then
          • Trigger - Turn Loop On
        • Else
      • Unit Group - Add Target to Group
  • Loop
    • Events
      • Timer - Every 0.1 seconds of Game Time
    • Local Variables
      • u = No Unit <Unit>
      • id = 0 <Integer>
      • p = No Point <Point>
      • p2 = No Point <Point>
    • Conditions
    • Actions
      • Unit Group - Pick each unit in Group and do (Actions)
        • Actions
          • Variable - Set u = (Picked unit)
          • Variable - Set id = (Integer((Custom value custom value channel of u)))
          • Variable - Set p = (Position of u)
          • Variable - Set Angle = (Angle from p to Destination[id])
          • Variable - Set p2 = (p offset by Speed towards Angle degrees)
          • Unit - Move u instantly to p2 (Blend)
          • General - If (Conditions) then do (Actions) else do (Actions)
            • If
              • (Distance between p2 and Destination[id]) <= 0.75
            • Then
              • Unit Group - Remove u from Group
              • General - If (Conditions) then do (Actions) else do (Actions)
                • If
                  • (All units in Group are dead) == True
                • Then
                  • Trigger - Turn Loop Off
                • Else
            • Else
  • Demo
    • Events
      • Unit - Any Unit takes Non-Fatal Any damage (from Any effects)
    • Local Variables
    • Conditions
    • Actions
      • Variable - Set Target = (Triggering unit)
      • Variable - Set Loc = ((Position of Target) offset by 2.5 towards (Facing of (Damaging unit)) degrees)
      • Trigger - Run Apply (Ignore Conditions, Don't Wait until it finishes)


1e3421dccf341cea3f22283e31b51fc8.png

 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
1. Do we need to null locals?
SC2 is not buggy so no they do not need to be nulled.

2. Do we need to remove point variables after usage?
No as SC2 has a garbage collector. They are automatically removed once all references are lost (when they would leak in WC3).

Do be aware that SC2 has a finite heap size. Generally allocating arrays of 8192 for every purpose is not recommended and will quickly result in you running out of heap space.

Timer - Every 0.1 seconds of Game Time
Should be every 0.0625 seconds since that is 1 deterministic frame (smallest time in SC2 engine outside of actors).

Knockback is already supported by Effects catalog in the Data Editor. This is how they implemented Heroes of the Storm abilities like Raynor's Penetrating Rounds or Diablo's Shadow Charge.
 
Status
Not open for further replies.
Top