HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger crashing game

10-01-2005, 05:18 PM#1
The_AwaKening
I made a trigger to kill everything on map besides some key units. It crashes the game for some reason after all the cinematics. Can anyone see something that might be causing it or even a better way to write this trigger.
I also figure it must have something to do with the unit group action or the conditions because I tried making another trigger to do the same thing except that it just selects every unit type individually in a group without conditions then kills.
Here is the one that crashes. --wish [code] was working =/

Quote:
wrath of god test
Events
Unit - A unit Uses an item
Conditions
(Item-type of (Item being manipulated)) Equal to Wrath of God
(Unit-type of (Picked unit)) Not equal to Spirit of a Fallen Hero
(Picked unit) Not equal to The Buyer 0111 <gen>
(Unit-type of (Picked unit)) Not equal to Rising Champion
((Picked unit) is A structure) Not equal to True
(Owner of (Picked unit)) Not equal to Neutral Passive
(Owner of (Picked unit)) Not equal to Neutral Hostile
Actions
Game - Unlock the game speed
Game - Set game speed to Slowest
Game - Lock the game speed
Unit - Pause all units
Cinematic - Fade out over 5.00 seconds using texture White Mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
Wait 4.00 seconds
Sound - Play RollingThunder1 <gen>
Cinematic - Fade in over 0.05 seconds using texture White Mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
Wait 0.05 game-time seconds
Cinematic - Fade out and back in over 0.10 seconds using texture White Mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
Wait 0.06 game-time seconds
Cinematic - Fade out and back in over 0.10 seconds using texture White Mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
Wait 0.06 game-time seconds
Cinematic - Fade out and back in over 0.10 seconds using texture White Mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
Unit Group - Pick every unit in (Units in (Entire map)) and do (Unit - Kill (Picked unit))
Unit Group - Remove all units from (Last created unit group)
Wait 3.00 game-time seconds
Unit - Unpause all units
Game - Unlock the game speed
Game - Set game speed to Fastest
Game - Lock the game speed
10-01-2005, 06:41 PM#2
Anitarf
That's a bit confused. I don't know what exactly might cause the crash, but with all the wierd things you do, it could be anything.

Let's start with the conditions. Except for the first one, they're all irrelevant, since they all reference a "picked unit" which only gives a value in "pick every unit" loops. You should put these conditions in an if-then-else inside the loop where you kill the units.

What is this supposed to do? "Unit Group - Remove all units from (Last created unit group)"

What else... I'm not sure about changing game speed, that could be doing something wierd, is it really neccessary?
10-01-2005, 09:54 PM#3
The_AwaKening
The game speed I did to add to the effect, maybe not necessary. I'll try changing to if,then,else.

I was also under the impressing that I was supposed to remove units from a group to clear the memory. If I don't need it then great, I'll take it out. Is there anything else though that I would need to put in there as to avoid memory leaks?

edit-
I did fix it to work finally by changing the unit group to this
Quote:
Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is A structure) Not equal to True) and (((Unit-type of (Matching unit)) Not equal to Spirit of a Fallen Hero) and (((Unit-type of (Matching unit)) Not equal to Rising Champion) and (((Owner of (Matchin and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)

I do realise that I didn't need to do loop actions and I will change that, but could you answer my question above about memory leaks?
10-02-2005, 06:00 PM#4
Anitarf
Just removing units from a group doesn't fix a leak, the group object is still in memory, you need to destroy that to fix the leak. To do this properly, you need a temp unit group variable.
Code:
Set tempGroup = (Units in (Playable map area) matching ((((Matching unit) is A structure) Not equal to True) and (((Unit-type of (Matching unit)) Not equal to Spirit of a Fallen Hero) and (((Unit-type of (Matching unit)) Not equal to Rising Champion)...
Unit Group - Pick every unit in tempGroup and do (Actions)
    Loop - Actions
        Unit - Kill (Picked Unit)
Custom Script:   call DestroyGroup( udg_tempGroup )
10-02-2005, 06:17 PM#5
The_AwaKening
Thanks for the help, I'll try setting it up that way.
10-04-2005, 08:19 AM#6
divine_peon
you can use warstomp, transfer it to an item ability, with 999999 radius and damage, then check all its targets allowed except those you don't want it to hit.
10-04-2005, 03:25 PM#7
The_AwaKening
I got mine working great, but I might try that anyway for kicks.