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

[Solved] Periodic TP problem.

Status
Not open for further replies.
For a maze i'm making, i needed a periodic tp to the rect 1, then rect 2, etc...

But after this, i had the idea of re-enter at the end of lvl to go to the next level. I worked with custom value to do this. And i simply check if the custom value of my hero = 2 to teleport it to the next level.

And my problem is that the second time (when i have normally the custom value 2) i'm teleported as if i had 0 or 1 custom value.

So, here are the triggers :

  • Initialisation mêlée
    • Evénements
      • Map initialization
    • Conditions
    • Actions
      • -------- Incomplete trigger, since there are many things useless to the tp system. --------
      • Table de hachage - Create a hashtable
      • Set Slide_Hash = (Last created hashtable)
      • Set LineTP1[1] = TP4A <gen>
      • Set LineTP1[2] = TP4B <gen>
      • Set LineTP1[3] = TP4C <gen>
      • Set LineTP1[4] = TP4D <gen>
      • Set LineTP1[5] = TP4E <gen>
      • Set LineTP1[6] = TP4F <gen>
      • Set LineTP1[7] = TP4G <gen>
      • -------- The region where you should go with custom value 2. --------
      • Set LineTP1[8] = TP4H <gen>
The first time you enter in the periodic tp thing, you enter by this linear slide :
  • Slide6
    • Evénements
      • Unité - A unit enters Slide6A <gen>
    • Conditions
      • ((Triggering unit) is Un héros) Egal à TRUE
      • (Unit-type of (Triggering unit)) Egal à Chasseur de démon
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (SlideLoop <gen> is on) Egal à FALSE
        • Alors - Actions
          • Déclencheur - Turn on SlideLoop <gen>
        • Sinon - Actions
      • Groupe unité - Add (Triggering unit) to SlideGroup
      • Table de hachage - Save 90.00 as 0 of (Key (Triggering unit)) in Slide_Hash
      • Table de hachage - Save 20.00 as 1 of (Key (Triggering unit)) in Slide_Hash
      • Table de hachage - Save Handle OfSlide6B <gen> as 2 of (Key (Triggering unit)) in Slide_Hash
The second time, when you will enter with custom value 2, you enter by this slide :
  • Slide7
    • Evénements
      • Unité - A unit enters Slide7A <gen>
    • Conditions
      • ((Triggering unit) is Un héros) Egal à TRUE
      • (Unit-type of (Triggering unit)) Egal à Chasseur de démon
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • (SlideLoop <gen> is on) Egal à FALSE
        • Alors - Actions
          • Déclencheur - Turn on SlideLoop <gen>
        • Sinon - Actions
      • Unité - Set the custom value of (Picked unit) to 2
      • Groupe unité - Add (Triggering unit) to SlideGroup
      • Table de hachage - Save 180.00 as 0 of (Key (Triggering unit)) in Slide_Hash
      • Table de hachage - Save 20.00 as 1 of (Key (Triggering unit)) in Slide_Hash
      • -------- This slide will make the unit go in the other slide which will make my unit enter in the periodic tp. --------
      • Table de hachage - Save Handle OfSlide6A <gen> as 2 of (Key (Triggering unit)) in Slide_Hash
Here is the Slide Loop :
  • SlideLoop
    • Evénements
      • Temps - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Groupe unité - Pick every unit in SlideGroup and do (Actions)
        • Boucle - Actions
          • Set TempP = (Position of (Picked unit))
          • Set TempP2 = (TempP offset by (Load 1 of (Key (Picked unit)) from Slide_Hash) towards (Load 0 of (Key (Picked unit)) from Slide_Hash) degrees)
          • Unité - Move (Picked unit) instantly to TempP2
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Si - Conditions
              • ((Load 2 of (Key (Picked unit)) in Slide_Hash) contains (Picked unit)) Egal à TRUE
            • Alors - Actions
              • Table de hachage - Clear all child hashtables of child (Key (Picked unit)) in Slide_Hash
              • Groupe unité - Remove (Picked unit) from SlideGroup
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • Si - Conditions
                  • (SlideGroup is empty) Egal à TRUE
                • Alors - Actions
                  • Déclencheur - Turn off (This trigger)
                • Sinon - Actions
            • Sinon - Actions
          • Custom script: call RemoveLocation(udg_TempP)
          • Custom script: call RemoveLocation(udg_TempP2)
And here is my periodic TP trigger :
  • TPLine1
    • Evénements
      • Temps - Every 0.35 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Boucle - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Groupe unité - Pick every unit in (Units in LineTP1[(Integer A)]) and do (Actions)
            • Boucle - Actions
              • Partie - Display to (All players) the text: (String((Custom value of (Picked unit))))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • Si - Conditions
                  • ((Picked unit) is in SlideGroup) Egal à FALSE
                • Alors - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • Si - Conditions
                      • (Custom value of (Picked unit)) Egal à 2
                    • Alors - Actions
                      • Set TempP = (Center of LineTP1[8])
                      • Unité - Move (Picked unit) instantly to TempP
                      • Custom script: call RemoveLocation(udg_TempP)
                      • Unité - Set the custom value of (Picked unit) to 0
                    • Sinon - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • Si - Conditions
                          • (Custom value of (Picked unit)) Egal à 0
                        • Alors - Actions
                          • Unité - Set the custom value of (Picked unit) to 1
                          • Set TempP = (Center of LineTP1[((Integer A) + 1)])
                          • Unité - Move (Picked unit) instantly to TempP
                          • Custom script: call RemoveLocation(udg_TempP)
                        • Sinon - Actions
                          • Unité - Set the custom value of (Picked unit) to 0
                • Sinon - Actions
 
Status
Not open for further replies.
Top