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

[Solved] Fast Arrow Shoot and Critical Error

Status
Not open for further replies.
Level 4
Joined
Feb 5, 2011
Messages
17
Hi!
This is almost completed skill. Its MUI and written in GUI.
For single player mode, everything goes well. Problem appears when i implement it into my map. Spell is whole made by myself. Every game, which someone uses the skill, ends with crashing whole warcraft. Randomly. Once i crashed the game at first try, another time i made my hero max lvl and soon after game died. Tried to make this skill 3 different ways, each time same result. I need this skill badly. Thx for replys.
 

Attachments

  • Fast_Arrow_Shot_2nd_variation.w3x
    35 KB · Views: 41
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
This leaks:
  • (Distance between (Position of (Triggering unit)) and (Target point of ability being cast)) Less than or equal to 300.00
The offset point leaks, and you have a lot of these:
  • Unit - Create 1 Shadow for (Owner of (Triggering unit)) at (TempPoint offset by...
  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in FAS_Hashtable
^Use Key(Triggering unit) in the FAS end trigger.

You're not removing the temp point taht you store into the hashtable. Remove it before flushing the child hashtable.

Offset point leaks:
  • Unit - Order (Load 2 of (Key (Picked unit)) in FAS_Hashtable) to Attack Ground ((Load 1 of (Key (Picked unit)) in FAS_Hashtable) offset by...
You might want to check that the casting unit is alive in the looping trigger.

Don't use remove unit, apply 0.01 expiration timer instead. Using remove unit can cause a leak.

Get rid of the leaks and try again.
 
Level 4
Joined
Feb 5, 2011
Messages
17
This leaks:
  • (Distance between (Position of (Triggering unit)) and (Target point of ability being cast)) Less than or equal to 300.00

Done

The offset point leaks, and you have a lot of these:
  • Unit - Create 1 Shadow for (Owner of (Triggering unit)) at (TempPoint offset by...

Done too

  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in FAS_Hashtable
^Use Key(Triggering unit) in the FAS end trigger.

Also fixed

You're not removing the temp point taht you store into the hashtable. Remove it before flushing the child hashtable.

There i find a problem: how will look the custom script look now? I don't know JASS

Offset point leaks:
  • Unit - Order (Load 2 of (Key (Picked unit)) in FAS_Hashtable) to Attack Ground ((Load 1 of (Key (Picked unit)) in FAS_Hashtable) offset by...

Is that something different than 3 quotes up?

You might want to check that the casting unit is alive in the looping trigger.

Doesn't happening [Unit - Stops casting spell] (or however is it in English, i have Polish WE) automatic happen when unit dies?

Don't use remove unit, apply 0.01 expiration timer instead. Using remove unit can cause a leak.

Done

Thanks so far for help.
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
There i find a problem: how will look the custom script look now? I don't know JASS
Load it into a location (called Point in GUI) variable. Then....
call RemoveLocation(yourvariablehere)

Is that something different than 3 quotes up?
It looks the same. Basically every location object you allocate you need to deallocate before losing all reference to it otherwise it will remain allocated in memory forever.


Doesn't happening [Unit - Stops casting spell] (or however is it in English, i have Polish WE) automatic happen when unit dies?
You have not checked? Not everything in WC3 makes sense why it is like it is so you should always check to see if it really does behave like you want. Sorry I can not give you a definitive answer but I honestly do not know (never used that event).
 
Level 7
Joined
Apr 1, 2010
Messages
289
You have not checked? Not everything in WC3 makes sense why it is like it is so you should always check to see if it really does behave like you want. Sorry I can not give you a definitive answer but I honestly do not know (never used that event).
when a unit dies it stops casting. i have tested this in the past.
 
Level 4
Joined
Feb 5, 2011
Messages
17
Another problem!

Don't use remove unit, apply 0.01 expiration timer instead. Using remove unit can cause a leak.

Well there's a HUGE problem with that. When I apply expiration timer, unit will die. there will be dying animation, if used not-skeleton model there would be also blood left on the floor and corpse. Don't forget about sound.

I can make it unable to revive and unable to decay (sorry, I must somehow get English WE)(Keys already registered as Polish)(Yes, thats foolish, but did this years ago)
Lets back to topic: if I make it unable to revive and unable to decay I'll avoid corpse trouble. I can also set Dying Time to 0.1 sec, so I get rid of animation.. Still there are left blood and sound. I have found a way to fix that also: export archer model, remove Death animation and import it as custom model, then use it for dummy. Well, finally it doesn't crash the game anymore, but size of file increased unnecessary... I wonder if should i get back Unit - Remove.

I wished to post it in skills section, but can't leave things like this.

That would be my last question ever. (This thread ofc)

PS. Why I haven't noticed that before? i just play with muted sounds and skeletons don't leave corpses ;)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
  • Init
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set FAS_Hashtable = (Last created hashtable)
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
      • Game - Turn the day/night cycle Off
      • Countdown Timer - Start FAS_Timer as a Repeating timer that will expire in 0.12 seconds
  • FAS begin
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fast Arrow Shoot
    • Actions
      • Set TempPoint = (Target point of ability being cast)
      • Set TempPoint2 = (Position of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between TempPoint and TempPoint2) Greater than 300.00
        • Then - Actions
          • Unit Group - Add (Triggering unit) to FAS_Shooters
          • Hashtable - Save Handle OfTempPoint as 1 of (Key (Triggering unit)) in FAS_Hashtable
          • Animation - Change (Last created unit)'s animation speed to 200.00% of its original speed
          • Set TempPoint = ((Position of (Triggering unit)) offset by ((Random real number between -20.00 and 20.00), (Random real number between -20.00 and 20.00)))
          • Unit - Create 1 Shadow for (Owner of (Triggering unit)) at TempPoint facing (Facing of (Triggering unit)) degrees
          • Hashtable - Save Handle Of(Last created unit) as 8 of (Key (Triggering unit)) in FAS_Hashtable
          • Animation - Play (Last created unit)'s attack animation, using only Common animations
          • Animation - Change (Last created unit)'s vertex coloring to (20.00%, 20.00%, 20.00%) with 60.00% transparency
          • Set TempPoint = ((Position of (Triggering unit)) offset by ((Random real number between -20.00 and 20.00), (Random real number between -20.00 and 20.00)))
          • Unit - Create 1 Shadow for (Owner of (Triggering unit)) at TempPoint facing (Facing of (Triggering unit)) degrees
          • Hashtable - Save Handle Of(Last created unit) as 7 of (Key (Triggering unit)) in FAS_Hashtable
          • Animation - Change (Last created unit)'s vertex coloring to (20.00%, 20.00%, 20.00%) with 60.00% transparency
          • Animation - Play (Last created unit)'s attack animation, using only Common animations
          • Animation - Change (Last created unit)'s animation speed to 150.00% of its original speed
          • Set TempPoint = ((Position of (Triggering unit)) offset by ((Random real number between -20.00 and 20.00), (Random real number between -20.00 and 20.00)))
          • Unit - Create 1 Shadow for (Owner of (Triggering unit)) at TempPoint facing (Facing of (Triggering unit)) degrees
          • Hashtable - Save Handle Of(Last created unit) as 6 of (Key (Triggering unit)) in FAS_Hashtable
          • Animation - Change (Last created unit)'s vertex coloring to (20.00%, 20.00%, 20.00%) with 60.00% transparency
          • Animation - Play (Last created unit)'s attack animation, using only Common animations
          • Animation - Change (Last created unit)'s animation speed to 250.00% of its original speed
          • Set TempPoint = ((Position of (Triggering unit)) offset by ((Random real number between -20.00 and 20.00), (Random real number between -20.00 and 20.00)))
          • Unit - Create 1 Shadow for (Owner of (Triggering unit)) at TempPoint facing (Facing of (Triggering unit)) degrees
          • Hashtable - Save Handle Of(Last created unit) as 5 of (Key (Triggering unit)) in FAS_Hashtable
          • Animation - Change (Last created unit)'s vertex coloring to (20.00%, 20.00%, 20.00%) with 60.00% transparency
          • Animation - Play (Last created unit)'s attack animation, using only Common animations
          • Animation - Change (Last created unit)'s animation speed to 300.00% of its original speed
          • Set TempPoint = (Position of (Triggering unit))
          • Unit - Create 1 Shooter for (Owner of (Triggering unit)) at TempPoint facing (Facing of (Triggering unit)) degrees
          • Hashtable - Save Handle Of(Last created unit) as 2 of (Key (Triggering unit)) in FAS_Hashtable
          • Animation - Change (Last created unit)'s vertex coloring to (20.00%, 20.00%, 20.00%) with 100.00% transparency
          • If ((Level of Fast Arrow Shoot for (Triggering unit)) Equal to 2) then do (Unit - Add Item Damage Bonus (+2) to (Last created unit)) else do (Do nothing)
          • If ((Level of Fast Arrow Shoot for (Triggering unit)) Equal to 3) then do (Unit - Add Item Damage Bonus (+4) to (Last created unit)) else do (Do nothing)
          • Unit - Create 1 Shooter for (Owner of (Triggering unit)) at TempPoint facing (Facing of (Triggering unit)) degrees
          • Hashtable - Save Handle Of(Last created unit) as 3 of (Key (Triggering unit)) in FAS_Hashtable
          • Animation - Change (Last created unit)'s vertex coloring to (20.00%, 20.00%, 20.00%) with 100.00% transparency
          • If ((Level of Fast Arrow Shoot for (Triggering unit)) Equal to 2) then do (Unit - Add Item Damage Bonus (+2) to (Last created unit)) else do (Do nothing)
          • If ((Level of Fast Arrow Shoot for (Triggering unit)) Equal to 3) then do (Unit - Add Item Damage Bonus (+4) to (Last created unit)) else do (Do nothing)
          • Unit - Create 1 Shooter for (Owner of (Triggering unit)) at TempPoint facing (Facing of (Triggering unit)) degrees
          • Hashtable - Save Handle Of(Last created unit) as 4 of (Key (Triggering unit)) in FAS_Hashtable
          • Animation - Change (Last created unit)'s vertex coloring to (20.00%, 20.00%, 20.00%) with 100.00% transparency
          • If ((Level of Fast Arrow Shoot for (Triggering unit)) Equal to 2) then do (Unit - Add Item Damage Bonus (+2) to (Last created unit)) else do (Do nothing)
          • If ((Level of Fast Arrow Shoot for (Triggering unit)) Equal to 3) then do (Unit - Add Item Damage Bonus (+4) to (Last created unit)) else do (Do nothing)
          • Trigger - Turn on FAS shoot <gen>
        • Else - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Can't shoot so clos...
          • Unit - Order (Triggering unit) to Stop
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveLocation(udg_TempPoint2)
Lots of location leaks in this code, you need to remove each location you create as the game does not have an effective garbage collection system. Leaks in large numbers are known to cause insability with the game engine.

There also seems to be quite a lot of procedural couling occuring. Although not related to critical failures at all it can make maintence difficult.


  • FAS shoot
    • Events
      • Time - FAS_Timer expires
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in FAS_Shooters) Greater than 0
        • Then - Actions
          • Unit Group - Pick every unit in FAS_Shooters and do (Actions)
            • Loop - Actions
              • Set TempPoint = ((Load 1 of (Key (Picked unit)) in FAS_Hashtable) offset by ((Random real number between -200.00 and 200.00), (Random real number between -200.00 and 200.00)))
              • Unit - Order (Load 2 of (Key (Picked unit)) in FAS_Hashtable) to Attack Ground TempPoint
              • Set TempPoint = ((Load 1 of (Key (Picked unit)) in FAS_Hashtable) offset by ((Random real number between -200.00 and 200.00), (Random real number between -200.00 and 200.00)))
              • Unit - Order (Load 3 of (Key (Picked unit)) in FAS_Hashtable) to Attack Ground TempPoint
              • Set TempPoint = ((Load 1 of (Key (Picked unit)) in FAS_Hashtable) offset by ((Random real number between -200.00 and 200.00), (Random real number between -200.00 and 200.00)))
              • Unit - Order (Load 4 of (Key (Picked unit)) in FAS_Hashtable) to Attack Ground TempPoint
              • Animation - Queue (Load 5 of (Key (Picked unit)) in FAS_Hashtable)'s attack animation
              • Animation - Queue (Load 6 of (Key (Picked unit)) in FAS_Hashtable)'s attack animation
              • Animation - Queue (Load 7 of (Key (Picked unit)) in FAS_Hashtable)'s attack animation
              • Animation - Queue (Load 8 of (Key (Picked unit)) in FAS_Hashtable)'s attack animation
              • Custom script: call RemoveLocation(udg_TempPoint)
        • Else - Actions
          • Trigger - Turn off (This trigger)
More location leaks which can cause critical failures.

Also more procedural coupling but again that does not cause failures.

You also run the timer unnescescarilly when the ability is not active.

  • FAS end
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Fast Arrow Shoot
    • Actions
      • Unit Group - Remove (Triggering unit) from FAS_Shooters
      • Animation - Change (Triggering unit)'s animation speed to 100.00% of its original speed
      • Unit - Add a 0.01 second Generic expiration timer to (Load 2 of (Key (Triggering unit)) in FAS_Hashtable)
      • Unit - Add a 0.01 second Generic expiration timer to (Load 3 of (Key (Triggering unit)) in FAS_Hashtable)
      • Unit - Add a 0.01 second Generic expiration timer to (Load 4 of (Key (Triggering unit)) in FAS_Hashtable)
      • Unit - Add a 0.01 second Generic expiration timer to (Load 5 of (Key (Triggering unit)) in FAS_Hashtable)
      • Unit - Add a 0.01 second Generic expiration timer to (Load 6 of (Key (Triggering unit)) in FAS_Hashtable)
      • Unit - Add a 0.01 second Generic expiration timer to (Load 7 of (Key (Triggering unit)) in FAS_Hashtable)
      • Unit - Add a 0.01 second Generic expiration timer to (Load 8 of (Key (Triggering unit)) in FAS_Hashtable)
      • Set TempPoint = (Load 1 of (Key (Triggering unit)) in FAS_Hashtable)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in FAS_Hashtable
Nothing noticably wrong here.

It is possible the fatal error in your map is caused by interaction faults where another system is interacting with this one.
 
Level 4
Joined
Feb 5, 2011
Messages
17
Well, at begin i had custom script before each
  • Set TempPoint = location
but it made trouble with saving it as hashtable. Then i left just one at the end of trigger.

Well then I'm putting it every time after Set Variable. Only after saving to hashtable won't be any. Thanks for reply, gonna give a sign later.

Edit: Any idea about this corpse trouble which I spoke about?
 
Level 4
Joined
Feb 5, 2011
Messages
17
Skill still does cause critical error. Uploaded my 2nd try of making it. I have no clue what would cause error. I remind: this is the error which apper after you order to use level up tome for non-hero unit.
EDIT: Fixed all mentoied before leaks, but i did this at my map, not on this skill-showing sample.
 
Status
Not open for further replies.
Top