• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Detecting Trees infront of me

Status
Not open for further replies.
Level 9
Joined
Dec 4, 2007
Messages
562
How do I detect if there is trees infront of me?

Like if there is a tree infront of my hero then my hero will gain regain his collision size.
 
Level 17
Joined
Jun 28, 2008
Messages
776
You could use something like Pick every destructible and an if statement to see if the picked destructible is a tree. Then use a counter and increase it for each time the loop loops. The if the counter is 0 there are no nearby trees.

Not sure if there is a way to see if a destructible is a tree, but there might be a function for that.

Hope it helps
 
  • Melee Initialization
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Set Destructible[1] = (Destructible type 1)
    • Set Destructible[2] = (>>) and do on, until you get all the destructible types you want detected.
    • Set T_G = (Units owned by Player 1 (Red))
    • Unit Group - Pick every unit in T_G and do (Actions)
      • Loop - Actions
        • Set T_Unit = (Picked unit)
    • Custom script: call DestroyGroup (udg_T_G)
  • Detector
  • Events
    • Time - Every 0.04 seconds of game time
  • Conditions
  • Actions
    • Set PointU = (Position of T_Unit)
    • Set RegionU = (Region centered at PointU with size (30.00, 500.00))
    • Destructible - Pick every destructible in RegionU and do (Actions)
    • Loop - Actions
      • For each (Integer A) from 1 to X (X is the maximum number index you have for the "Destructible" variable)
      • Loop - Actions
        • If/ Then/ Else
          • If (Conditions)
            • (Destructible-type of (Picked destructible)) Equal to Destructible[X]
          • Then (Actions)
            • Unit - Turn collision for (T_Unit) On
    • Custom script: call RemoveLocation (udg_PointU)
 
Level 9
Joined
Dec 4, 2007
Messages
562
Just to clearify for everybody what this is, I am trying to make a jump system wich removes collizion if you are trying to walk past a tree.

  • Jump Tree
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set JumpFacing = (Facing of JumpUnit)
      • Set JumpUnitPoint = (Position of JumpUnit)
      • Set JumpRegionTree = (Region centered at (JumpUnitPoint offset by 60.00 towards JumpFacing degrees) with size (65.00, 65.00))
      • Destructible - Pick every destructible in JumpRegionTree and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Destructible-type of (Picked destructible)) Equal to Summer Tree Wall
            • Then - Actions
  • Unit - Turn collision for JumpUnit On
    • Else - Actions
Anybody know why it doesnt detect remove my collision size?
(I have set JumpUnit variable in another trigger)
 
Last edited:
Status
Not open for further replies.
Top