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

Lock camera on variable unit

Status
Not open for further replies.
Level 5
Joined
Jul 5, 2014
Messages
155
I currently have some problem with the camera lock of certain units. I making an rpg and I want to lock the camera on heroes the same way warchasers do. The problem is that this campaign has multiple heroes, so I made a trigger to lock the camera on the hero currently selected. It worked fine with specific unit event, but since there are walking between maps (and because it's much more comfortable), I keep my heroes in variables and specific unit event has no reference to variable units. Is there a way to make this work?
 
Just user Player - Selection event and then Camera - Lock camera to unit.

  • One
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Trigger - Add to Two <gen> the event (Player - (Player((Integer A))) Selects a unit)
  • Two
    • Events
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Owner of (Triggering unit)) Equal to (Triggering player)
    • Actions
      • Camera - Lock camera target for (Triggering player) to (Triggering unit), offset by (0.00, 0.00) using Default rotation
 
Level 5
Joined
Jul 5, 2014
Messages
155
Oh, I see. Since the player is only the blue player (it's a single player campaign), I left out the integer part. It's working, but for some reason, the first hero needs two clicks to lock the camera. The second one works fine.
 
Level 5
Joined
Jul 5, 2014
Messages
155
  • Camera Locking Hero1
    • Events
      • Player - Player 2 (Blue) Selects a unit
    • Conditions
      • (Hero1 is selected by Player 2 (Blue)) Equal to True
      • (Owner of Hero1) Equal to Player 2 (Blue)
    • Actions
      • Camera - Lock camera target for Player 2 (Blue) to Hero1, offset by (0.00, 0.00) using Default rotation
  • Camera Locking Hero2
    • Events
      • Player - Player 2 (Blue) Selects a unit
    • Conditions
      • (Hero2 is selected by Player 2 (Blue)) Equal to True
      • (Owner of Hero2) Equal to Player 2 (Blue)
    • Actions
      • Camera - Lock camera target for Player 2 (Blue) to Hero2, offset by (0.00, 0.00) using Default rotation
 
Level 5
Joined
Jul 5, 2014
Messages
155
The separation is because I originally had this trigger, I just modified it with your player event suggestion. But I packed them together and used "triggering unit" instead of referring the individuals and this somehow solved the double-click problem o_O This version also saves me the trouble to trigger potential temporary heroes' camera. Thank you so much!
 
Status
Not open for further replies.
Top