• 🏆 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] Camera locks onto wrong unit

Status
Not open for further replies.
Level 4
Joined
Jul 30, 2005
Messages
66
When I test the map, in the update event, it follows around the proper rotation, but still locks onto player one's camera. This is the map initialization, and this is probably what would cause it to lock incorrectly. Any help is greatly appreciated.

  • Camera
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set WeaponSweepSound[1] = SwordSweep <gen>
      • Environment - Set sky to Lordaeron Summer Sky
      • Sound - Disable dawn and dusk sounds
      • Game - Disable selection and deselection functionality (Disable selection circles)
      • Game - Disable drag-selection functionality (Disable drag-selection box)
      • Game - Disable pre-selection functionality (Disable pre-selection circles, life bars, and object info)
      • Set TPlayerGroup = (All players)
      • Player Group - Pick every player in TPlayerGroup and do (Actions)
        • Loop - Actions
          • Set TUnitGroup = (Units owned by (Picked player) of type )
          • Unit Group - Pick every unit in TUnitGroup and do (Actions)
            • Loop - Actions
              • Set UnitController[(Player number of (Picked player))] = (Picked unit)
          • Custom script: call DestroyGroup(udg_TUnitGroup)
          • Set TUnitGroup = (Units owned by (Picked player) of type Footman)
          • Unit Group - Pick every unit in TUnitGroup and do (Actions)
            • Loop - Actions
              • Set UnitPlayer[(Player number of (Picked player))] = (Picked unit)
          • Custom script: call DestroyGroup(udg_TUnitGroup)
          • Set TUnitGroup = (Units owned by (Picked player) of type Select Head)
          • Unit Group - Pick every unit in TUnitGroup and do (Actions)
            • Loop - Actions
              • Set UnitHeadCreate[(Player number of (Picked player))] = (Picked unit)
          • Custom script: call DestroyGroup(udg_TUnitGroup)
          • Camera - Lock camera target for (Picked player) to UnitPlayer[(Player number of (Picked player))], offset by (0.00, 0.00) using The unit's rotation
          • Selection - Select UnitHeadCreate[(Player number of (Picked player))] for (Picked player)
          • Unit - Pause UnitController[(Player number of (Picked player))]
      • Custom script: call DestroyForce(udg_TPlayerGroup)
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
Update event:
  • View
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • -------- Camera --------
      • Set TPlayerGroup = (All players controlled by a User player)
      • Player Group - Pick every player in TPlayerGroup and do (Actions)
        • Loop - Actions
          • Camera - Set (Picked player)'s camera Rotation to (Facing of UnitPlayer[(Player number of (Picked player))]) over 0.50 seconds
          • Camera - Set (Picked player)'s camera Angle of attack to 335.00 over 0.50 seconds
          • Camera - Set (Picked player)'s camera Field of view to 100.00 over 0.50 seconds
          • Camera - Set (Picked player)'s camera Distance to target to 600.00 over 0.50 seconds
          • Set TLoc = (Position of UnitPlayer[(Player number of (Picked player))])
          • Camera - Set (Picked player)'s camera Height Offset to (((Real((Terrain cliff level at TLoc))) x 192.00) - ((((Source Z of current camera view) - (Target Z of current camera view)) x 1.00) - 64.00)) over 0.50 seconds
          • Camera - Pan camera for (Picked player) to TLoc over 0.50 seconds
          • Custom script: call RemoveLocation(udg_TLoc)
          • -------- Walk Forward --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ButtonForward[(Player number of (Picked player))] Equal to True
              • (UnitController[(Player number of (Triggering player))] is paused) Equal to False
            • Then - Actions
              • Set TLoc1 = (Position of UnitPlayer[(Player number of (Picked player))])
              • Set TLoc = (TLoc1 offset by (0.50 x (Current movement speed of UnitPlayer[(Player number of (Picked player))])) towards (Facing of UnitPlayer[(Player number of (Picked player))]) degrees)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Terrain pathing at TLoc of type Walkability is off) Equal to False
                • Then - Actions
                  • Unit - Order UnitPlayer[(Player number of (Triggering player))] to Move To TLoc
                • Else - Actions
              • Custom script: call RemoveLocation(udg_TLoc)
              • Custom script: call RemoveLocation(udg_TLoc1)
            • Else - Actions
      • Custom script: call DestroyForce(udg_TPlayerGroup)
 
Last edited:
Level 23
Joined
Nov 29, 2006
Messages
2,482
Please use trigger tags so that the trigger is easier to read.

trigger tags are [trigger*] Trigger text [/trigger*]
Remove the * and you get a trigger tag. Do not modify blank spaces from your copy paste.
  • Trigger hi....
 
Level 4
Joined
Sep 9, 2004
Messages
112
When I test the map, in the update event, it follows around the proper rotation, but still locks onto player one's camera. This is the map initialization, and this is probably what would cause it to lock incorrectly. Any help is greatly appreciated.

  • Camera
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set WeaponSweepSound[1] = SwordSweep <gen>
      • Environment - Set sky to Lordaeron Summer Sky
      • Sound - Disable dawn and dusk sounds
      • Game - Disable selection and deselection functionality (Disable selection circles)
      • Game - Disable drag-selection functionality (Disable drag-selection box)
      • Game - Disable pre-selection functionality (Disable pre-selection circles, life bars, and object info)
      • Set TPlayerGroup = (All players)
      • Player Group - Pick every player in TPlayerGroup and do (Actions)
        • Loop - Actions
          • Set TUnitGroup = (Units owned by (Picked player) of type )
          • Unit Group - Pick every unit in TUnitGroup and do (Actions)
            • Loop - Actions
              • Set UnitController[(Player number of (Picked player))] = (Picked unit)
          • Custom script: call DestroyGroup(udg_TUnitGroup)
          • Set TUnitGroup = (Units owned by (Picked player) of type Footman)
          • Unit Group - Pick every unit in TUnitGroup and do (Actions)
            • Loop - Actions
              • Set UnitPlayer[(Player number of (Picked player))] = (Picked unit)
          • Custom script: call DestroyGroup(udg_TUnitGroup)
          • Set TUnitGroup = (Units owned by (Picked player) of type Select Head)
          • Unit Group - Pick every unit in TUnitGroup and do (Actions)
            • Loop - Actions
              • Set UnitHeadCreate[(Player number of (Picked player))] = (Picked unit)
          • Custom script: call DestroyGroup(udg_TUnitGroup)
          • Camera - Lock camera target for (Picked player) to UnitPlayer[(Player number of (Picked player))], offset by (0.00, 0.00) using The unit's rotation
          • Selection - Select UnitHeadCreate[(Player number of (Picked player))] for (Picked player)
          • Unit - Pause UnitController[(Player number of (Picked player))]
      • Custom script: call DestroyForce(udg_TPlayerGroup)
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
Update event:

  • View
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • -------- Camera --------
      • Set TPlayerGroup = (All players controlled by a User player)
      • Player Group - Pick every player in TPlayerGroup and do (Actions)
        • Loop - Actions
          • Camera - Set (Picked player)'s camera Rotation to (Facing of UnitPlayer[(Player number of (Picked player))]) over 0.50 seconds
          • Camera - Set (Picked player)'s camera Angle of attack to 335.00 over 0.50 seconds
          • Camera - Set (Picked player)'s camera Field of view to 100.00 over 0.50 seconds
          • Camera - Set (Picked player)'s camera Distance to target to 600.00 over 0.50 seconds
          • Set TLoc = (Position of UnitPlayer[(Player number of (Triggering player))])
          • Camera - Set (Picked player)'s camera Height Offset to (((Real((Terrain cliff level at TLoc))) x 192.00) - ((((Source Z of current camera view) - (Target Z of current camera view)) x 1.00) - 64.00)) over 0.50 seconds
          • Camera - Pan camera for (Picked player) to TLoc over 0.50 seconds
          • Custom script: call RemoveLocation(udg_TLoc)
          • -------- Walk Forward --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ButtonForward[(Player number of (Picked player))] Equal to True
              • (UnitController[(Player number of (Triggering player))] is paused) Equal to False
            • Then - Actions
              • Set TLoc1 = (Position of UnitPlayer[(Player number of (Picked player))])
              • Set TLoc = (TLoc1 offset by (0.50 x (Current movement speed of UnitPlayer[(Player number of (Picked player))])) towards (Facing of UnitPlayer[(Player number of (Picked player))]) degrees)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Terrain pathing at TLoc of type Walkability is off) Equal to False
                • Then - Actions
                  • Unit - Order UnitPlayer[(Player number of (Triggering player))] to Move To TLoc
                • Else - Actions
              • Custom script: call RemoveLocation(udg_TLoc)
              • Custom script: call RemoveLocation(udg_TLoc1)
            • Else - Actions
      • Custom script: call DestroyForce(udg_TPlayerGroup)

Wrapped in tags for you but u should still do it in the origional post..

Ok, first I would change the "Map Initialization" event to "Elapsed Game time is 0.4 seconds." Then make the 2nd initially off and have the first one turn it on.

Next you forgot to specifiy a unit type the first time u set "TUnitGroup" in the first trigger.

Lastly I think your problem is solely right here in the first trigger:
  • Camera - Lock camera target for (Picked player) to UnitPlayer[(Player number of (Picked player))], offset by (0.00, 0.00) using The unit's rotation
 
Level 4
Joined
Jul 30, 2005
Messages
66
Ok, first I would change the "Map Initialization" event to "Elapsed Game time is 0.4 seconds." Then make the 2nd initially off and have the first one turn it on.
Tried it, no difference. I used map init out of laziness, I'll keep it this way, thanks.

Next you forgot to specifiy a unit type the first time u set "TUnitGroup" in the first trigger.
No, it just sets it to a controller unit type with a space for a name.

Lastly I think your problem is solely right here in the first trigger:
I gathered that too, but it looks fine. I'm wondering if there's something wrong with the GUI event?

Thanks for the Trigger stuff, saw it in the read me first, but didn't see the flags (I was probably not reading intentively) and decided to post it anyways.

edit: after completely turning off the view trigger, the camera is properly locked... but my movement stops working on all players, even when the controller is unpaused. I also replaced a triggering player with picked player, and that fixed that incorrect view.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
I think your flaws are these:
  • Set TLoc = (Position of UnitPlayer[(Player number of (Triggering player))])
  • (UnitController[(Player number of (Triggering player))] is paused) Equal to False
  • Unit - Order UnitPlayer[(Player number of (Triggering player))] to Move To TLoc
Since the event is "elapsed game time" there are no triggering player
 
Level 4
Joined
Sep 9, 2004
Messages
112
I think your flaws are these:
  • Set TLoc = (Position of UnitPlayer[(Player number of (Triggering player))])
  • (UnitController[(Player number of (Triggering player))] is paused) Equal to False
  • Unit - Order UnitPlayer[(Player number of (Triggering player))] to Move To TLoc
Since the event is "elapsed game time" there are no triggering player

Its periodic but yea, I think your right.. So if that is true, you would need to set each unit to its respective player.. Basically make a unit variable and a player variable that will refer to the unit one for each player..
 
Status
Not open for further replies.
Top