• 🏆 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] My first third person camera lock all units

Status
Not open for further replies.
Level 2
Joined
Apr 22, 2007
Messages
16
This trigger can lock all units(all player colour,enemy and building)



variables
Position_of_picked_unit = Point

--------------------------------------------------------------------------
trigger:

3D on
Events
Player - Player 10 (Light Blue) types a chat message containing on as Match Type

Conditions

Actions
Trigger - Turn on Select all <gen>
Trigger - Turn on Deselect all <gen>
Trigger - Turn on lock cam all <gen>

--------------------------------------------------------------------------
trigger:

3D off
Events
Player - Player 10 (Light Blue) types a chat message containing off as Match Type

Conditions

Actions
Trigger - Turn off Select all <gen>
Trigger - Turn off Deselect all <gen>
Trigger - Turn off lock cam all <gen>
Camera - Reset camera for Player 10 (Light Blue) to standard game-view over 0.00 seconds

--------------------------------------------------------------------------
trigger:

Select all
Events
Player - Player 10 (Light Blue) Selects a unit

Conditions
(Player 10 (Light Blue) controller) equal User


Actions
Trigger - Turn on lock cam all <gen>

--------------------------------------------------------------------------
trigger:

Deselect all (Trigger is Initially On - Is off)
Events
Player - Player 10 (Light Blue) Deselects a unit

Conditions

Actions
Trigger - Turn off lock cam all <gen>

--------------------------------------------------------------------------
trigger:

lock cam all (Trigger is Initially On - Is off)
Events
Time - Every 0.60 seconds of game time

Conditions
(Player 10 (Light Blue) controller) equal User

Actions
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units currently selected by Player 10 (Light Blue)) and do (Actions)
Loop - Actions
Set Position_of_picked_unit = (Position of (Picked unit))
Camera - Lock camera target for Player 10 (Light Blue) to (Picked unit), offset by (0.00, 0.00) using Default Rotation
Camera - Pan camera for Player 10 (Light Blue) to Position_of_picked_unit over 2.00 seconds
Camera - Set Player 10 (Light Blue)'s camera Distance to target to 1200.00 over 3.75 seconds
Camera - Set Player 10 (Light Blue)'s camera Angle of Attack to -24.00 over 3.75 seconds
Camera - Set Player 10 (Light Blue)'s camera Height Offset to 100.00 over 1.00 seconds
Camera - Set Player 10 (Light Blue)'s camera Rotation to (Facing of (Picked unit)) over 2.30 seconds
Custom script: call RemoveLocation(udg_Position_of_picked_unit)

--------------------------------------------------------------------------

The trigger have any problem?
 
Last edited:
Level 10
Joined
Jul 14, 2004
Messages
463
Well this "lock cam all" trigger does not make much sense to me.
1. Using pick every unit here is completely senseless. It will just take the last unit in in the group and move the camera according to this, because the sways before won't be seen at all.
2. Using such big sway times will make the thing work very viscously. Did you try that out? Probably shorter sway times will make this much more useable.

Generally, I think locking camera to a unit group is very problematic, since the units can be anywhere. If you are sure that the selected units are always quite near to each other, move the camera to their middle (Location((sum of all UnitX of picked units / Count of picked units), (sum of all UnitY of picked units / count of picked units)).
 
Level 2
Joined
Apr 22, 2007
Messages
16
(Location((sum of all UnitX of picked units / Count of picked units), (sum of all UnitY of picked units / count of picked units))
I dont know how to make,but thanks reply.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Smurfs > Avatar > Naruto

umm thing you said is hard with GUI

Suggestion: Start JASS
I can teach BASICS of JASS to everyone in MSN
feel free to take my adress

(- OMG conceited
- so ?)
 
Level 10
Joined
Jul 14, 2004
Messages
463
I don't think it's complicated with GUI. Just use 4 Variables:
real SumX
real SumY
integer UnitCount
location TmpLoc

  • Calculate Target
    • Events
    • Conditions
    • Actions
      • Set SumX = 0.00
      • Set SumY = 0.00
      • Set UnitCount = 0
      • Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
        • Actions
          • Set TmpLoc = (Position of (Picked unit))
          • Set SumX = (SumX + (X of TmpLoc))
          • Set SumY = (SumY + (Y of TmpLoc))
          • Custom script: call RemoveLocation( udg_TmpLoc )
          • Set UnitCount = (UnitCount + 1)
      • Set TmpLoc = (Point((SumX / (Real(UnitCount))), (SumY / (Real(UnitCount)))))
      • -------- Now, TmpLoc contains the average location of all selected units --------
 
Level 2
Joined
Apr 22, 2007
Messages
16
I don't think it's complicated with GUI. Just use 4 Variables:
real SumX
real SumY
integer UnitCount
location TmpLoc

  • Calculate Target
    • Events
    • Conditions
    • Actions
      • Set SumX = 0.00
      • Set SumY = 0.00
      • Set UnitCount = 0
      • Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
        • Actions
          • Set TmpLoc = (Position of (Picked unit))
          • Set SumX = (SumX + (X of TmpLoc))
          • Set SumY = (SumY + (Y of TmpLoc))
          • Custom script: call RemoveLocation( udg_TmpLoc )
          • Set UnitCount = (UnitCount + 1)
      • Set TmpLoc = (Point((SumX / (Real(UnitCount))), (SumY / (Real(UnitCount)))))
      • -------- Now, TmpLoc contains the average location of all selected units --------

I've try but nothing happens why? Please help me!
 
Status
Not open for further replies.
Top