TimeLapse

Discussion in 'World Editor Help' started by sunshinex3, Nov 16, 2017.

  1. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    Could i get some one to double check this trigger its not working for me.

    Code:
    Time Lapse Caster Initialization
        Events
            Unit - A unit Learns a skill
        Conditions
            (Learned Hero Skill) Equal to Time Warp (Nordizumu)
        Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    timeLapse_currentInstances Equal to 0
                Then - Actions
                    Countdown Timer - Start timeLapse_timer as a Repeating timer that will expire in 0.10 seconds
                Else - Actions
                    Set timeLapse_whichUnit = (Triggering unit)
                    Set timeLapse_currentInstances = (timeLapse_currentInstances + 1)
                    Set timeLapse_caster[timeLapse_currentInstances] = timeLapse_whichUnit
                    Set timeLapse_casterLoc[timeLapse_currentInstances] = (Position of timeLapse_whichUnit)
                    Set timeLapse_casterHealth[timeLapse_currentInstances] = (Life of timeLapse_whichUnit)
                    Set timeLapse_casterMana[timeLapse_currentInstances] = (Mana of timeLapse_whichUnit)
                    Set timeLapse_casterFacing[timeLapse_currentInstances] = (Facing of timeLapse_whichUnit)
    

    Second Trigger....



    Code:
    Time Lapse Periodic Event
        Events
            Time - timeLapse_timer expires
        Conditions
        Actions
            For each (Integer A) from 1 to timeLapse_currentInstances, do (Actions)
                Loop - Actions
                    Set timeLapse_casterFacing[(Integer A)] = (Facing of timeLapse_caster[(Integer A)])
                    Set timeLapse_casterHealth[(Integer A)] = (Life of timeLapse_caster[(Integer A)])
                    Set timeLapse_casterMana[(Integer A)] = (Mana of timeLapse_caster[(Integer A)])
                    Custom script:          if (udg_timeLapse_casterLoc[bj_forLoopAIndex] != null) then
                    Custom script:              call RemoveLocation(udg_timeLapse_casterLoc[bj_forLoopAIndex])
                    Custom script:    endif
                    Set timeLapse_casterLoc[(Integer A)] = (Position of timeLapse_caster[(Integer A)])
    
    Third Trigger....

    Code:
    Time Lapse Actions
        Events
            Unit - A unit Starts the effect of an ability
        Conditions
            (Ability being cast) Equal to Time Warp (Nordizumu)
        Actions
            Set timeLapse_whichUnit = timeLapse_caster[(Integer A)]
            For each (Integer A) from 1 to timeLapse_currentInstances, do (Actions)
                Loop - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            timeLapse_whichUnit Equal to timeLapse_caster[(Integer A)]
                        Then - Actions
                            Unit - Move timeLapse_caster[(Integer A)] instantly to timeLapse_casterLoc[(Integer A)], facing timeLapse_casterFacing[(Integer A)] degrees
                            Unit - Set life of timeLapse_whichUnit to timeLapse_casterHealth[(Integer A)]
                            Unit - Set mana of timeLapse_whichUnit to timeLapse_casterMana[(Integer A)]
                            Special Effect - Create a special effect at timeLapse_casterLoc[(Integer A)] using Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
                            Special Effect - Destroy (Last created special effect)
                            Skip remaining actions
                        Else - Actions
                            Do nothing
    
    thats it unless i need more it looks like it should work im useing the roar ability with this trigger.
     
  2. Accname

    Accname 2D-Graphics enthusiast

    Ratings:
    +1,550 / 4 / -4
    I dont think we can help you with your triggers unless you tell us what those triggers are supposed to do and what they are doing wrong.
     
  3. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    it's supposed to be time lapse from dota.

    these triggers are used with an ability time lapse once that ability is cast then a timer is started and after the timer ends the units:

    position
    angel facing
    health
    mana

    are all reset to what they were when the ability was cast.

    i can see were it stores the variables not sure if anything else works... it doesnt do anything as of right now.
     
    Last edited: Nov 18, 2017
  4. Accname

    Accname 2D-Graphics enthusiast

    Ratings:
    +1,550 / 4 / -4
    I dont know dota.

    Is this ability supposed to be used by more than 1 unit at a time? Or will there ever be only 1 unit using it? Will it be 1 unit total or 1 unit per player?
     
  5. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    1 unit per-player hero ability

    their can only be 12 maximum units in game each belonging to a different player.
     
    Last edited: Nov 20, 2017
  6. Accname

    Accname 2D-Graphics enthusiast

    Ratings:
    +1,550 / 4 / -4
    Here is a solution that uses 2 triggers:

    This first trigger is called when the time travel ability is used
    Trigger:
    • OnUse
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Time Travel
      • Actions
        • -------- Player number is used as an index into all of our array data structures --------
        • Set tmpInt = (Player number of (Owner of (Triggering unit)))
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • timeTravel_Unit[timeTravel_Count] Equal to No unit
          • Then - Actions
            • -------- We count the number of units currently using time travel with this variable --------
            • -------- We only increment this variable if our unit was not already using time travel --------
            • Set timeTravel_Count = (timeTravel_Count + 1)
            • Trigger - Turn on OnPeriodic <gen>
          • Else - Actions
            • -------- The unit was already using time travel, we dont have to count it twice --------
        • -------- We store all the unit state which is supposed to be reset in time travel in these arrays --------
        • Set timeTravel_Unit[tmpInt] = (Triggering unit)
        • Set timeTravel_Hp[tmpInt] = (Life of (Triggering unit))
        • Set timeTravel_Mp[tmpInt] = (Mana of (Triggering unit))
        • Set timeTravel_Facing[tmpInt] = (Facing of (Triggering unit))
        • Set timeTravel_Pos[tmpInt] = (Position of (Triggering unit))
        • -------- This is the time (in tenths of a second) until the time travel effect starts --------
        • Set timeTravel_Timer[tmpInt] = 90


    This second trigger is running down the timers and doing the actual time travel stuff
    Trigger:
    • OnPeriodic
      • Events
        • Time - Every 0.10 seconds of game time
      • Conditions
        • timeTravel_Count Greater than 0
      • Actions
        • -------- Iterate over all player numbers --------
        • For each (Integer A) from 1 to 12, do (Actions)
          • Loop - Actions
            • -------- We just set this for convenience --------
            • Set tmpInt = (Integer A)
            • -------- Check whether this player is currently using time travel --------
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • timeTravel_Timer[tmpInt] Greater than 1
              • Then - Actions
                • -------- Count down the time travel timer for this player --------
                • Set timeTravel_Timer[tmpInt] = (timeTravel_Timer[tmpInt] - 1)
              • Else - Actions
                • -------- Check whether time travel is just ending for a player --------
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • timeTravel_Timer[tmpInt] Equal to 1
                  • Then - Actions
                    • -------- Copy all the saved state of the unit from before. --------
                    • -------- Attention! This will fail if the unit is dead! You need extra code for that. --------
                    • Unit - Set life of timeTravel_Unit[tmpInt] to timeTravel_Hp[tmpInt]
                    • Unit - Set mana of timeTravel_Unit[tmpInt] to timeTravel_Mp[tmpInt]
                    • Unit - Move timeTravel_Unit[tmpInt] instantly to timeTravel_Pos[tmpInt], facing timeTravel_Facing[tmpInt] degrees
                    • -------- Clean up the location data to avoid memory leaks --------
                    • Custom script: call RemoveLocation(udg_timeTravel_Pos[udg_tmpInt])
                    • -------- Count down the number of active time travel users --------
                    • Set timeTravel_Count = (timeTravel_Count - 1)
                    • -------- Reset the unit data. We use this variable to check whether we are already time traveling in the OnUse trigger --------
                    • Set timeTravel_Unit[tmpInt] = No unit
                  • Else - Actions
        • -------- We can stop this trigger to save performance if it is not needed --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • timeTravel_Count Equal to 0
          • Then - Actions
            • Trigger - Turn off (This trigger)
          • Else - Actions


    These are the variables used: (Player number is used as an index into all array variables)
    * timeTravel_Count // used to count how many units are currently using time travel. This is only a performance thing so that we can stop the periodic trigger if it is not needed
    * timeTravel_Unit[] // the unit doing the time travel.
    * timeTravel_Timer[] // a time (in tenths of a millisecond) until a players unit is supposed to travel back in time.
    * timeTravel_Facing[] // saves the facing angle of the time travel unit.
    * timeTravel_Pos[] // saves the position of the time travel unit. Needs to be cleaned to avoid memory leaks.
    * timeTravel_Hp[] // saves the HP of the time travel unit.
    * timeTravel_Mp[] // saves the MP of the time travel unit.
    * tmpInt // used only for convenience to make the triggers more readable.


    I also attached an example map where you can test these triggers out.
     

    Attached Files:

  7. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    YES thank you!! this trigger makes time laps work perfectly let me state these variable types

    * timeTravel_Count // Integer
    * timeTravel_Unit[] // Real Array(1)
    * timeTravel_Timer[] // Real Array(1)
    * timeTravel_Facing[] // Real Array(1)
    * timeTravel_Pos[] // Point Array(1)
    * timeTravel_Hp[] // Integer Array(1)
    * timeTravel_Mp[] // Unit Array(1)
    * tmpInt //Integer

    I made these variables and then coppied the triggers over enabled the action the disabled its self automaticly upon copy and it worked perfectly again useing this trigger with roar ability works great ty accname.
     
    Last edited: Nov 25, 2017

Share This Page