• 🏆 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] Boolean only true or false - I want more options.

Status
Not open for further replies.
Level 8
Joined
Feb 20, 2007
Messages
338
I have a simple true false statement:

Conditions:
First_person Equal to False


It is boolean

However I find that I want to have up to 6 if/then/else actions.

I believe I need to use an integer variable and an integer comparison - yes or no?

If so how do I go about setting it up to work.

I know that this should be one of the simplest things to do however when you consider the amount of stuff my triggers are dealing with (shown below) I think you can understand my confusion as to how to do this.

The set up trigger:

  • First Person setup
    • Events
      • Player - Player 9 (Gray) Selects a unit
    • Conditions
    • Actions
      • 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 Ship
              • (Unit-type of (Triggering unit)) Equal to Flying Machine
        • Then - Actions
          • Set First_person = True
        • Else - Actions
          • Set First_person = False
---> I removed all the players leaving just one for demonstration purposes.<---

Then the execution:

  • Apply First Person
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • First_person Equal to False
        • Then - Actions
          • For each (Integer A) from 1 to 12, do (Actions)
            • Loop - Actions
              • Camera - Set (Owner of SelectedUnit[(Integer A)])'s camera Angle of attack to Camera_AoA[(Integer A)] over 0.20 seconds
              • Camera - Set (Owner of SelectedUnit[(Integer A)])'s camera Field of view to (Camera_FieldOfView[(Integer A)] + 15.00) over 0.01 seconds
              • Camera - Set (Owner of SelectedUnit[(Integer A)])'s camera Roll to Camera_Roll[(Integer A)] over 0.01 seconds
              • Camera - Set (Owner of SelectedUnit[(Integer A)])'s camera Height Offset to ((Current flying height of SelectedUnit[(Integer A)]) + Camera_Height[(Integer A)]) over 0.01 seconds
              • Camera - Set (Owner of SelectedUnit[(Integer A)])'s camera Rotation to Camera_Rotation[(Integer A)] over 0.45 seconds
              • Camera - Set (Owner of SelectedUnit[(Integer A)])'s camera Distance to target to 500.00 over 0.01 seconds
              • Camera - Set (Owner of SelectedUnit[(Integer A)])'s camera Far Z to Camera_FarZ[(Integer A)] over 0.01 seconds
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • First_person Equal to True
        • Then - Actions
          • For each (Integer A) from 1 to 12, do (Actions)
            • Loop - Actions
              • Camera - Set (Owner of SelectedUnit[(Integer A)])'s camera Angle of attack to Camera_AoA_2[(Integer A)] over 0.20 seconds
              • Camera - Set (Owner of SelectedUnit[(Integer A)])'s camera Field of view to (Camera_FieldOfView[(Integer A)] + 15.00) over 0.01 seconds
              • Camera - Set (Owner of SelectedUnit[(Integer A)])'s camera Roll to Camera_Roll[(Integer A)] over 0.01 seconds
              • Camera - Set (Owner of SelectedUnit[(Integer A)])'s camera Height Offset to ((Current flying height of SelectedUnit[(Integer A)]) + Camera_Height[(Integer A)]) over 0.01 seconds
              • Camera - Set (Owner of SelectedUnit[(Integer A)])'s camera Rotation to Camera_Rotation[(Integer A)] over 0.20 seconds
              • Camera - Set (Owner of SelectedUnit[(Integer A)])'s camera Distance to target to 1100.00 over 0.01 seconds
              • Camera - Set (Owner of SelectedUnit[(Integer A)])'s camera Far Z to Camera_FarZ[(Integer A)] over 0.01 seconds
        • Else - Actions
The difference here is that if a ship or flying machine is selected the camera is at a much steeper angle of attack and further from the unit. All other moving ground units the camera is closer to the unit, has a lower angle of attack (one can see the horizon)

I find that using the ship (which is rather large) and the helicopter/flying machine (which is smaller) with the same distance tends to have the camera too far from the flying machine.

I also want to set it up to where when other specific units are selected the camera either zooms out, has a steeper angle of attack or does nothing.

I might also use the variable tied into regions, I have some rather high hills which always leads to the camera going through the hill as the unit goes down the mountain. I tried resetting camera height but then the far z limitations end up mucking up the view or the unit falls too far below the camera view and lets face it my hills are rounded not squares so I do not get smooth transitions.

I am uncertain as to how to use integer comparisons to achieve my goals.
 
Level 10
Joined
Jul 14, 2004
Messages
463
Hey, this looks rather interesting and I think you are on the right way...

Every player can only select one unit at a time and as soon as he selects it, he shall change to the selected units third-person view, right?

Well, I think boolean variable is right for you, but you need an boolean array, to store if its First_person (well, in fact it's third person, right? Does not matter... :wink:) for each player, just as you already store the selected units for each player. Then you even don't need many triggers for the setup anymore, just this one:
  • First Person setup
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • -------- Repeat for each player --------
      • Player - Player 12 (Dark green) Selects a unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Ship
        • Then - Actions
          • Set First_person = True
          • Set Camera_AoA[Player number of (Triggering player)] = yourAngleValueForShip
          • -------- Repeat for every other camera field for the ship --------
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to Flying Machine
            • Then - Actions
              • Set First_person = True
              • Set Camera_AoA[Player number of (Triggering player)] = yourAngleValueForFlyingMachine
              • -------- Repeat for every other camera field for the flying machine --------
            • Else - Actions
              • -------- if you want to add some additional units, just add some more if/then/else of the same type; in the last Else write --------
              • Set First_person = False
Then also a variation of the execution trigger:
  • Apply First Person
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • First_person[(Integer A)] Equal to False
            • Then - Actions
              • Camera - Set (Player((Integer A)))'s camera Angle of attack to Camera_AoA[(Integer A)] over 0.20 seconds
              • Camera - Set (Player((Integer A)))'s camera Field of view to (Camera_FieldOfView[(Integer A)] + 15.00) over 0.01 seconds
              • Camera - Set (Player((Integer A)))'s camera Roll to Camera_Roll[(Integer A)] over 0.01 seconds
              • Camera - Set (Player((Integer A)))'s camera Height Offset to ((Current flying height of SelectedUnit[(Integer A)]) + Camera_Height[(Integer A)]) over 0.01 seconds
              • Camera - Set (Player((Integer A)))'s camera Rotation to Camera_Rotation[(Integer A)] over 0.45 seconds
              • Camera - Set (Player((Integer A)))'s camera Distance to target to 500.00 over 0.01 seconds
              • Camera - Set (Player((Integer A)))'s camera Far Z to Camera_FarZ[(Integer A)] over 0.01 seconds
            • Else - Actions
              • -------- if the boolean First_person[(Integer A)] is not false, it has to be true --------
              • Camera - Set (Player((Integer A)))'s camera Angle of attack to Camera_AoA_2[(Integer A)] over 0.20 seconds
              • Camera - Set (Player((Integer A)))'s camera Field of view to (Camera_FieldOfView[(Integer A)] + 15.00) over 0.01 seconds
              • Camera - Set (Player((Integer A)))'s camera Roll to Camera_Roll[(Integer A)] over 0.01 seconds
              • Camera - Set (Player((Integer A)))'s camera Height Offset to ((Current flying height of SelectedUnit[(Integer A)]) + Camera_Height[(Integer A)]) over 0.01 seconds
              • Camera - Set (Player((Integer A)))'s camera Rotation to Camera_Rotation[(Integer A)] over 0.20 seconds
              • Camera - Set (Player((Integer A)))'s camera Distance to target to 1100.00 over 0.01 seconds
              • Camera - Set (Player((Integer A)))'s camera Far Z to Camera_FarZ[(Integer A)] over 0.01 seconds
            • Else - Actions
For the terrain problems: I'd use regions and build different triggers that adjusts the Camera_AoA as soon as a unit enters it to a value that prevents the camera from going through the object.

I hope you understood my ideas, otherways ask. :wink:


EDIT: Purple Poot, I don't understand what you referring to... anyways, that's Wraithwynd's problem.
 
Last edited:
Level 40
Joined
Dec 14, 2005
Messages
10,532
What I meant, Waldbaer, was;

  • If/Then/Else blahblah
    • If - Conditions
      • Unit-Type of (Triggering Unit) Equal to Flying Maching
    • Then - Actions
      • Set SomeInt = 1
    • Else - Actions
      • If/then/else blahblah
        • If - Conditions
          • Unit-Type of (Triggering Unit) Equal to Ship
        • Then - Actions
          • Set SomeInt = 2
        • Else - Actions
          • -------- So on --------
Then just compare SomeInt to each number in the cam function.
 
Status
Not open for further replies.
Top