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

[Trigger] Crash after casting

Status
Not open for further replies.
Level 7
Joined
Jun 28, 2013
Messages
395
So I created an ability through triggers but when casting, the game crash.

The ability is suppose to "summon" 8 clones of yourself in a circle of target while the caster will be hidden. (I make it 1000 around the unit)

Every second, one of the clone will move forward to another end of the circle and damage will be dealt units in the AOE. The final clone will deal a higher damage.

So I tried the simplest way to get it right first before making it MUI (I actually don't know how to MUI :3) but it crash after making almost everything.

Here is a noob trigger I have made.

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Hassou Tobi
  • Actions
    • If (HT_Count Greater than or equal to 1000) then do (Set HT_Count = 0) else do (Set HT_Count = (HT_Count + 1))
    • If (Loop_1_Count Greater than or equal to 1000) then do (Set Loop_1_Count = 0) else do (Set Loop_1_Count = (Loop_1_Count + 1))
    • Set Loop_1[Loop_1_Count] = 0
    • Set HT_Caster[HT_Count] = (Triggering unit)
    • Set HT_Level = (Level of Hassou Tobi for HT_Caster[HT_Count])
    • Set HT_TempLoc[HT_Count] = (Target point of ability being cast)
    • For each (Integer Loop_1[Loop_1_Count]) from 1 to 8, do (Actions)
      • Loop - Actions
        • Set HT_TempLoc2[HT_Count] = (HT_TempLoc[HT_Count] offset by (HT_Max_AOE[HT_Level] / 2.00) towards (45.00 x (Real(Loop_1[Loop_1_Count]))) degrees)
        • Unit - Create 1 Ronnin Mirror for (Owner of HT_Caster[HT_Count]) at HT_TempLoc2[HT_Count] facing (Angle from HT_TempLoc2[HT_Count] to HT_TempLoc[HT_Count]) degrees
        • Set HT_KeyId = (Key (Last created unit))
        • Set HT_Temp_Unit[Loop_1[Loop_1_Count]] = (Last created unit)
        • Unit - Add Phoenix Fx to (Last created unit)
        • Unit Group - Add (Last created unit) to HT_Dummy_Group
        • Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 35.00% transparency
        • Custom script: call SetUnitAnimationByIndex( GetLastCreatedUnit(), 14)
        • Hashtable - Save HT_Level as 0 of HT_KeyId in HT_Hash
        • Hashtable - Save HT_Count as 1 of HT_KeyId in HT_Hash
        • Hashtable - Save HT_Damage_Total_PS[HT_Count] as 2 of HT_KeyId in HT_Hash
        • Hashtable - Save HT_Damage_Total_Final[HT_Count] as 3 of HT_KeyId in HT_Hash
        • Hashtable - Save 0.00 as 4 of HT_KeyId in HT_Hash
        • Custom script: call RemoveLocation(udg_HT_TempLoc2[udg_HT_Count])
    • Hashtable - Save Handle OfHT_TempLoc[HT_Count] as 5 of HT_KeyId in HT_Hash
    • Custom script: call RemoveLocation(udg_HT_TempLoc[udg_HT_Count])
    • Trigger - Turn on Hassou Tobi Loops <gen>
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (HT_Dummy_Group is empty) Equal to False
      • Then - Actions
        • Unit Group - Pick every unit in HT_Dummy_Group and do (Actions)
          • Loop - Actions
            • Set Unit = (Picked unit)
            • Custom script: set udg_HT_KeyId = GetHandleId(udg_Unit) // I do not know how to use hashtable
        • Set HT_DistX = (Load 4 of HT_KeyId from HT_Hash)
        • Set HT_Level = (Load 0 of HT_KeyId from HT_Hash)
        • Set HT_TempLoc[HT_Count] = (Position of HT_Temp_Unit[HT_Dummy_Int])
        • Set HT_TempLoc2[HT_Count] = (HT_TempLoc[HT_Count] offset by HT_DistX towards (Facing of HT_Temp_Unit[HT_Dummy_Int]) degrees)
        • Set HT_TempLoc3[HT_Count] = (Position of HT_Caster[HT_Count])
        • Custom script: call SetUnitAnimationByIndex( udg_HT_Temp_Unit[udg_HT_Dummy_Int], 7)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • HT_Max_AOE[HT_Level] Greater than HT_DistX
          • Then - Actions
            • Hashtable - Save (HT_DistX + 15.00) as 4 of HT_KeyId in HT_Hash
            • Unit - Move HT_Temp_Unit[HT_Dummy_Int] instantly to HT_TempLoc2[HT_Count]
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • HT_Dummy_Int Less than or equal to 7
              • Then - Actions
                • Set HT_Damage_Attri[HT_Count] = (HT_Damage_Attri_Multiply[HT_Level] x (Real((Agility of HT_Caster[HT_Count] (Include bonuses)))))
                • Set HT_Damage_Total_PS[HT_Count] = (HT_Damage_PS[HT_Level] + HT_Damage_Attri[HT_Count])
                • Set HT_TempGroup = (Units within 1000.00 of HT_TempLoc3[HT_Count] matching ((((Matching unit) belongs to an ally of (Owner of HT_Caster[HT_Count])) Equal to False) and (((Matching unit) is alive) Equal to True)))
                • Unit Group - Pick every unit in HT_TempGroup and do (Actions)
                  • Loop - Actions
                    • Unit - Cause HT_Caster[HT_Count] to damage (Picked unit), dealing HT_Damage_Total_PS[HT_Count] damage of attack type Hero and damage type Normal
                • Special Effect - Create a special effect at HT_TempLoc3[HT_Count] using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
                • Special Effect - Destroy (Last created special effect)
                • Unit Group - Remove all units from HT_TempGroup
                • Custom script: call DestroyGroup(udg_HT_TempGroup)
                • Unit - Remove HT_Temp_Unit[HT_Dummy_Int] from the game
                • Hashtable - Save 0.00 as 4 of HT_KeyId in HT_Hash
                • Set HT_Dummy_Int = (HT_Dummy_Int + 1)
              • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • HT_Dummy_Int Equal to 8
              • Then - Actions
                • Set HT_Damage_Attri[HT_Count] = (HT_Damage_Attri_Multiply[HT_Level] x (Real((Agility of HT_Caster[HT_Count] (Include bonuses)))))
                • Set HT_Damage_Total_Final[HT_Count] = (HT_Damage_Final[HT_Level] + HT_Damage_Attri[HT_Count])
                • Set HT_TempGroup = (Units within 1000.00 of HT_TempLoc3[HT_Count] matching ((((Matching unit) belongs to an ally of (Owner of HT_Caster[HT_Count])) Equal to False) and (((Matching unit) is alive) Equal to True)))
                • Unit Group - Pick every unit in HT_TempGroup and do (Actions)
                  • Loop - Actions
                    • Unit - Cause HT_Caster[HT_Count] to damage (Picked unit), dealing HT_Damage_Total_Final[HT_Count] damage of attack type Hero and damage type Normal
                • Special Effect - Create a special effect at HT_TempLoc3[HT_Count] using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
                • Special Effect - Destroy (Last created special effect)
                • Unit Group - Remove all units from HT_TempGroup
                • Custom script: call DestroyGroup(udg_HT_TempGroup)
                • Unit - Remove HT_Temp_Unit[HT_Dummy_Int] from the game
                • Unit Group - Remove all units from HT_Dummy_Group
                • Set HT_Dummy_Int = 1
                • Hashtable - Clear all child hashtables of child HT_KeyId in HT_Hash
                • Trigger - Turn off (This trigger)
              • Else - Actions
        • Custom script: call RemoveLocation(udg_HT_TempLoc[udg_HT_Count])
        • Custom script: call RemoveLocation(udg_HT_TempLoc2[udg_HT_Count])
        • Custom script: call RemoveLocation(udg_HT_TempLoc3[udg_HT_Count])
      • Else - Actions
Sorry for my grammar mistakes and my noob ability of trigger. >_<

Thank you if you help on this. >_<

Edited: Solved
 
Last edited:
Level 7
Joined
Jun 28, 2013
Messages
395
What about the group? I turn off the group after all the 8 dummy units have done their role and been removed from the game afterwards. Or is it the unit group getting damage?

Will start putting away the array for tempLoc then.

After changing the tempLocs to non-array, the game still crash.

Untitled.png


Don't know what it is saying. I don't do this type of stuff but I know there is something wrong with my triggers.

Could it be something to do with the hash tables? The last time I change something in the KeyId, it works but not the way I want it to be. Just upon summon, the dummies did not move and were remove shortly after. Special effects were there but no damage is dealt.

So I decided to try something else in the KeyId and it crashed again. I changed it back. But after changing back, it crashed the game also.

This is weird......
 
Last edited by a moderator:
Level 7
Joined
Jun 28, 2013
Messages
395
Owh sorry, turn off the triggers after all the 8 dummies done their role***

turn off triggers then turn on one by one until problem stops. Then post the bad trigger here.

^Don't understand that. Turn off then turn on one by one?

Sorry for not editing the other post but double posting.
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
deathismyfriend is pointing out the Unit Group Check, you must turn on the loop if there is no units in the group or if there is no any instances because turndning on the loop while the loop is on is very bad.. a you should turn it off if there is no unit in the group. If you don't know how to do that then this is the example :

  • KnockUp Execute
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Set KU_Caster = (Triggering unit)
      • Custom script: set udg_KU_Key = GetHandleId(udg_KU_Caster)
      • Set KU_Time = 10.00
      • Hashtable - Save KU_Time as 1 of KU_Key in KnockUp_Hashtable
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (KU_Group is empty) Equal to True
        • Then - Actions
          • Trigger - Turn on Just Example <gen>
        • Else - Actions
      • Unit Group - Add KU_Caster to KU_Group
  • Just Example
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in KU_Group and do (Actions)
        • Loop - Actions
          • Set KU_Time = (Load 1 of KU_Key from KnockUp_Hashtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 1 of KU_Key from KnockUp_Hashtable) Greater than 0.00
            • Then - Actions
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (KU_Group is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Level 7
Joined
Jun 28, 2013
Messages
395
turn off all trigger in ur map.
Then try the map. Make sure it doesnt crash.
turn on one trigger.
Do same thing until you find the bad trigger.

What if I get the ability trigger to a new map and test it? If it crashed again, then there should be something wrong in the ability trigger instead of the map's trigger.

turning on the loop while the loop is on is very bad..

You mean when 2 units cast it around the same time, it'll double turn on the trigger? But didn't I see that in almost all the MUI trigger? Or is it I don't know how it works? >_>

Does it also crash the game if it turn on a trigger that is on?

You should use an integer counter as that is faster than checking if the group is empty.

Integer counter? I thought I'd make that in the trigger. Or is it wrong? Can you show me an example?
 
I'm on my phone so I can try to explain.

1) Your first part is right that will tell u if it is this trigger.

2) No it will not crash if u turn on a trigger that is already on.
If you notice in MUI triggers we use an ITE ( if then else) to check when to turn on and off the loop

3) you use a is unit group empty check. Use an integer to count when an instance is cast and increase integer. Then when you de-index decrease the integer.
 
Level 7
Joined
Jun 28, 2013
Messages
395
Um, okay I'll test it later.

Owh, I think I get it. It'll only on the loop if there is no units in the group then you add a unit in the group. So, other units that cast, it won't on the loop again because there is an unit in the group. Same goes with the off. If it off without condition, the second caster will bug. Is that right?

Um, I still don't quite get the integer counter. Can you show me an example when you're free?
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
Um, okay I'll test it later.

Owh, I think I get it. It'll only on the loop if there is no units in the group then you add a unit in the group. So, other units that cast, it won't on the loop again because there is an unit in the group. Same goes with the off. If it off without condition, the second caster will bug. Is that right?

Um, I still don't quite get the integer counter. Can you show me an example when you're free?

Exactly in the Unit Group - Is Empty == true. About the integer counter it is like you're checking if there is any instances in the spell example: You've cast the spell so the Temp_Integer counter will INCREASE to 1 then You will make an ITE Condition that if the Temp_Integer is == 1 then turn on the loop, then in the loop you will DECREASE the Temp_Integer by 1 then you will make an ITE Condition too like: if the Temp_Integer is Less than or equal to 0 then turn off the Looping trigger.

Spell One Cast:
Temp_Integer = Temp_Integer + 1
Now the counter is equal now to 1.
The Condition says if the Temp_Integer is equal to 1 then the looping trigger will be on.
Now the looping trigger is now executing.
If the spell is finish or if you remove now the unit it will be decrease by 1.
Temp_Integer = Temp_Integer - 1
Now our Temp_Integer is equal to 0 then turning off the looping trigger.

Spell Multiple Cast:
Temp_Integer = Temp_Integer + 1
The other unit want the spell to be cast so it will be added to
Temp_Integer is now equal to 2 now our instances of the spell is equal to 2.
Then if the spell is finish decrease it by 1 when you remove the unit in the group.
Temp_Integer = Temp_Integer - 1
Now our Instances is equal to 1 so the Condition will not run because it checks only if less than or equal to 0
In 1. seconds ago
Temp_Integer = Temp_Integer - 1
Now our Temp_Integer is equal to 0
so the Condition will run because it checks if the Temp_Integer is equal to 0
Now Turning off the trigger.
Then so on......
 
Level 7
Joined
Jun 28, 2013
Messages
395
Hell what? It works fine in the new map I created. What sorcery is this?! Though I change some few stuff. I change the same setting to my map first if it works.

Edited: It crashed in my old map after I changed everything to the same as the new map :< Gotta do something with the traveling part.

Edited: I think I get it why it crashed. If you move unit to a invalid place like boundary, do it crash? Edited: Yes.

Edited: My skill does not crash anymore. Thanks for helping, guys! Will take advice on making it MUI. Unless I started to fail. :/

Thanks for explanation on the integer counter. :D
 
Level 7
Joined
Jun 28, 2013
Messages
395
Oops. Edited a bit too late. Sorry, I already found out the problem. It is the boundary that crash the map because you cant move unit to the boundary. :3 I edited the earlier post without refreshing. Sorry. >_<
 
Status
Not open for further replies.
Top