HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Why does this crash WC3? (GUI noob spell trigger)

01-14-2009, 03:33 PM#1
Matarael
I've had this for a while but recently I noticed that if I used this trigger around enemy units it crashed the bloody game.

It doesn't crash when I use it at the base where there aren't any enemy units. What am I doing wrong?

Thanks.

Hidden information:

Trigger:
Events
Collapse Solar Flare Start
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Solar Flare
Collapse Actions
Set Flare_Caster = (Triggering unit)
Set Flare_Level = (Level of Solar Flare for Flare_Caster)
Set Temp_Point = ((Position of Flare_Caster) offset by (Random real number between 50.00 and 600.00) towards (Random real number between 0.00 and 360.00) degrees)
Unit - Create 1 Eradicator unit for (Owner of Flare_Caster) at Temp_Point facing Default building facing (270.0) degrees
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Unit - Order (Last created unit) to Undead Lich - Frost Nova (Last created unit)
Custom script: call RemoveLocation(udg_Temp_Point)
Trigger - Turn on Solar Flare Effects <gen>

Then

Trigger:
Solar Flare Effects
Collapse Events
Time - Every 0.40 seconds of game time
Conditions
Collapse Actions
Set Temp_Point = ((Position of Flare_Caster) offset by (Random real number between 50.00 and 600.00) towards (Random real number between 0.00 and 360.00) degrees)
Unit - Create 1 Eradicator unit for (Owner of Flare_Caster) at Temp_Point facing Default building facing (270.0) degrees
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_Temp_Point)
Unit - Set level of Eradicator field for (Last created unit) to Flare_Level
Unit - Order (Last created unit) to Undead Lich - Frost Nova (Last created unit)
Custom script: set udg_Temp_Point = null
Wait 0.20 seconds
Set Temp_Point = ((Position of Flare_Caster) offset by (Random real number between 50.00 and 600.00) towards (Random real number between 0.00 and 360.00) degrees)
Unit - Create 1 Eradicator unit for (Owner of Flare_Caster) at Temp_Point facing Default building facing (270.0) degrees
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_Temp_Point)
Unit - Set level of Eradicator field for (Last created unit) to Flare_Level
Unit - Order (Last created unit) to Undead Lich - Frost Nova (Last created unit)
Custom script: set udg_Temp_Point = null

Then

Trigger:
Solar Flare Stop
Collapse Events
Unit - A unit Stops casting an ability
Collapse Conditions
(Ability being cast) Equal to Solar Flare
Collapse Actions
Trigger - Turn off Solar Flare Effects <gen>
Custom script: set udg_Flare_Caster = null
01-14-2009, 07:00 PM#2
Archmage Owenalacaster
I'm assuming Solar Flare is activated by the Lich's Frost Nova. I also notice that you have multiple orders for Frost Nova in your script. I think you have an infinite loop going on there. Turn off the Solar Flare Start trigger at the beginning of the Solar Flare Start trigger; that ought to fix it.

By the way, wow! GUI is difficult to read. After using JASS for so long, GUI borders on being unintelligible. Similar to a native English speaker who doesn't know German trying to read the latter language; there are hints of similarity yet it remains alien.
01-14-2009, 08:04 PM#3
Matarael
Yeah the second part of the script is what actually the core of the spell. For the duration of the ability, ever .4 second there is a dummy unit created which will nova itself basically. But it shuts down (it should) when the spell ends (as seen in the 3rd part where it tells the program to turn it off). I don't get it, there shouldn't be a leak and it should end properly.

And moreover, the bug only occurs when there are actually enemy units around the caster. As I said previously, when I cast it in a quiet environment it runs properly.

Quote:
Similar to a native English speaker who doesn't know German trying to read the latter language; there are hints of similarity yet it remains alien.
LOL man, as an native English speaker living in Germany, I know exactly what you mean. And it's eerie that you chose to use that example.
01-14-2009, 08:12 PM#4
Fireeye
I see 3 leaks.
1 in the start trigger and 2 in the the periodic trigger.
They happen when you use "Position of Flare_Caster" which returns a location.
You never assign it to a variable and destroy it.
Also i don't see any point in nulling a global variable due it will be overwritten when another instance is casted.
However i don't have any idea, why the trigger should crash.
The only thing i could think of is that one of the spells itself is bugged, it happened to me once, but only once, so i guess that's quite rare.
01-14-2009, 08:29 PM#5
Kyrbi0
Strange; while it's a tad long and perhaps complicated, I don't see how it could be that hard to understand (analogically). I mean, it's all linear.
01-15-2009, 12:32 AM#6
Matarael
Oh bloody hell. Why does this happen then. I really like how this ability works and I've no particular desire to remove it.

Damnit.

Anyone has any suggestion? I mean, I will redo the bit with the leak I suppose. But any other stuff?
01-15-2009, 12:37 AM#7
ShadowWolf
If possible, try to remove the wait command that is in there. Wait commands within loops are generally something you really want to avoid, especially when using references like "Last Created Unit". Even though it's only .2 seconds and is shorter than the periodic event, it may be what's causing your problem. Try temporarily disabling that action and see if that fixes it.

EDIT: Your var references look pretty clean, but why not just have the event run every .2 seconds, rather than twice in one function? Try breaking it down to one set of actions with a periodic event of 0.2 seconds.
01-15-2009, 06:56 AM#8
Archmage Owenalacaster
The dummy casters target themselves? Is the ability configured to allow them to target Self?
Seems that when your third trigger is firing, it nulls Flare_Caster. Even though it turns off the second trigger, I'm pretty sure the trigger runs its course and trys to call the nulled Flare_Caster.

There are a number of things which cause crashes. Infinite loops are a favorite. Bad models are least favorite. Orb abilities + Attack Ground (artillery) is amusing.

Idea! Post up a demo map and allow me to play with it. I enjoy tinkering.
01-15-2009, 02:28 PM#9
Matarael
Problem solved ladies and gentlemen. As suggested, I removed the "wait" and just made the 2 summons into 1 and halved the periodic timer. I solved it AFTER I made a demo map with the ability, so if you still wish to see it I could upload it.

Many thanks for everyone, and although it is still a mystery how a simple "wait" removal stopped the crash at least the problem is now gone.

Cheers.

Additional info if you are still curious: the dummy's ability is based on Frost Nova, targetable to Self as well, and the dummy unit itself doesn't have a Locust ability (I have learned the hard way that giving it the ability means it cant target itself LOL).