HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger Crashes WC3

02-22-2004, 12:32 AM#1
MysticGeneral
Code:
Item Triggers
    Events
        Unit - A unit owned by Player 1 (Red) Acquires an item
        Unit - A unit owned by Player 2 (Blue) Acquires an item
        Unit - A unit owned by Player 3 (Teal) Acquires an item
        Unit - A unit owned by Player 4 (Purple) Acquires an item
        Unit - A unit owned by Player 5 (Yellow) Acquires an item
    Conditions
    Actions
        Hero - Drop the item from slot 1 of LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
        Set ItemDropped1[(Player number of (Owner of (Triggering unit)))] = (Last dropped item)
        Hero - Drop the item from slot 2 of LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
        Set ItemDropped2[(Player number of (Owner of (Triggering unit)))] = (Last dropped item)
        Hero - Drop the item from slot 3 of LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
        Set ItemDropped3[(Player number of (Owner of (Triggering unit)))] = (Last dropped item)
        Hero - Drop the item from slot 4 of LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
        Set ItemDropped4[(Player number of (Owner of (Triggering unit)))] = (Last dropped item)
        Hero - Drop the item from slot 5 of LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
        Set ItemDropped5[(Player number of (Owner of (Triggering unit)))] = (Last dropped item)
        Hero - Drop the item from slot 6 of LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
        Set ItemDropped6[(Player number of (Owner of (Triggering unit)))] = (Last dropped item)
        For each (Integer A) from 1 to 3, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Item-type of (Item being manipulated)) Equal to Item[(Integer A)]
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Or - Any (Conditions) are true
                                    Conditions
                                        ItemDropped1[(Player number of (Owner of (Triggering unit)))] Equal to No item
                                        ItemDropped2[(Player number of (Owner of (Triggering unit)))] Equal to No item
                                        ItemDropped3[(Player number of (Owner of (Triggering unit)))] Equal to No item
                                        ItemDropped4[(Player number of (Owner of (Triggering unit)))] Equal to No item
                                        ItemDropped5[(Player number of (Owner of (Triggering unit)))] Equal to No item
                                        ItemDropped6[(Player number of (Owner of (Triggering unit)))] Equal to No item
                            Then - Actions
                                Hero - Give (Item being manipulated) to LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
                                Hero - Give ItemDropped1[(Player number of (Owner of (Triggering unit)))] to LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
                                Hero - Give ItemDropped2[(Player number of (Owner of (Triggering unit)))] to LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
                                Hero - Give ItemDropped3[(Player number of (Owner of (Triggering unit)))] to LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
                                Hero - Give ItemDropped4[(Player number of (Owner of (Triggering unit)))] to LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
                                Hero - Give ItemDropped5[(Player number of (Owner of (Triggering unit)))] to LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
                                Hero - Give ItemDropped6[(Player number of (Owner of (Triggering unit)))] to LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
                            Else - Actions
                                Hero - Give ItemDropped1[(Player number of (Owner of (Triggering unit)))] to LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
                                Hero - Give ItemDropped2[(Player number of (Owner of (Triggering unit)))] to LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
                                Hero - Give ItemDropped3[(Player number of (Owner of (Triggering unit)))] to LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
                                Hero - Give ItemDropped4[(Player number of (Owner of (Triggering unit)))] to LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
                                Hero - Give ItemDropped5[(Player number of (Owner of (Triggering unit)))] to LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
                                Hero - Give ItemDropped6[(Player number of (Owner of (Triggering unit)))] to LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        PotionUnitAmount[(Player number of (Owner of (Triggering unit)))] Equal to 6
                                    Then - Actions
                                        Game - Display to (All players) the text: |cff00ffccYou canno...
                                        Hero - Drop (Item being manipulated) from Unit[(Player number of (Owner of (Triggering unit)))]
                                    Else - Actions
                                        Set PotionUnit1[(Player number of (Owner of (Triggering unit)))] = PotionUnit2[(Player number of (Owner of (Triggering unit)))]
                                        Set PotionUnit2[(Player number of (Owner of (Triggering unit)))] = PotionUnit3[(Player number of (Owner of (Triggering unit)))]
                                        Set PotionUnit3[(Player number of (Owner of (Triggering unit)))] = PotionUnit4[(Player number of (Owner of (Triggering unit)))]
                                        Set PotionUnit4[(Player number of (Owner of (Triggering unit)))] = PotionUnit5[(Player number of (Owner of (Triggering unit)))]
                                        Set PotionUnit5[(Player number of (Owner of (Triggering unit)))] = LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
                                        Unit - Create 1 ItemHolder for (Player((Player number of (Owner of (Triggering unit))))) at (Center of Items Region <gen>) facing Default building facing degrees
                                        Set LastPotionUnit[(Integer A)] = (Last created unit)
                                        Hero - Give (Item being manipulated) to LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
                                        Set PotionUnitAmount[(Player number of (Owner of (Triggering unit)))] = (PotionUnitAmount[(Player number of (Owner of (Triggering unit)))] + 1)
                    Else - Actions

It just crashes as soon as I pick up an item.

Code:
Hero - Give (Item being manipulated) to LastPotionUnit[(Player number of (Owner of (Triggering unit)))]
I've pinpointed the crash error. It's actually at that point. Where it says "LastPotionUniy[blahblah]" if I change it to something else - it works. (To a pre-placed unit that is)
02-22-2004, 05:33 AM#2
Narwanza
You set the array index = IntegerA but then you call it with the player number. What if he is player 5? It should just ingore it and do nothing, but it might cause it to crash.
02-23-2004, 04:11 AM#3
MysticGeneral
Due to the lack of replies... I have figured the problem out myself over nearly an hour. I was creating an infinite loop if you look carefully.
02-23-2004, 06:15 AM#4
Xinlitik
Hehe, I see that. I wonder how fast your memory filled up?