[Trigger] Unit variable not being properly declared

Status
Not open for further replies.
Level 7
Joined
Dec 8, 2008
Messages
243
So. I've a pretty clever trigger here. The IF statement at the bottom is used in every single cinematic I use. This is the generic lay-out for conversations with NPCs in my game. Sometimes it works, sometimes it doesn't, and when it doesn't, it appears the variable QuestUnit, doesn't have a value, or doesn't declare the target unit of ability being cast, the QuestUnit. When it doesn't work, the quest NPC has no name, and the screen pans to the center of the map.

I've placed comments to make it easier to understand.

  • Copper Shells
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Talk (Heros)
      • (Target unit of ability being cast) Equal to Brother Daniel (2) 0001 <gen>
    • Actions
      • -------- Diablo Trigger (always first) --------
      • Trigger - Turn off (This trigger)
      • Trigger - Turn on Q1b <gen>
      • Trigger - Turn on Q1ba <gen>
      • -------- Quest Effects --------
      • Special Effect - Destroy QuestEffects[1]
      • Special Effect - Create a special effect attached to the overhead of Brother Daniel (2) 0001 <gen> using Objects\RandomObject\RandomObject.mdl
      • Set QuestEffects[1] = (Last created special effect)
      • -------- Sounds (if any) --------
      • Sound - Play QuestNew <gen>
      • Sound - Destroy (Last played sound)
      • -------- Quest stuff --------
      • Quest - Create a Optional quest titled Copper Shells with the description This quest has not ..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
      • Set QuestArray[0] = (Last created quest)
      • Quest - Change the description of QuestArray[0] to Collect a |cffcc660...
      • Quest - Create a quest requirement for QuestArray[0] with the description Collect a |cffcc660...
      • Set QuestRequirements[0] = (Last created quest requirement)
      • -------- Cinematic Dialog (Always at end) --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • -------- Cinematic Declarations --------
          • Set QuestUnit = (Target unit of ability being cast)
          • Set QuestLeakPoint[0] = (Position of (Target unit of ability being cast))
          • Set QuestLeakPoint[1] = (Position of Heroes[0])
          • Set QuestLeakPoint[2] = (Position of Heroes[1])
          • Set QuestLeakPoint[3] = (Position of Heroes[2])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • StoryMode Equal to True
            • Then - Actions
              • -------- Disable Storymode (possible bug-stop) --------
              • Trigger - Turn off StoryMode <gen>
              • For each (Integer A) from 0 to 2, do (Actions)
                • Loop - Actions
                  • Cinematic - Turn cinematic mode On for (Player group(Players[(Integer A)]))
                  • Camera - Pan camera for Players[(Integer A)] to QuestLeakPoint[0] over 0.00 seconds
              • Cinematic - Send transmission to (All players) from QuestUnit named (|c00feba0e[|r|c0020c000 + ((Name of QuestUnit) + |r|c00feba0e]|r)): Play No sound and display Hey, Big Brother. I.... Modify duration: Set to 12.00 seconds and Wait
              • Set QuestUnit = No unit
              • For each (Integer A) from 0 to 2, do (Actions)
                • Loop - Actions
                  • Cinematic - Turn cinematic mode Off for (Player group(Players[(Integer A)]))
                  • -------- Move Cameras back to Player's Hero --------
                  • Camera - Pan camera for Players[0] to QuestLeakPoint[1] over 0.00 seconds
                  • Camera - Pan camera for Players[1] to QuestLeakPoint[2] over 0.00 seconds
                  • Camera - Pan camera for Players[2] to QuestLeakPoint[3] over 0.00 seconds
              • -------- Enable Storymode (possible bug-stop) --------
              • Trigger - Turn on StoryMode <gen>
            • Else - Actions
              • Cinematic - Send transmission to (Player group((Owner of (Triggering unit)))) from QuestUnit named (|c00feba0e[|r|c0020c000 + ((Name of QuestUnit) + |r|c00feba0e]|r)): Play No sound and display Hey, Big Brother. I.... Modify duration: Set to 12.00 seconds and Wait
              • -------- If players aren't watching cinematic, inform them that the quest has started/ended --------
              • Game - Display to (All players matching ((Matching player) Not equal to (Owner of (Triggering unit)))) the text: ((|c00feba0e[|r|cff9999ff + ((Name of (Owner of (Triggering unit))) + |r|c00feba0e]|r)) + ( has accepted the quest + ((Name of the current trigger) + . Check quest log for details.)))
              • Set QuestUnit = No unit
          • For each (Integer A) from 0 to 3, do (Actions)
            • Loop - Actions
              • Custom script: call RemoveLocation(udg_QuestLeakPoint[GetForLoopIndexA()])
        • Else - Actions
 
Level 7
Joined
Dec 8, 2008
Messages
243
Adding the condition and using QuestLeakPoint[0] = Position of QuestUnit didn't work, but setting questunit as the first action in the trigger did, so thanks a lot. This has been troubling me for ages now.
 
Status
Not open for further replies.
Top