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

Problems with time...

Status
Not open for further replies.
Level 14
Joined
Aug 8, 2010
Messages
1,022
Hi, guys! It's me again :D! I have a magic with dummy unit... and it all works, but when i set the Cooldown of the normal attack of my dummy (from the Object Editor) to 0.50 sec and when i set in the triggs 'Wait 0.50 sec' and after that 'Remove Dummy unit from the game' the magic works SOMETIMES, sometimes it don't. I am sure it is because of the time, because when i set both to 0.10 the chance of the magic to work gets lower. Can you tell me a way to fix it?
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Ok, but how i can input it in here? :
  • Scorpion Poison Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Poison
      • (Unit-type of (Casting unit)) Equal to Scorpion
    • Actions
      • Hashtable - Save Handle Of(Casting unit) as 1 of 1 in PoisonHash
      • Hashtable - Save Handle Of(Target unit of ability being cast) as 5 of 5 in PoisonHash
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 3) Equal to 1
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of (Ability being cast) for (Load 1 of 1 in PoisonHash)) Equal to 1
            • Then - Actions
              • Unit - Create 1 Slow Poison L1 for Player 1 (Red) at (Position of (Casting unit)) facing Default building facing degrees
              • Hashtable - Save Handle Of(Last created unit) as 4 of 4 in PoisonHash
              • Unit - Order (Load 4 of 4 in PoisonHash) to Attack (Load 5 of 5 in PoisonHash)
              • Wait 0.10 seconds
              • Unit - Remove (Load 4 of 4 in PoisonHash) from the game
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of (Ability being cast) for (Load 1 of 1 in PoisonHash)) Equal to 2
                • Then - Actions
                  • Unit - Create 1 Slow Poison L2 for Player 1 (Red) at (Position of (Casting unit)) facing Default building facing degrees
                  • Hashtable - Save Handle Of(Last created unit) as 4 of 4 in PoisonHash
                  • Unit - Order (Load 4 of 4 in PoisonHash) to Attack (Load 5 of 5 in PoisonHash)
                  • Wait 0.50 seconds
                  • Unit - Remove (Load 4 of 4 in PoisonHash) from the game
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of (Ability being cast) for (Load 1 of 1 in PoisonHash)) Equal to 3
                    • Then - Actions
                      • Unit - Create 1 Slow Poison L3 for Player 1 (Red) at (Position of (Casting unit)) facing Default building facing degrees
                      • Hashtable - Save Handle Of(Last created unit) as 4 of 4 in PoisonHash
                      • Unit - Order (Load 4 of 4 in PoisonHash) to Attack (Load 5 of 5 in PoisonHash)
                      • Wait 0.50 seconds
                      • Unit - Remove (Load 4 of 4 in PoisonHash) from the game
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of (Ability being cast) for (Load 1 of 1 in PoisonHash)) Equal to 4
                        • Then - Actions
                          • Unit - Create 1 Slow Poison L4 for Player 1 (Red) at (Position of (Casting unit)) facing Default building facing degrees
                          • Hashtable - Save Handle Of(Last created unit) as 4 of 4 in PoisonHash
                          • Unit - Order (Load 4 of 4 in PoisonHash) to Attack (Load 5 of 5 in PoisonHash)
                          • Wait 0.50 seconds
                          • Unit - Remove (Load 4 of 4 in PoisonHash) from the game
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Level of (Ability being cast) for (Load 1 of 1 in PoisonHash)) Equal to 5
                            • Then - Actions
                              • Unit - Create 1 Slow Poison L5 for Player 1 (Red) at (Position of (Casting unit)) facing Default building facing degrees
                              • Hashtable - Save Handle Of(Last created unit) as 4 of 4 in PoisonHash
                              • Unit - Order (Load 4 of 4 in PoisonHash) to Attack (Load 5 of 5 in PoisonHash)
                              • Wait 0.50 seconds
                              • Unit - Remove (Load 4 of 4 in PoisonHash) from the game
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Level of (Ability being cast) for (Load 1 of 1 in PoisonHash)) Equal to 6
                                • Then - Actions
                                  • Unit - Create 1 Slow Poison L6 for Player 1 (Red) at (Position of (Casting unit)) facing Default building facing degrees
                                  • Hashtable - Save Handle Of(Last created unit) as 4 of 4 in PoisonHash
                                  • Unit - Order (Load 4 of 4 in PoisonHash) to Attack (Load 5 of 5 in PoisonHash)
                                  • Wait 0.50 seconds
                                  • Unit - Remove (Load 4 of 4 in PoisonHash) from the game
                                • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 2) Equal to 2
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of (Ability being cast) for (Load 1 of 1 in PoisonHash)) Equal to 1
            • Then - Actions
              • Unit - Create 1 Instant Poison L1 for Player 1 (Red) at (Position of (Casting unit)) facing Default building facing degrees
              • Hashtable - Save Handle Of(Last created unit) as 4 of 4 in PoisonHash
              • Unit - Order (Load 4 of 4 in PoisonHash) to Attack (Load 5 of 5 in PoisonHash)
              • Wait 0.10 seconds
              • Unit - Remove (Load 4 of 4 in PoisonHash) from the game
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of (Ability being cast) for (Load 1 of 1 in PoisonHash)) Equal to 2
                • Then - Actions
                  • Unit - Create 1 Instant Poison L2 for Player 1 (Red) at (Position of (Casting unit)) facing Default building facing degrees
                  • Hashtable - Save Handle Of(Last created unit) as 4 of 4 in PoisonHash
                  • Unit - Order (Load 4 of 4 in PoisonHash) to Attack (Load 5 of 5 in PoisonHash)
                  • Wait 0.50 seconds
                  • Unit - Remove (Load 4 of 4 in PoisonHash) from the game
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of (Ability being cast) for (Load 1 of 1 in PoisonHash)) Equal to 3
                    • Then - Actions
                      • Unit - Create 1 Instant Poison L3 for Player 1 (Red) at (Position of (Casting unit)) facing Default building facing degrees
                      • Hashtable - Save Handle Of(Last created unit) as 4 of 4 in PoisonHash
                      • Unit - Order (Load 4 of 4 in PoisonHash) to Attack (Load 5 of 5 in PoisonHash)
                      • Wait 0.50 seconds
                      • Unit - Remove (Load 4 of 4 in PoisonHash) from the game
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of (Ability being cast) for (Load 1 of 1 in PoisonHash)) Equal to 4
                        • Then - Actions
                          • Unit - Create 1 Instant Poison L4 for Player 1 (Red) at (Position of (Casting unit)) facing Default building facing degrees
                          • Hashtable - Save Handle Of(Last created unit) as 4 of 4 in PoisonHash
                          • Unit - Order (Load 4 of 4 in PoisonHash) to Attack (Load 5 of 5 in PoisonHash)
                          • Wait 0.50 seconds
                          • Unit - Remove (Load 4 of 4 in PoisonHash) from the game
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Level of (Ability being cast) for (Load 1 of 1 in PoisonHash)) Equal to 5
                            • Then - Actions
                              • Unit - Create 1 Instant Poison L5 for Player 1 (Red) at (Position of (Casting unit)) facing Default building facing degrees
                              • Hashtable - Save Handle Of(Last created unit) as 4 of 4 in PoisonHash
                              • Unit - Order (Load 4 of 4 in PoisonHash) to Attack (Load 5 of 5 in PoisonHash)
                              • Wait 0.50 seconds
                              • Unit - Remove (Load 4 of 4 in PoisonHash) from the game
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Level of (Ability being cast) for (Load 1 of 1 in PoisonHash)) Equal to 6
                                • Then - Actions
                                  • Unit - Create 1 Instant Poison L6 for Player 1 (Red) at (Position of (Casting unit)) facing Default building facing degrees
                                  • Hashtable - Save Handle Of(Last created unit) as 4 of 4 in PoisonHash
                                  • Unit - Order (Load 4 of 4 in PoisonHash) to Attack (Load 5 of 5 in PoisonHash)
                                  • Wait 0.50 seconds
                                  • Unit - Remove (Load 4 of 4 in PoisonHash) from the game
                                • Else - Actions
        • Else - Actions
EVERY wait command must be 0.50, i forgot to repair it, the first if/then/else is 1 type of poison and the other if/then/else in the first one are it's levels, the second if/then/else is another type of poison and again it's levels inside.
 
Level 13
Joined
Mar 24, 2010
Messages
950
i understand but its always best to show your trigger here its just fasted to tell the problem..

just take out the wait time and make the casting time on the dummy 0 and no animation time and set the dummy unit to expire in like 1 sec tops

Edit
ok now that you posted it if your gonna do it that way yea your gonna need to use timers but i still think it would be easier for you to remove the wait and just have that be an expiration on the unit so u no longer have to keep track of its removal.

also that trigger is huge.. u can shrink it into like 1/12th if u put it into a loop
 
Level 13
Joined
Mar 24, 2010
Messages
950
  • If - Conditions
    • (Level of (Ability being cast) for (Load 1 of 1 in PoisonHash)) Equal to 2
    • Then - Actions
      • Unit - Create 1 Slow Poison L2 for Player 1 (Red) at (Position of (Casting unit)) facing Default building facing degrees
      • Hashtable - Save Handle Of(Last created unit) as 4 of 4 in PoisonHash
      • Unit - Order (Load 4 of 4 in PoisonHash) to Attack (Load 5 of 5 in PoisonHash)
      • Unit - Add a 1.00 second Generic expiration timer to (Load 4 of 4 in PoisonHash)
    • Else - Actions
like this

also from the looks of what your doing here you dont even need to use a hash table or do these 12 if-then's
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
CoLd Bon3, your code is horriably designed.

Firstly, use a local variable (or global... sigh) instead of the hashtables as hashtables are increadbly slow compared to the others and how you are using it is no different from a global.

Secondly map the dummy unit types into an integer array (or unit type array in crappy gui... sigh) at an index corosponding to their level. Do this at map initialization so that from an index of the ability level you can get the correct dummy unit type. Ofcourse you will need 2 arrays, 1 for each dummy type.

Thus you can collapse the whole tree code system into 1 linear block which does no level checks at all. This not only makes it execute faster/more predictably but also greatly reduces the amount of code generated.
 
Status
Not open for further replies.
Top