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

[Trigger] Does this trigger make sense?

Status
Not open for further replies.
Level 8
Joined
Jul 29, 2010
Messages
319
  • Selecting strafing unit
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
      • Player - Player 9 (Gray) Selects a unit
      • Player - Player 10 (Light Blue) Selects a unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to (Owner of (Triggering unit))
        • Then - Actions
          • Set GroupSelect = (Units currently selected by (Owner of (Triggering unit)))
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Number of units in GroupSelect) Equal to 1
              • Then - Actions
                • Set StrafingUnit = (Triggering unit)
              • Else - Actions
                • Set StrafingUnit = No unit
                • Custom script: call DestroyGroup( udg_GroupSelect )
        • Else - Actions
          • Set StrafingUnit = No unit
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
  • If - Conditions
    • (Owner of (Triggering unit)) Equal to (Owner of (Triggering unit))
this is useless since it will always be true. drop this, and just do the

  • If - Conditions
    • (Number of units in GroupSelect) Equal to 1
also this wouldn't work with all the players.

if a Player 1 Red selects one unit, then this unit will be the StrafingUnit.
Once another player selects one unit, then StrafingUnit will be replaced with a new one.

In order to counter this, you need to make the StrafingUnit an array and make the index to (Player Number of (Triggering Player).

P.S (Owner of (Triggering Unit)) can be replaced by (Triggering Player)
 
Last edited:
Level 8
Joined
Jul 29, 2010
Messages
319
  • If - Conditions
    • (Owner of (Triggering unit)) Equal to (Owner of (Triggering unit))
this is useless since it will always be true. drop this, and just do the

  • If - Conditions
    • (Number of units in GroupSelect) Equal to 1
also this wouldn't work with all the players.

if a Player 1 Red selects one unit, then this unit will be the StrafingUnit.
Once another player selects one unit, then StrafingUnit will be replaced with a new one.

In order to counter this, you need to make the StrafingUnit an array and make the index to (Player Number of (Triggering Player).
okay, thank you :D

EDIT:
is this correct?
  • Selecting strafing unit
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
      • Player - Player 9 (Gray) Selects a unit
      • Player - Player 10 (Light Blue) Selects a unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Set GroupSelect = (Units currently selected by (Owner of (Triggering unit)))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in GroupSelect) Equal to 1
            • Then - Actions
              • Set StrafingUnit[(Player number of (Triggering player))] = (Triggering unit)
            • Else - Actions
              • Set StrafingUnit[(Player number of (Triggering player))] = No unit
              • Custom script: call DestroyGroup( udg_GroupSelect )
        • Else - Actions
          • Set StrafingUnit[(Player number of (Triggering player))] = No unit
 
Last edited:
Level 12
Joined
Sep 11, 2011
Messages
1,176
This should be what your trigger looks like now.

  • Selecting strafing unit
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - ... Selects a unit
      • Player - Player 10 (Light Blue) Selects a nit
    • Conditions
    • Actions
      • Set GroupSelect = (Units currently selected by (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in GroupSelect) Equal to 1
        • Then - Actions
          • Set StrafingUnit[(Player number of (Triggering player))] = (Triggering unit)
        • Else - Actions
          • Set StrafingUnit[(Player number of (Triggering player))] = No unit
      • Custom script: call DestroyGroup(udg_GroupSelect)
You could check if the right unit is stored in the variable and once the player selects more than one unit, the StrafingUnit will be empty. like this

  • Just for debug purpose
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer int) from 1 to 10, do (Actions)
        • Loop - Actions
          • Game - Display to (Player group((Player(int)))) the text: (Name of StrafingUnit[int])
 
Last edited:
Level 8
Joined
Jul 29, 2010
Messages
319
This should be what your trigger looks like now.


You could check if the right unit is stored in the variable and once the player selects more than one unit, the StrafingUnit will be empty. like this

  • Just for debug purpose
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer int) from 1 to 10, do (Actions)
        • Loop - Actions
          • Game - Display to (Player group((Player(int)))) the text: (Name of StrafingUnit[int])

Thank you, the trigger works but oddly enough
  • Just for debug purpose
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer int) from 1 to 10, do (Actions)
        • Loop - Actions
          • Game - Display to (Player group((Player(int)))) the text: (Name of StrafingUnit[int])
This trigger doesn't display anything, but no matter i suppose since the first trigger works, thank you, i also have another question, in this map how do i destroy the dummy unit when it hits elevated terrain,
 

Attachments

  • ARROW SHOT TEMPLATE.w3x
    21.8 KB · Views: 57
Level 12
Joined
Sep 11, 2011
Messages
1,176
I added this into the loop trigger

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Terrain cliff level at point[1]) Greater than terrainLevel
    • Then - Actions
      • Unit - Add a 0.01 second Generic expiration timer to (Picked unit)
      • Unit Group - Remove (Picked unit) from dummygroup
    • Else - Actions
  • Set terrainLevel = (Terrain cliff level at point[1])
 

Attachments

  • ARROW SHOT TEMPLATE.w3x
    23.2 KB · Views: 52
Level 8
Joined
Jul 29, 2010
Messages
319
I added this into the loop trigger

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Terrain cliff level at point[1]) Greater than terrainLevel
    • Then - Actions
      • Unit - Add a 0.01 second Generic expiration timer to (Picked unit)
      • Unit Group - Remove (Picked unit) from dummygroup
    • Else - Actions
  • Set terrainLevel = (Terrain cliff level at point[1])

Thank you, as you could probably tell i didn't make that, fruit forest made it for me but i've asked him so many questions over the past 3 days i didn't want to annoy him hahaha :D

EDIT: is it possible to stop the projectile from going over raised terrain and not just cliffs?
 
Last edited:
Level 12
Joined
Sep 11, 2011
Messages
1,176
I think terrain level only has integer value so only when it reach level 1 it will disappear.

You could probably use a missile system that is provided here in hive, but only if you intend to use it to any other spells you have (which is a lot of work to do). I'd rather leave it like that since there isn't really anything on the edge of the cliff that can be hit.
 
Level 8
Joined
Jul 29, 2010
Messages
319
I think terrain level only has integer value so only when it reach level 1 it will disappear.

You could probably use a missile system that is provided here in hive, but only if you intend to use it to any other spells you have (which is a lot of work to do). I'd rather leave it like that since there isn't really anything on the edge of the cliff that can be hit.
yeah i may have to leave it, it's just my map is very hilly because it's a forest map :/ and my players control 1 unit in third person mode so you can see the projectiles moving up and down with the terrain and it looks a little silly, what's the missile system?

EDIT: i found the missile system, i have no knowledge of jass so i think i'll leave it alone
 
Last edited:
Level 12
Joined
Sep 11, 2011
Messages
1,176
Try this and see if it looked better.

I changed the conditions to check if the pathability is off, if yes then remove the missile

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Terrain pathing at point[1] of type Walkability is off) Equal to True
    • Then - Actions
      • Unit Group - Remove (Picked unit) from dummygroup
      • Unit - Add a 0.01 second Generic expiration timer to (Picked unit)
      • Custom script: call RemoveLocation( udg_point[0] )
      • Custom script: call RemoveLocation( udg_point[1] )
      • Skip remaining actions
    • Else - Actions
 

Attachments

  • ARROW SHOT TEMPLATE.w3x
    23.1 KB · Views: 41
Level 8
Joined
Jul 29, 2010
Messages
319
Try this and see if it looked better.

I changed the conditions to check if the pathability is off, if yes then remove the missile

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Terrain pathing at point[1] of type Walkability is off) Equal to True
    • Then - Actions
      • Unit Group - Remove (Picked unit) from dummygroup
      • Unit - Add a 0.01 second Generic expiration timer to (Picked unit)
      • Custom script: call RemoveLocation( udg_point[0] )
      • Custom script: call RemoveLocation( udg_point[1] )
      • Skip remaining actions
    • Else - Actions
i'll do that now

EDIT: won't this trigger only remove the dummy unit if the terrain it's on isn't pathable, if so then it can still move up extreme hills, i'm just worried about this because it's a star wars map, so my units fire blaster bots instead of arrows, it looks pretty silly when you shoot at someone a few hills over and your projectile follows the ground moving up and down until it reaches it's max distance, i'm wondering why blizzard has flying units attached to the ground anyway, instead of just having them at a set height and ignoring the terrain below, allowing them to fly in a straight line
 
Last edited:
Level 12
Joined
Sep 11, 2011
Messages
1,176
do you mean that the arrow will go as in the picture ?

if yes, then it won't go up and down to reach there, instead it will vanish as soon as it hits a cliff edge.

unless you mean the hill that you make with raise and lower tool.. then it is indeed will do that.
 

Attachments

  • Arrow.jpg
    Arrow.jpg
    887 KB · Views: 72
Level 8
Joined
Jul 29, 2010
Messages
319
do you mean that the arrow will go as in the picture ?

if yes, then it won't go up and down to reach there, instead it will vanish as soon as it hits a cliff edge.

unless you mean the hill that you make with raise and lower tool.. then it is indeed will do that.
i meant a hill you make with the raise and lower tool :(, is there any triggers that will recognise the raised and lowered parts or is it all classed as Terrain?
 
Level 10
Joined
Sep 16, 2016
Messages
269
This one contains the flying arrow that isn't affected by terrain (more or less) and it gets destroyed when hit higher ground.
Well, I sorry Fruit and Venom for taking the liberty of fixing your edited maps. I was so lazy to create a new one at that time.
 

Attachments

  • Arrow Shot (reworked).w3x
    24.8 KB · Views: 71
Level 8
Joined
Jul 29, 2010
Messages
319
This one contains the flying arrow that isn't affected by terrain (more or less) and it gets destroyed when hit higher ground.
Well, I sorry Fruit and Venom for taking the liberty of fixing your edited maps. I was so lazy to create a new one at that time.
thanks :D i have another question, how do you make it so that when you press left and right, the unit strafes, so it moves left and right but still faces forward?

EDIT: btw your arrow shot map worked the first time, though when i initialized the map i got a trigger error but the map worked anyway, when i tried to initialize it again, i got a bunch of errors and map no longer runs

REEDIT: never mind, it runs again if you reload the map, but trying to run one instance of the map more than once gives errors saying there are triggers missing :?
 
Last edited:
Level 10
Joined
Sep 16, 2016
Messages
269
thanks :D i have another question, how do you make it so that when you press left and right, the unit strafes, so it moves left and right but still faces forward?

EDIT: btw your arrow shot map worked the first time, though when i initialized the map i got a trigger error but the map worked anyway, when i tried to initialize it again, i got a bunch of errors and map no longer runs

The spell I made was MUI. For similar use, you can change the angle, speed or whatever. Create event that detects arrow key and use the same actions like the arrow spell I use (angle +/-90); OR you can create 2 other spells left/right strafe with according angle +/- 90.

Btw, maps with vjass contents requires saving before any testing.
 
Level 8
Joined
Jul 29, 2010
Messages
319
The map works fine with me, and I couldn't replicate your image. It seems there was something wrong with the library. Try to update your jasshelper and open again.
okay i'll do that, just wanted to ask, will this trigger work, "PLAYERREDDROID" is the variable i'm using to represent the unit each player controls throughout the game, since each player only controls one unit on the map
  • Camera Check and reset
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (PLAYERREDDROID[(Player number of (Triggering player))] is being transported) Equal to True
        • Then - Actions
          • Do nothing
        • Else - Actions
          • Trigger - Turn off Tri Fighter Camera <gen>
          • Trigger - Turn off AAT Camera <gen>
          • Camera - Lock camera target for (Owner of PLAYERREDDROID[(Player number of (Triggering player))]) to PLAYERREDDROID[(Player number of (Triggering player))], offset by (0.00, 0.00) using Default rotation
          • Trigger - Turn on Default Camera <gen>
 
Level 8
Joined
Jan 28, 2016
Messages
486
I assume it would work but since the shortest periodic interval the game can run at is 0.03125 (1/32), you're better of with using 0.03 instead.
 
Level 8
Joined
Jul 29, 2010
Messages
319
I assume it would work but since the shortest periodic interval the game can run at is 0.03125 (1/32), you're better of with using 0.03 instead.
all other triggers run perfectly with 0.01

EDIT: how do i make this trigger turn itself off once 10 players have selected 1 unit each?
  • Setting players droid
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
      • Player - Player 9 (Gray) Selects a unit
      • Player - Player 10 (Light Blue) Selects a unit
    • Conditions
    • Actions
      • Set GroupSelect = (Units currently selected by (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in GroupSelect) Equal to 1
        • Then - Actions
          • Set PLAYERREDDROID[(Player number of (Triggering player))] = (Triggering unit)
        • Else - Actions
          • Set StrafingUnit[(Player number of (Triggering player))] = No unit
      • Custom script: call DestroyGroup( udg_GroupSelect )
 
Last edited:
Level 8
Joined
Jan 28, 2016
Messages
486
Where did you hear that from?

Heard about it years ago here on The Hive and other WC3 modding sites. I managed to find this thread though, where Nestharus brings up how Jass can only execute code 32 times a second and explains it very well. Should definitely check it out; it's worth the read, assuming he's right! Either way, having a code run 100 times a second compared to 32 times a second is a significant difference.

Looking back, I probably could've worded my previous post better.
 
Level 8
Joined
Jul 29, 2010
Messages
319
also this trigger seems to not work, the camera still
Heard about it years ago here on The Hive and other WC3 modding sites. I managed to find this thread though, where Nestharus brings up how Jass can only execute code 32 times a second and explains it very well. Should definitely check it out; it's worth the read, assuming he's right! Either way, having a code run 100 times a second compared to 32 times a second is a significant difference.

Looking back, I probably could've worded my previous post better.
Sounds pretty interesting, it's helpful to know these things :)
 
Status
Not open for further replies.
Top