• 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] Selecting random hero bugs camera

Status
Not open for further replies.
Level 16
Joined
Jun 25, 2008
Messages
1,043
Selecting random hero bugs camera - SOLVED

so, i have this system for selecting a random hero:
  • pick random
    • Events
      • Unit - A unit enters Random pick <gen>
    • Conditions
      • ((Unit-type of (Entering unit)) Equal to Child) or ((Unit-type of (Entering unit)) Equal to Child (2))
    • Actions
      • Unit - Remove (Entering unit) from the game
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Entering unit)) is in Force1) Equal to True
        • Then - Actions
          • Unit - Create 1 Tavern1Heroes[(Random integer number between 1 and 4)] for (Owner of (Entering unit)) at (Center of Force1 town <gen>) facing Default building facing degrees
          • Camera - Pan camera for Player 1 (Red) to (Position of (Last created unit)) over 3.00 seconds
          • Wait 3.00 seconds
          • Camera - Rotate camera 360.00 degrees around (Position of (Last created unit)) for (Owner of (Last created unit)) over 5.00 seconds
          • Wait 5.00 seconds
          • Camera - Reset camera for (Owner of (Triggering unit)) to standard game-view over 0.00 seconds
          • Camera - Lock camera target for (Owner of (Last created unit)) to (Last created unit), offset by (0.00, 0.00) using The unit's rotation
          • Camera - Set the camera bounds for (Owner of (Last created unit)) to Force 1 town area <gen>
        • Else - Actions
The problem is, the camera doesnt attach to the created hero, it gets stuck at the area where he is created, not moving at all.
I got almost the same script for my other heroes, that works perfectly
example:
  • pick marine
    • Events
      • Unit - A unit enters Human pick <gen>
    • Conditions
      • ((Unit-type of (Entering unit)) Equal to Child) or ((Unit-type of (Entering unit)) Equal to Child (2))
    • Actions
      • Unit - Kill (Entering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Entering unit)) is in Force1) Equal to True
        • Then - Actions
          • Unit - Create 1 Human Shooter for (Owner of (Entering unit)) at (Center of Force1 town <gen>) facing (Position of Traceys Armory 0021 <gen>)
          • Camera - Pan camera for Player 1 (Red) to (Position of (Last created unit)) over 3.00 seconds
          • Wait 3.00 seconds
          • Camera - Rotate camera 360.00 degrees around (Position of (Last created unit)) for (Owner of (Last created unit)) over 5.00 seconds
          • Wait 5.00 seconds
          • Camera - Reset camera for (Owner of (Triggering unit)) to standard game-view over 0.00 seconds
          • Camera - Lock camera target for (Owner of (Last created unit)) to (Last created unit), offset by (0.00, 0.00) using The unit's rotation
          • Camera - Set the camera bounds for (Owner of (Last created unit)) to Force 1 town area <gen>
        • Else - Actions

Anybody have any idea on how to solve this? :/
 
Last edited:
Level 16
Joined
Jun 25, 2008
Messages
1,043
Together with your comment and a bit of triggering i solved it myself, using this trigger:
  • pick random
    • Events
      • Unit - A unit enters Random pick <gen>
    • Conditions
      • ((Unit-type of (Entering unit)) Equal to Child) or ((Unit-type of (Entering unit)) Equal to Child (2))
    • Actions
      • Unit - Remove (Entering unit) from the game
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Entering unit)) is in Force1) Equal to True
        • Then - Actions
          • Unit - Create 1 Tavern1Heroes[(Random integer number between 1 and 4)] for (Owner of (Entering unit)) at (Center of Force1 town <gen>) facing Default building facing degrees
          • Set PlayersHero[(Player number of (Owner of (Triggering unit)))] = (Last created unit)
          • Camera - Pan camera for (Owner of PlayersHero[(Player number of (Owner of (Last created unit)))]) to (Position of (Last created unit)) over 1.00 seconds
          • Wait 1.00 seconds
          • Camera - Reset camera for (Owner of (Triggering unit)) to standard game-view over 0.00 seconds
          • Camera - Lock camera target for (Owner of (Last created unit)) to PlayersHero[(Player number of (Owner of (Triggering unit)))], offset by (0.00, 0.00) using The unit's rotation
          • Camera - Set the camera bounds for (Owner of (Last created unit)) to Force 1 town area <gen>
        • Else - Actions
so, thanks for your help i suppose :)
This can be moved to solved stuff, if there's a section for that?
 
Status
Not open for further replies.
Top