• 🏆 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!

Setting 1 unit (Hero) to 2 variables

Status
Not open for further replies.
Level 18
Joined
May 11, 2012
Messages
2,103
  • Hero Selection Select
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
    • Conditions
      • HeroSelection_PlayerChosen[(Player number of (Triggering player))] Equal to False
      • ((Triggering unit) is in HeroSelection_AvailableHeroes) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to HS_PlayerCurrentSelection[(Player number of (Triggering player))]
        • Then - Actions
          • For each (Integer B) from 1 to HeroCount, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Triggering unit) Equal to HeroSelection_HeroUnit[(Integer B)]
                • Then - Actions
                  • Set ReturnFromMission = (Center of Return from Mission <gen>)
                  • Unit - Change ownership of (Triggering unit) to (Triggering player) and Change color
                  • Unit - Move (Triggering unit) instantly to ReturnFromMission
                  • Unit - Unpause (Triggering unit)
                  • Set CameraHero[(Integer B)] = (Triggering unit)
                  • Hero - Create |cFFFFFF00Healing Potion and give it to (Triggering unit)
                  • Item - Set charges remaining in (Last created item) to 15
                  • Hero - Create |cFFFFFF00Mana Potion and give it to (Triggering unit)
                  • Item - Set charges remaining in (Last created item) to 15
                  • Hero - Create |cFFFFFF00Ankh of Reincarnation and give it to (Triggering unit)
                  • Unit Group - Remove (Triggering unit) from HeroSelection_AvailableHeroes
                  • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Human\ReviveHuman\ReviveHuman.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Set TempPoint = (Center of Return from Mission <gen>)
                  • Camera - Pan camera for (Triggering player) to TempPoint over 0.00 seconds
                  • Custom script: call RemoveLocation(udg_ReturnFromMission)
                  • Floating Text - Destroy HeroSelection_FloatingText[(Integer B)]
                  • Set HeroSelection_PlayerChosen[(Player number of (Triggering player))] = True
                • Else - Actions
        • Else - Actions
          • Set HS_PlayerCurrentSelection[(Player number of (Triggering player))] = (Triggering unit)
  • Suprise Circle Enter
    • Events
      • Unit - A unit enters Suprise Circle <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to SupriseCircle_EnteringUnit
        • Then - Actions
          • Set PlayerGroup = (Player group((Owner of SupriseCircle_EnteringUnit)))
          • Game - Display to PlayerGroup the text: |c00FFD700You canno...
          • Custom script: call DestroyForce(udg_PlayerGroup)
        • Else - Actions
          • Set SupriseCircle_EnteringUnit = (Triggering unit)
          • Set RandomNumber = (Random integer number between 1 and 18)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomNumber Equal to 1
            • Then - Actions
              • Set PlayerGroup = (Player group((Owner of (Triggering unit))))
              • Player - Add 100000 to (Owner of (Triggering unit)) Current gold
              • Game - Display to PlayerGroup the text: |c00FFD700Congratul...
              • Custom script: call DestroyForce(udg_PlayerGroup)
              • Countdown Timer - Start SupriseCircle_Timer as a One-shot timer that will expire in 180.00 seconds
              • Floating Text - Change text of Suprise_Text to (|c0000FFFFCooldown: + (|c0000FFFF + ((String(SC_Minutes)) + (|c0000FFFF + (: + (String(SC_Seconds))))))) using font size 15.00
              • Trigger - Turn on Suprise Circle Countdown <gen>
              • Trigger - Turn off (This trigger)
Now you can see in first trigger I set my hero to first variable, and when I enter the circle, it is set to second variable. Why then Variable CameraHero no longer refers to my hero? It instead of my hero, refers to the Circle I entered :ogre_rage:
 
Level 7
Joined
May 11, 2010
Messages
278
  • Set CameraHero[(Integer B)] = (Triggering unit)
This function won't do anything, as there is no triggering unit. The event has a player trigger, therefore "Triggering Unit" refers to no unit at all.
There should be something like "Selected Unit" you can use instead.

It's the same with
  • ((Triggering unit) is in HeroSelection_AvailableHeroes) Equal to True
  • (Triggering unit) Equal to HS_PlayerCurrentSelection[(Player number of (Triggering player))]
  • (Triggering unit) Equal to HeroSelection_HeroUnit[(Integer B)]
  • Unit - Change ownership of (Triggering unit) to (Triggering player) and Change color
  • Unit - Move (Triggering unit) instantly to ReturnFromMission
  • Unit - Unpause (Triggering unit)
  • Set CameraHero[(Integer B)] = (Triggering unit)
  • Hero - Create |cFFFFFF00Healing Potion and give it to (Triggering unit)
  • Hero - Create |cFFFFFF00Mana Potion and give it to (Triggering unit)
  • Hero - Create |cFFFFFF00Ankh of Reincarnation and give it to (Triggering unit)
  • Unit Group - Remove (Triggering unit) from HeroSelection_AvailableHeroes
  • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Human\ReviveHuman\ReviveHuman.mdl
  • Set HS_PlayerCurrentSelection[(Player number of (Triggering player))] = (Triggering unit)
None of these should work properly, as there is no "Triggering unit"
 
Status
Not open for further replies.
Top