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

Picking all units inside player's view

Status
Not open for further replies.
Level 20
Joined
Jul 6, 2009
Messages
1,885
Is it possible to,for example,pick all units that are inside current view of a certain player? Or atleast to determine a point which is center of certain player's camera.
I saw this function:
  • Set Temp_Point1 = (Target of current camera view)
Though i assume that's not what i'm looking for as it does not ask for which player's camera.
 
Try something like this:
  • CameraPoint
    • Events
    • Conditions
    • Actions
      • Custom script: if GetLocalPlayer() == Player(0) then
      • Set TempLoc = (Target of current camera view)
      • Custom script: endif
Replace "Player(0)" with the player you want. Players go from 0-15 in JASS, so Player(0) is Player 1 (Red), Player(1) is Player 2 (Blue), and so on.

If you want the owner of the triggering unit, you use:
GetOwningPlayer(GetTriggerUnit())

If you want it for the (Triggering Player) then:
GetTriggerPlayer()

Hopefully that'll work.
 
Level 7
Joined
Apr 12, 2009
Messages
188
  • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
      • Custom script: if GetLocalPlayer() == GetEnumPlayer() then
      • Set TargetX = (Target X of current camera view)
      • Set TargetY = (Target Y of current camera view)
      • Custom script: endif
You could set a point variable in there too or w/e you want. Just watch out, if your game starts to desync in multiplayer then the cause is using GetLocalPlayer() in the wrong way [don't ask me about all the wrong ways of using it, I just know it can cause desyncs].
 
Status
Not open for further replies.
Top