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

Cinematic in a Loop

Status
Not open for further replies.
Level 6
Joined
Feb 25, 2005
Messages
230
EDIT - Maybe this belongs in the Triggers & Scripts section.

Hullo!

I'm making my first cinematic. I'm having some problems though, so please take a look at this.

The cinema is supposed to show all heros being summond in the labyrinth (in the beginning of the game, as you may have guessed :p ). To do this, I'm using a 8-times-loop, 1 for each player. Then I'm checking if that player is playing, and of course not using that condition while testplaying. And if player slot is used by a player I'm showing that hero being summoned. That is how I want it to work.

The problem is that only the first Hero (for player 1, red) is shown.
Note that the cinematic does work! It is just that it seem like the "For each (Integer A) from 1 to 8, do (Actions)" does not jump to the next step.

Here is da trigger;

  • Cinema
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • Then - Actions
              • Set tempGroup = (All players)
              • Player Group - Pick every player in tempGroup and do (Actions)
                • Loop - Actions
                  • Camera - Apply Cameras[(Integer A)] for (Picked player) over 0.00 seconds
              • Custom script: call DestroyForce(udg_tempGroup)
              • Wait 1.00 seconds
              • Set tempPoint[1] = (Center of startpoints[(Integer A)])
              • Set tempPoint[2] = (Position of Loka Brunn 0000 <gen>)
              • Unit - Create 1 Hellcaller for (Player((Integer A))) at tempPoint[1] facing tempPoint[2]
              • Set Hero[(Integer A)] = (Last created unit)
              • Custom script: call RemoveLocation(udg_tempPoint[1])
              • Custom script: call RemoveLocation(udg_tempPoint[2])
              • Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
              • Special Effect - Destroy (Last created special effect)
              • Wait 1.50 seconds
            • Else - Actions
      • Wait 3.00 seconds
      • Trigger - Run Start <gen> (checking conditions)
Can you give me any help making this work out with the Loop? It would be 8 times more in the triggers if I can't use the Loop. Not nice.

Appreciate any kind of help or ideas of how to solve this!

Yours truly
Lingon
 
Last edited:
Level 3
Joined
Apr 4, 2007
Messages
28
You have wait commands inside the loop. This allows other triggers to run during that time, and the (A Integer) is a global variable. Use an integer variable to control the loop. Similar problems may happen if the trigger 'indirectly' executes other trigger, like moving an unit to a region, issuing an order, giving an item to a hero, etc; if there is an associated trigger and that trigger uses the (A Integer) or other of the global variables.
 
Level 6
Joined
Feb 25, 2005
Messages
230
Thanks alot for pointing that out! Knowing that, i could figure out how to fix all the problems i had.

I changed the loop-integer to a custom one, but still it didnt work. I tried some stuff and found out that the customs scripts was in the way... i moved them out of the loop, and then it worked! I actually dont know why it wont work with the scripts inside of the loop, but whatever. the backside of this is that i dont know if i stop all the leaks. Feel free to tell me if i dont.

If you're interested, heres the finished trigger (cut off some irrelevant stuff):

  • Cinematic start
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • For each (Integer tempInteger) from 1 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • Then - Actions
              • Set tempGroup = (All players)
              • Player Group - Pick every player in tempGroup and do (Actions)
                • Loop - Actions
                  • Camera - Apply Cameras[tempInteger] for (Picked player) over 0.00 seconds
              • Wait 1.00 seconds
              • Set tempPoint[1] = (Center of startpoints[tempInteger])
              • Set tempPoint[2] = (Position of Loka Brunn 0000 <gen>)
              • Unit - Create 1 Hellcaller for (Player(tempInteger)) at tempPoint[1] facing tempPoint[2]
              • Set Hero[tempInteger] = (Last created unit)
              • Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
              • Special Effect - Destroy (Last created special effect)
              • Wait 1.50 seconds
            • Else - Actions
      • Custom script: call DestroyForce(udg_tempGroup)
      • Custom script: call RemoveLocation(udg_tempPoint[1])
      • Custom script: call RemoveLocation(udg_tempPoint[2])
Thanks again. Tallyho!
 
Status
Not open for further replies.
Top