• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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