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

Flashlight system...

Status
Not open for further replies.
Level 13
Joined
Jul 15, 2007
Messages
763
Never made this system personally, but i bet it has something to do with adding an ability based on Item Sight Range Bonus when the flashlight is turned on, and removing it when it is turned off.

The Unit's vision should be 0 by default in your case (but beware that 0 might make the unit impossible to control if it is in fog)
 
Level 10
Joined
Apr 4, 2010
Messages
509
Here's something I quickly whipped up. It's basically moving a dummy unit in front of the caster.

  • Flash Light
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Level of Flash Light for (Ordered unit)) Greater than or equal to 1
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(manashieldon))
          • (Issued order) Equal to (Order(manashieldoff))
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(manashieldon))
        • Then - Actions
          • Set FL_Index = (FL_Index + 1)
          • Set FL_Unit[FL_Index] = (Ordered unit)
          • Set FL_TempPoint[0] = ((Position of FL_Unit[FL_Index]) offset by FL_FowardDistance towards (Facing of FL_Unit[FL_Index]) degrees)
          • Unit - Create 1 Footman for (Owner of FL_Unit[FL_Index]) at FL_TempPoint[0] facing Default building facing degrees
          • Set FL_Light[FL_Index] = (Last created unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FL_Index Equal to 1
            • Then - Actions
              • Trigger - Turn on Flash Light Loop <gen>
            • Else - Actions
        • Else - Actions
          • For each (Integer FL_Loop) from 1 to FL_Index, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Ordered unit) Equal to FL_Unit[FL_Loop]
                • Then - Actions
                  • Unit - Remove FL_Light[FL_Loop] from the game
                • Else - Actions
      • Custom script: call RemoveLocation (udg_FL_TempPoint[0])
  • Flash Light Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer FL_Loop) from 1 to FL_Index, do (Actions)
        • Loop - Actions
          • Set FL_TempPoint[1] = ((Position of FL_Unit[FL_Loop]) offset by FL_FowardDistance towards (Facing of FL_Unit[FL_Loop]) degrees)
          • Unit - Move FL_Light[FL_Loop] instantly to FL_TempPoint[1]
          • Custom script: call RemoveLocation (udg_FL_TempPoint[1])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (FL_Unit[FL_Loop] is dead) Equal to True
                  • FL_Light[FL_Loop] Equal to No unit
            • Then - Actions
              • Unit - Remove FL_Light[FL_Loop] from the game
              • Set FL_Unit[FL_Loop] = FL_Unit[FL_Index]
              • Set FL_Light[FL_Loop] = FL_Light[FL_Index]
              • Set FL_Index = (FL_Index - 1)
              • Set FL_Loop = (FL_Loop - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FL_Index Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
 

Attachments

  • Flash Light.w3x
    18.8 KB · Views: 44
Level 22
Joined
Feb 6, 2014
Messages
2,466
Here's something I quickly whipped up. It's basically moving a dummy unit in front of the caster.

  • Flash Light
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Level of Flash Light for (Ordered unit)) Greater than or equal to 1
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(manashieldon))
          • (Issued order) Equal to (Order(manashieldoff))
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(manashieldon))
        • Then - Actions
          • Set FL_Index = (FL_Index + 1)
          • Set FL_Unit[FL_Index] = (Ordered unit)
          • Set FL_TempPoint[0] = ((Position of FL_Unit[FL_Index]) offset by FL_FowardDistance towards (Facing of FL_Unit[FL_Index]) degrees)
          • Unit - Create 1 Footman for (Owner of FL_Unit[FL_Index]) at FL_TempPoint[0] facing Default building facing degrees
          • Set FL_Light[FL_Index] = (Last created unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FL_Index Equal to 1
            • Then - Actions
              • Trigger - Turn on Flash Light Loop <gen>
            • Else - Actions
        • Else - Actions
          • For each (Integer FL_Loop) from 1 to FL_Index, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Ordered unit) Equal to FL_Unit[FL_Loop]
                • Then - Actions
                  • Unit - Remove FL_Light[FL_Loop] from the game
                • Else - Actions
      • Custom script: call RemoveLocation (udg_FL_TempPoint[0])
  • Flash Light Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer FL_Loop) from 1 to FL_Index, do (Actions)
        • Loop - Actions
          • Set FL_TempPoint[1] = ((Position of FL_Unit[FL_Loop]) offset by FL_FowardDistance towards (Facing of FL_Unit[FL_Loop]) degrees)
          • Unit - Move FL_Light[FL_Loop] instantly to FL_TempPoint[1]
          • Custom script: call RemoveLocation (udg_FL_TempPoint[1])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (FL_Unit[FL_Loop] is dead) Equal to True
                  • FL_Light[FL_Loop] Equal to No unit
            • Then - Actions
              • Unit - Remove FL_Light[FL_Loop] from the game
              • Set FL_Unit[FL_Loop] = FL_Unit[FL_Index]
              • Set FL_Light[FL_Loop] = FL_Light[FL_Index]
              • Set FL_Index = (FL_Index - 1)
              • Set FL_Loop = (FL_Loop - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FL_Index Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions


The problem with that is, units will be able to see through trees , cliffs, sight blocker because you periodically move a dummy in front.
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Here's something I quickly whipped up. It's basically moving a dummy unit in front of the caster.

Well that's what I thought in the beginning, but I hate Periodic events since I use a lot of them necessarily, that's why I needed a non-periodic trigger.

Yet, if the tutorial which was linked by Flux won't work, I will stick to your test map.

Solved. +REP
 
Status
Not open for further replies.
Top