• 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.

[Trigger] Need help with camera/unit height trigger.

Status
Not open for further replies.
Level 8
Joined
Feb 20, 2007
Messages
338
Sorry for the length of this post, I'm trying to include as much information here as possible. I include three images of a flying unit to give an idea of how altitude is going to affect the camera Angle of Attack (AoA)

I have been pounding away for weeks on an RPG unit following camera set up, to where the camera follows behind the unit, slightly above. Of course that has lead to other things, such as a "spell" that causes flying units to ascend and descend - sort of like an aircraft simulator.

My units can be moved about either via the mouse clicks, or through the arrow keys.

The up key is forward, the right key is right, the left key is left and the down key turns the units completely around. I had wanted the unit to walk backward but couldn't get it to work. To prevent conflicts and to not have to turn on/turn off movement triggers I ditched the idea of having my flying units set with a constant movement forward after take off picking up speed as they ascend. I did have two sets of triggers set up for movement - ground units and flying units to where the up and down arrow key for ground units was forward movement and turn around, and for lying units it was ascend and descend. Too complicated and messy so I settled for two spells in flight, Ascend (Q) and descend (A) which means the player could have on hand on the arrow keys and the other pressing Q and A to climb and descend.

From the images below to see that the camera angle of attack changes at a certain height. The higher the unit the steeper the AoA allowing the player to see the ground and also hiding the fact that the FarZ cuts off the world.

As far as I can tell my triggers are working. The first trigger posted here 'Ascend' is coupled with a Descend, pretty much the same but in the negatives going down instead of up.

They are working, I just do not like the way it works.

  • Ascend
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ascend 'Q' (Flight Controls)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Current flying height of (Casting unit)) Less than or equal to 200.00
        • Then - Actions
          • Unit - Set (Casting unit) movement speed to (Default movement speed of (Triggering unit))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Current flying height of (Casting unit)) Greater than or equal to 3000.00
        • Then - Actions
          • Unit - Order (Casting unit) to Stop
          • Leaderboard - Change the title of alticheck to (Altitude: + (String((Current flying height of (Casting unit)))))
          • Do nothing
        • Else - Actions
          • Animation - Change (Casting unit) flying height to ((Current flying height of (Casting unit)) + 100.00) at 25.00
          • Leaderboard - Change the title of alticheck to (Altitude: + (String((Current flying height of (Casting unit)))))
          • Unit - Set (Casting unit) movement speed to ((Current movement speed of (Casting unit)) + 5.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Current flying height of (Casting unit)) Greater than or equal to 2000.00
        • Then - Actions
          • Unit - Make (Casting unit) Invulnerable
        • Else - Actions
In another trigger I have my variable settings for the camera based on player selects a unit:

An example:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Helicopter
          • (Unit-type of (Triggering unit)) Equal to Gryphon Rider
          • (Unit-type of (Triggering unit)) Equal to Dragonhawk Rider
    • Then - Actions
      • Set CamSetting = 3
    • Else - Actions
Then in yet another trigger I have the apply camera trigger:

  • Apply First Person
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CamSetting Equal to 0
        • Then - Actions
          • -------- --------Ground Units not buildings --------
          • Camera - Set Player 9 (Gray)'s camera Angle of attack to 340.00 over 0.20 seconds
          • Camera - Set Player 9 (Gray)'s camera Field of view to 500.00 over 0.01 seconds
          • Camera - Set Player 9 (Gray)'s camera Roll to 0.00 over 0.01 seconds
          • Camera - Set Player 9 (Gray)'s camera Height Offset to ((Current flying height of Selected_Unit) + 130.00) over 0.01 seconds
          • Camera - Set Player 9 (Gray)'s camera Distance to target to 350.00 over 0.01 seconds
          • Camera - Set Player 9 (Gray)'s camera Far Z to 6000.00 over 0.01 seconds
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • (Snip for length)
    • If - Conditions
      • CamSetting Equal to 2
    • Then - Actions
      • -------- Small Flying Craft --------
      • Camera - Set Player 9 (Gray)'s camera Angle of attack to 310.00 over 0.20 seconds
      • Camera - Set Player 9 (Gray)'s camera Field of view to 500.00 over 0.01 seconds
      • Camera - Set Player 9 (Gray)'s camera Roll to 0.00 over 0.01 seconds
      • Camera - Set Player 9 (Gray)'s camera Height Offset to ((Current flying height of Selected_Unit) + 90.00) over 0.01 seconds
      • Camera - Set Player 9 (Gray)'s camera Distance to target to 400.00 over 0.01 seconds
      • Camera - Set Player 9 (Gray)'s camera Far Z to 7500.00 over 0.01 seconds
    • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • CamSetting Equal to 3
        • (Current flying height of Selected_Unit) Less than or equal to 700.00
      • Then - Actions
        • -------- Small Flying Craft --------
        • Camera - Set Player 9 (Gray)'s camera Angle of attack to 340.00 over 0.20 seconds
        • Camera - Set Player 9 (Gray)'s camera Field of view to 500.00 over 0.01 seconds
        • Camera - Set Player 9 (Gray)'s camera Roll to 0.00 over 0.01 seconds
        • Camera - Set Player 9 (Gray)'s camera Height Offset to ((Current flying height of Selected_Unit) + 90.00) over 0.01 seconds
        • Camera - Set Player 9 (Gray)'s camera Distance to target to 400.00 over 0.01 seconds
        • Camera - Set Player 9 (Gray)'s camera Far Z to 7500.00 over 0.01 seconds
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • CamSetting Equal to 3
        • (Current flying height of Selected_Unit) Greater than or equal to 701.00
        • (Current flying height of Selected_Unit) Less than or equal to 1200.00
      • Then - Actions
        • -------- Small Flying Craft --------
        • Camera - Set Player 9 (Gray)'s camera Angle of attack to 325.00 over 0.20 seconds
        • Camera - Set Player 9 (Gray)'s camera Field of view to 500.00 over 0.01 seconds
        • Camera - Set Player 9 (Gray)'s camera Roll to 0.00 over 0.01 seconds
        • Camera - Set Player 9 (Gray)'s camera Height Offset to ((Current flying height of Selected_Unit) + 90.00) over 0.01 seconds
        • Camera - Set Player 9 (Gray)'s camera Distance to target to 400.00 over 0.01 seconds
        • Camera - Set Player 9 (Gray)'s camera Far Z to 7500.00 over 0.01 seconds
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • CamSetting Equal to 3
        • (Current flying height of Selected_Unit) Greater than or equal to 1201.00
      • Then - Actions
        • -------- Small Flying Craft --------
        • Camera - Set Player 9 (Gray)'s camera Angle of attack to 310.00 over 0.20 seconds
        • Camera - Set Player 9 (Gray)'s camera Field of view to 500.00 over 0.01 seconds
        • Camera - Set Player 9 (Gray)'s camera Roll to 0.00 over 0.01 seconds
        • Camera - Set Player 9 (Gray)'s camera Height Offset to ((Current flying height of Selected_Unit) + 90.00) over 0.01 seconds
        • Camera - Set Player 9 (Gray)'s camera Distance to target to 400.00 over 0.01 seconds
        • Camera - Set Player 9 (Gray)'s camera Far Z to 7500.00 over 0.01 seconds
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • (Snip for length)
    • If - Conditions
      • CamSetting Equal to 9
    • Then - Actions
      • -------- Catapult --------
And in other triggers (Enter/leaves region events various conditions) I have more set Camsetting = X being yet more numbers.

Here are my problems:

1. The camera leaps upward while the flying unit is taking a bit of time to ascend into the sky (over coming gravity takes a bit of time and energy). I'm trying to temper the need for as few castings of the Ascend/Descend spell as possible while keeping the camera with the unit.

I wanted the camera to slowly climb with the unit and the AOA to steepen with each casting of the ascend "spell" or with the height of the unit and flatten out as the unit descended. I settled for cut off points (as seen in the three images below) because I simply could not figure out how to adjust the AoA with the unit's flying height.

When I had the spell set to cause the unit to climb/descend 10 over 0.00 seconds the camera was a lot smoother - however to reach the maximum altitude of 2500 would take casting the spell 250 times... a little too much. I settled for a climb of 100.00 each casting still requires 25 casts to get to max altitude - meaning the player still has to click the spell or hit Q (ascend) or A (descend) a lot. Ideally I wanted climbing and descending 500 over a period of 2-3 seconds reducing the number of key strokes to reach max altitude to 5 keystrokes (casts of the spell). But the camera leaps upward 500 and the unit although climbing at a rate of 25 falls well below the camera.

I thought that current flying height would be whatever the unit's altitude is at that 0.5 second - but instead the camera is leaping to the units future height that the unit is climbing to over a bit of time.

2. Although I started an Altimeter leaderboard for my own information so when I test the map I get an idea of where the unit is I of course now want it for the game. Thing is that the numbers are meaningless to what we see.

In image one we have 650 which really can't be 750 feet. The second I have an altitude of 7500, the 3rd 1250 - I would imagine that the real numbers should be something like 65, 75 and 125 I do not know how to convert the trigger function:

  • Leaderboard - Change the title of alticheck to (Altitude: + (String((Current flying height of (Casting unit)))))
into something more meaningful. I would think it would be something along the lines of "Leaderboard - Change the title of alticheck to (Altitude: + (String((Current flying height of (Casting unit))))) (divided by) 10" I can not figure out how to convert to this math. I'm lousy when it comes to these strings.


Lastly, am I leaking here? :ugly:
 

Attachments

  • fly01.jpg
    fly01.jpg
    84.8 KB · Views: 2,676
  • fly02.jpg
    fly02.jpg
    88.1 KB · Views: 2,653
  • fly03.jpg
    fly03.jpg
    83.1 KB · Views: 2,667
Status
Not open for further replies.
Top