• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Spell Trigger Conflict (GUI)

Status
Not open for further replies.
Level 2
Joined
Mar 16, 2019
Messages
12
Hello, I'm Naz, I'm new here as you can probably see and I'll try to make this as straight forward as I can for your convenience. I'm making an RPG, my very first map at that, and I have no experience in anything let alone programming, so I've just been copying forum triggers whenever I need something and its been going really well. But now my progress has slowed to a crawl when it came the time to import spells. I imported 10 spells and only 3 of them worked. I fiddled with it a bunch and used a text comparing site for the triggers and went through all the dummies and abilities to be sure that everything was alright and still nothing. I got frustrated and made a new clean and empty map with no other triggers and imported one of the spells that wouldn't work and suddenly it did work.

This leads me to believe that there's some kind of conflict between my spells and my other triggers but I don't know what. I'm assuming that variables may be the culprit here? Either way, I don't know exactly what I'm looking for which is why I'm here.

I'm just gonna post the triggers for the spell I tested in the new map (as that seems like a good start). I'd like to add that this spell also has a JASS version but when I tried it it gave me errors and at this point I was just so much more familiar with GUI to not want to bother with it.


  • Init LSL
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- -------------------------------------------------- --------
      • -------- Create hashtable to store all data --------
      • -------- -------------------------------------------------- --------
      • Hashtable - Create a hashtable
      • Set MH_Hash = (Last created hashtable)
      • -------- -------------------------------------------------- --------
      • -------- Abilities --------
      • -------- -------------------------------------------------- --------
      • -------- Lightning Speed Laceration --------
      • Set MH_Ability[0] = Lightning Speed Laceration - GUI
      • -------- LSL Dummy --------
      • Set MH_Ability[1] = LSL Dummy
      • -------- Disable Attack --------
      • Set MH_Ability[2] = Disable Attack
      • -------- -------------------------------------------------- --------
      • -------- Effects --------
      • -------- -------------------------------------------------- --------
      • -------- The effect to be attached on attacking units --------
      • Set MH_Effect[0] = Abilities\Weapons\FaerieDragonMissile\FaerieDragonMissile.mdl
      • -------- The effect to be attached on target on hit --------
      • Set MH_Effect[1] = Abilities\Weapons\GyroCopter\GyroCopterImpact.mdl
      • -------- -------------------------------------------------- --------
      • -------- The attachment point for the effect on the attacker --------
      • -------- -------------------------------------------------- --------
      • Set MH_Attach_Point = weapon
      • -------- -------------------------------------------------- --------
      • -------- Unit type of the dummy --------
      • -------- -------------------------------------------------- --------
      • Set MH_Dummy_Type = Paladin Dummy
      • -------- -------------------------------------------------- --------
      • -------- How many attack animations are you using --------
      • -------- -------------------------------------------------- --------
      • Set MH_Animation_Indexes[0] = 2
      • -------- -------------------------------------------------- --------
      • -------- The animation indexes of your attack animations --------
      • -------- -------------------------------------------------- --------
      • Set MH_Animation_Indexes[1] = 4
      • Set MH_Animation_Indexes[2] = 5
      • -------- -------------------------------------------------- --------
      • -------- Attack duration --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[0] = 1.50
      • -------- -------------------------------------------------- --------
      • -------- First Dummy Creation Delay --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[1] = 0.21
      • -------- -------------------------------------------------- --------
      • -------- Dummy Creation Interval --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[2] = 0.12
      • -------- -------------------------------------------------- --------
      • -------- Dummy Visibility Time --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[3] = 1.00
      • -------- -------------------------------------------------- --------
      • -------- Base damage --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[4] = 40.00
      • -------- -------------------------------------------------- --------
      • -------- Bonus damage per level --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[5] = 10.00
      • -------- -------------------------------------------------- --------
      • -------- Dummy transparency --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[6] = 50.00
      • -------- -------------------------------------------------- --------
      • -------- Damage delay --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[7] = 0.30
      • -------- -------------------------------------------------- --------
      • -------- Cast delay --------
      • -------- -------------------------------------------------- --------
      • Set MH_Reals[8] = 0.48
      • -------- -------------------------------------------------- --------
      • -------- Does the spell stun --------
      • -------- -------------------------------------------------- --------
      • Set MH_Booleans[0] = True
      • -------- -------------------------------------------------- --------



  • MH Begin Attack
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to MH_Ability[0]
    • Actions
      • Set MH_u1 = (Triggering unit)
      • Set MH_u2 = (Target unit of ability being cast)
      • -------- -------------------------------------------------- --------
      • -------- The unit handle for hashtable key --------
      • -------- -------------------------------------------------- --------
      • Custom script: set udg_MH_i1 = GetHandleId(udg_MH_u1)
      • -------- -------------------------------------------------- --------
      • -------- Removes the attack ability from the caster, so he does not attack on his own --------
      • -------- -------------------------------------------------- --------
      • Unit - Add MH_Ability[2] to MH_u1
      • -------- -------------------------------------------------- --------
      • -------- Randomizes an attack animation --------
      • -------- -------------------------------------------------- --------
      • Set MH_i2 = MH_Animation_Indexes[(Random integer number between 1 and MH_Animation_Indexes[0])]
      • -------- -------------------------------------------------- --------
      • Custom script: call SaveInteger( udg_MH_Hash, udg_MH_i1 , StringHash( "index") , udg_MH_i2)
      • Custom script: call SaveInteger( udg_MH_Hash, udg_MH_i1 , StringHash( "level") , GetUnitAbilityLevel( udg_MH_u1 , udg_MH_Ability[0] - 1 ) )
      • Custom script: call SaveReal( udg_MH_Hash, udg_MH_i1 , StringHash("x") , GetUnitX(udg_MH_u1) )
      • Custom script: call SaveReal( udg_MH_Hash, udg_MH_i1 , StringHash("y") , GetUnitY(udg_MH_u1) )
      • Custom script: call SaveUnitHandle( udg_MH_Hash , udg_MH_i1, StringHash("target") , udg_MH_u2 )
      • -------- -------------------------------------------------- --------
      • -------- Attach a special effect on the unit and save it --------
      • -------- -------------------------------------------------- --------
      • Custom script: call SaveEffectHandle( udg_MH_Hash, udg_MH_i1 , StringHash("effect1") , AddSpecialEffectTarget( udg_MH_Effect[0] , udg_MH_u1 , udg_MH_Attach_Point ) )
      • -------- -------------------------------------------------- --------
      • Unit Group - Add MH_u1 to MH_Caster_Execute
      • Unit Group - Add MH_u1 to MH_Caster_Stop
      • Unit Group - Add MH_u2 to MH_Images
      • -------- -------------------------------------------------- --------
      • Trigger - Turn on MH Clear Images <gen>
      • Trigger - Turn on MH Start Effect <gen>
      • Trigger - Turn on MH Create <gen>



  • MH Start Effect
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to MH_Ability[0]
    • Actions
      • Trigger - Turn on MH Delay Order <gen>



  • MH Delay Order
    • Events
      • Time - Every 0.00 seconds of game time
    • Conditions
    • Actions
      • -------- -------------------------------------------------- --------
      • -------- This trigger is needed because I need that small delay, otherwise the orders --------
      • -------- are issued in wrong order and animations get messed up. --------
      • -------- -------------------------------------------------- --------
      • Unit Group - Pick every unit in MH_Caster_Stop and do (Actions)
        • Loop - Actions
          • Set MH_u1 = (Picked unit)
          • -------- -------------------------------------------------- --------
          • Unit - Order MH_u1 to Hold Position
          • -------- -------------------------------------------------- --------
          • Custom script: call SetUnitAnimationByIndex(udg_MH_u1, LoadInteger( udg_MH_Hash, GetHandleId(udg_MH_u1), StringHash("index")) )
          • -------- -------------------------------------------------- --------
          • Unit Group - Remove MH_u1 from MH_Caster_Stop
          • -------- -------------------------------------------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (MH_Caster_Stop is empty) Equal to True
            • Then - Actions
              • Trigger - Turn off (This trigger)
              • Trigger - Turn off MH Start Effect <gen>
            • Else - Actions



  • MH Create
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in MH_Caster_Execute and do (Actions)
        • Loop - Actions
          • Set MH_u1 = (Picked unit)
          • -------- -------------------------------------------------- --------
          • Custom script: set udg_MH_i1 = GetHandleId(udg_MH_u1)
          • Custom script: set udg_MH_r1 = LoadReal( udg_MH_Hash , udg_MH_i1 , StringHash("time") )
          • Custom script: set udg_MH_u2 = LoadUnitHandle( udg_MH_Hash, udg_MH_i1, StringHash("target"))
          • -------- -------------------------------------------------- --------
          • Custom script: set udg_MH_r2 = GetUnitX(udg_MH_u1)
          • Custom script: set udg_MH_r3 = GetUnitY(udg_MH_u1)
          • -------- -------------------------------------------------- --------
          • Custom script: set udg_MH_r4 = LoadReal( udg_MH_Hash , udg_MH_i1 , StringHash("x") )
          • Custom script: set udg_MH_r5 = LoadReal( udg_MH_Hash , udg_MH_i1 , StringHash("y") )
          • -------- -------------------------------------------------- --------
          • -------- Check that the spell timer isn't over and that the caster and target are still alive --------
          • -------- Also check that the unit hasn't moved, thus is still casting --------
          • -------- -------------------------------------------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (MH_u1 is alive) Equal to True
              • (MH_u2 is alive) Equal to True
              • MH_r1 Less than MH_Reals[0]
              • MH_r4 Equal to MH_r2
              • MH_r5 Equal to MH_r3
            • Then - Actions
              • -------- -------------------------------------------------- --------
              • -------- The following values are the delays for creating a dummy --------
              • -------- -------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • MH_r1 Equal to (MH_Reals[8] - MH_Reals[2])
                      • MH_r1 Equal to (MH_Reals[8] + MH_Reals[2])
                      • MH_r1 Equal to (MH_Reals[8] - (2.00 x MH_Reals[2]))
                      • MH_r1 Equal to (MH_Reals[8] + (2.00 x MH_Reals[2]))
                • Then - Actions
                  • -------- -------------------------------------------------- --------
                  • -------- Tracks how many dummies there are --------
                  • -------- -------------------------------------------------- --------
                  • Custom script: set udg_MH_i2 = 1 + LoadInteger( udg_MH_Hash , udg_MH_i1 , StringHash("dummies") )
                  • -------- -------------------------------------------------- --------
                  • -------- Create a dummy attacker --------
                  • -------- -------------------------------------------------- --------
                  • Custom script: set udg_MH_u3 = CreateUnit(Player(15) , udg_MH_Dummy_Type, udg_MH_r2 , udg_MH_r3 , GetUnitFacing(udg_MH_u1) )
                  • -------- -------------------------------------------------- --------
                  • Custom script: call SaveInteger( udg_MH_Hash , udg_MH_i1 , StringHash("dummies") , udg_MH_i2)
                  • -------- -------------------------------------------------- --------
                  • -------- Link the dummy to caster --------
                  • -------- -------------------------------------------------- --------
                  • Custom script: call SaveUnitHandle( udg_MH_Hash , udg_MH_i1 , udg_MH_i2 , udg_MH_u3 )
                  • -------- -------------------------------------------------- --------
                  • -------- Create and attach a special effect on the dummy --------
                  • -------- -------------------------------------------------- --------
                  • Custom script: set bj_lastCreatedEffect = AddSpecialEffectTarget( udg_MH_Effect[0] , udg_MH_u3 , udg_MH_Attach_Point )
                  • Custom script: call SaveEffectHandle( udg_MH_Hash, GetHandleId(udg_MH_u3) , StringHash("effect1") , bj_lastCreatedEffect)
                  • -------- -------------------------------------------------- --------
                  • -------- Make the dummy partially transparent --------
                  • -------- -------------------------------------------------- --------
                  • Animation - Change MH_u3's vertex coloring to (100.00%, 100.00%, 100.00%) with MH_Reals[6]% transparency
                  • Unit - Change color of MH_u3 to (Color of (Owner of MH_u1))
                  • -------- -------------------------------------------------- --------
                  • -------- Limit the life time of the dummy --------
                  • -------- -------------------------------------------------- --------
                  • Unit - Add a MH_Reals[3] second Generic expiration timer to MH_u3
                  • -------- -------------------------------------------------- --------
                  • -------- Adjust stats of the dummy to affect attack speed --------
                  • -------- -------------------------------------------------- --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (MH_u1 is A Hero) Equal to True
                    • Then - Actions
                      • Hero - Set MH_u3 Hero-level to (Hero level of MH_u1), Hide level-up graphics
                    • Else - Actions
                  • -------- -------------------------------------------------- --------
                  • -------- Retrieve the attack anmation for the caster and play it --------
                  • -------- -------------------------------------------------- --------
                  • Custom script: call SetUnitAnimationByIndex(udg_MH_u3, LoadInteger( udg_MH_Hash, udg_MH_i1, StringHash("index") ) )
                • Else - Actions
              • -------- -------------------------------------------------- --------
              • -------- Reduce the spell timer --------
              • -------- -------------------------------------------------- --------
              • Custom script: call SaveReal( udg_MH_Hash, udg_MH_i1 , StringHash("time") , udg_MH_r1 + 0.03)
              • -------- -------------------------------------------------- --------
              • -------- Check whether damage should be applied or not --------
              • -------- -------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • MH_r1 Equal to (MH_Reals[8] + MH_Reals[7])
                      • MH_r1 Equal to (MH_Reals[8] + (MH_Reals[7] + MH_Reals[2]))
                      • MH_r1 Equal to (MH_Reals[8] + (MH_Reals[7] + (2.00 x MH_Reals[2])))
                      • MH_r1 Equal to (MH_Reals[8] + (MH_Reals[7] - MH_Reals[2]))
                      • MH_r1 Equal to (MH_Reals[8] + (MH_Reals[7] - (2.00 x MH_Reals[2])))
                • Then - Actions
                  • -------- -------------------------------------------------- --------
                  • -------- Apply damage --------
                  • -------- -------------------------------------------------- --------
                  • Custom script: call UnitDamageTarget( udg_MH_u1 , udg_MH_u2 , ( udg_MH_Reals[4] + ( udg_MH_Reals[5] * LoadInteger( udg_MH_Hash , udg_MH_i1 , StringHash("level") ) ) ) , true , false , ATTACK_TYPE_NORMAL , DAMAGE_TYPE_NORMAL , WEAPON_TYPE_METAL_HEAVY_BASH )
                  • -------- -------------------------------------------------- --------
                  • -------- Create effect on the target --------
                  • -------- -------------------------------------------------- --------
                  • Custom script: call DestroyEffect( AddSpecialEffectTarget( udg_MH_Effect[1] , udg_MH_u2 , "chest" ) )
                  • -------- -------------------------------------------------- --------
                  • -------- If the original caster applies damage, create a dummy and make it cast stunning spell on the target --------
                  • -------- -------------------------------------------------- --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • MH_Booleans[0] Equal to True
                      • MH_r1 Equal to (MH_Reals[7] + MH_Reals[8])
                    • Then - Actions
                      • Custom script: set udg_MH_u1 = CreateUnit(Player(15) , udg_MH_Dummy_Type, GetUnitX(udg_MH_u2) , GetUnitY(udg_MH_u2) , GetUnitFacing(udg_MH_u2) )
                      • -------- -------------------------------------------------- --------
                      • Animation - Change MH_u1's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
                      • -------- -------------------------------------------------- --------
                      • Unit - Add MH_Ability[1] to MH_u1
                      • Unit - Order MH_u1 to Human Mountain King - Storm Bolt MH_u2
                      • Unit - Add a MH_Reals[3] second Generic expiration timer to MH_u1
                      • -------- -------------------------------------------------- --------
                    • Else - Actions
                • Else - Actions
            • Else - Actions
              • -------- -------------------------------------------------- --------
              • -------- Spell over, destroy the effect on the caster --------
              • -------- -------------------------------------------------- --------
              • Custom script: call DestroyEffect(LoadEffectHandle( udg_MH_Hash, udg_MH_i1,StringHash("effect1") ) )
              • -------- -------------------------------------------------- --------
              • Unit Group - Remove MH_u1 from MH_Caster_Execute
              • -------- -------------------------------------------------- --------
              • Unit - Remove MH_Ability[2] from MH_u1
              • -------- -------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • MH_r4 Equal to MH_r2
                  • MH_r5 Equal to MH_r3
                • Then - Actions
                  • Unit - Order MH_u1 to Stop
                • Else - Actions
                  • -------- -------------------------------------------------- --------
                  • -------- Kill dummies --------
                  • -------- -------------------------------------------------- --------
                  • For each (Integer loopA) from 1 to (Load (Key dummies) of (Key (Picked unit)) from MH_Hash), do (Actions)
                    • Loop - Actions
                      • Unit - Kill (Load loopA of MH_i1 in MH_Hash)
              • -------- -------------------------------------------------- --------
              • Custom script: call FlushChildHashtable( udg_MH_Hash, udg_MH_i1 )
              • -------- -------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (MH_Caster_Execute is empty) Equal to True
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions



  • MH Clear Images
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to MH_Dummy_Type
    • Actions
      • -------- -------------------------------------------------- --------
      • -------- This trigger handles the dummy units --------
      • -------- -------------------------------------------------- --------
      • Set MH_u1 = (Triggering unit)
      • -------- -------------------------------------------------- --------
      • Custom script: set udg_MH_i1 = GetHandleId(udg_MH_u1)
      • -------- -------------------------------------------------- --------
      • Custom script: call DestroyEffect(LoadEffectHandle( udg_MH_Hash, udg_MH_i1,StringHash("effect1") ) )
      • -------- -------------------------------------------------- --------
      • Custom script: call FlushChildHashtable( udg_MH_Hash, udg_MH_i1 )
      • -------- -------------------------------------------------- --------
      • Unit Group - Remove MH_u1 from MH_Images
      • -------- -------------------------------------------------- --------
      • Unit - Remove MH_u1 from the game
      • -------- -------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (MH_Images is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions


Thanks in advance.
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
In situations like this, posting all of the triggers that did work in the blank map really doesn't provide much useful information. If you got the spell from a resources section like THW has then the spell probably works fine (and thus would work fine in a blank map) so it is something specific to your map that is causing the error. For that matter, can you link where you got this MH spell from? It would help to know what it's supposed to do and I can't really tell from the triggers except that it is highly cinematic in nature.

Second, it's often most helpful to simply upload your map (or a testmap that shows the issues) so that others can play with it and figure out what's going on. Third, it's best to describe what exactly is "not working" about the triggers you're attempting to import and use. Does the spell...
  • ... throw errors when trying to save the map?
  • ... do absolutely nothing when you try to cast it?
  • ... do part of what it's supposed to do but not all of it?
  • ... totally bug out and do something unexpected?
  • ... crash the game when cast?
  • ... interfere with other triggers/spells/systems that were working fine before?
  • etc.
Finally as to what may be going on here: my best guess is that (despite what you said about checking all of the dummies and abilities) you're simply not configuring the spell configurables properly. Spells, buffs, units, items, etc. all have a rawcode that identifies them to the game, something like A001. If you press ctrl+d you can see the rawcodes next to objects in the OE. When you copy and paste triggers/objects between maps the WE sees something like "ability X uses buff B002" and then just populates that ability's buff field with whatever buff B002 is at that time in the map you're importing into. In the source map B002 is the spell's buff, but in your map B002 might already be in use for some other custom buff and now that spell you just copied over is using the wrong buff. When you copy over the buff it will get a new rawcode (they go up sequentially) and you'll need to alter all references to point to the 'correct' rawcode of the buff.

Buffs are just an example, this can and will happen with all object data. The same sort of thing will happen with your triggers when you paste them into your map. With triggers I believe sometimes you have to save, close, and re-open the map to actually see what references are wrong (it will appear correct right after you paste because it thinks it knows what the rawcodes of all the relevant objects are... but it doesn't). So in your case you should check out the configuration triggers of the imported spells and see if the variable assignments are all still correct. If they do all appear to be then, well, post the map.
 
Level 2
Joined
Mar 16, 2019
Messages
12
In situations like this, posting all of the triggers that did work in the blank map really doesn't provide much useful information. If you got the spell from a resources section like THW has then the spell probably works fine (and thus would work fine in a blank map) so it is something specific to your map that is causing the error. For that matter, can you link where you got this MH spell from? It would help to know what it's supposed to do and I can't really tell from the triggers except that it is highly cinematic in nature.

Second, it's often most helpful to simply upload your map (or a testmap that shows the issues) so that others can play with it and figure out what's going on. Third, it's best to describe what exactly is "not working" about the triggers you're attempting to import and use. Does the spell...
  • ... throw errors when trying to save the map?
  • ... do absolutely nothing when you try to cast it?
  • ... do part of what it's supposed to do but not all of it?
  • ... totally bug out and do something unexpected?
  • ... crash the game when cast?
  • ... interfere with other triggers/spells/systems that were working fine before?
  • etc.
Finally as to what may be going on here: my best guess is that (despite what you said about checking all of the dummies and abilities) you're simply not configuring the spell configurables properly. Spells, buffs, units, items, etc. all have a rawcode that identifies them to the game, something like A001. If you press ctrl+d you can see the rawcodes next to objects in the OE. When you copy and paste triggers/objects between maps the WE sees something like "ability X uses buff B002" and then just populates that ability's buff field with whatever buff B002 is at that time in the map you're importing into. In the source map B002 is the spell's buff, but in your map B002 might already be in use for some other custom buff and now that spell you just copied over is using the wrong buff. When you copy over the buff it will get a new rawcode (they go up sequentially) and you'll need to alter all references to point to the 'correct' rawcode of the buff.

Buffs are just an example, this can and will happen with all object data. The same sort of thing will happen with your triggers when you paste them into your map. With triggers I believe sometimes you have to save, close, and re-open the map to actually see what references are wrong (it will appear correct right after you paste because it thinks it knows what the rawcodes of all the relevant objects are... but it doesn't). So in your case you should check out the configuration triggers of the imported spells and see if the variable assignments are all still correct. If they do all appear to be then, well, post the map.

Thanks a lot for the feedback I appreciate it. As for my little problem, I don't want to waste too much of your time so I fiddled with it a bit by deleting trigger folders one by one and I just so happened to find the culprit. Honestly, I don't know why I didn't try this sooner, I guess I'm just dumb but whatever at this point.

  • Trees
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Visibility - Create an initially Enabled visibility modifier for Player 1 (Red) emitting Visibility across (Playable map area)
      • Custom script: set bj_wantDestroyGroup = true
      • Destructible - Pick every destructible in (Playable map area) and do (Actions)
        • Loop - Actions
          • Destructible - Make (Picked destructible) Invulnerable
For disclosure, I have finished the level design, so unit creation, items and triggers are all that's really left so using the indestructible barren tree is kind of out of the question. So if you happened to know of an alternative to this trigger that would be fantastic.

Here's the link to the spell in question just so you have an understanding of its "nature" if that's any help to you, I guess?
Lightning Speed Laceration 1.09
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
Ah well that trigger you posted makes it very clear what the issue is, so I applaud your sleuthing. It is strongly recommended not to use the Map Initialization event. The reason is that if too many things happen on Map Init something will hit the game's OP (operations) limit and cause a threadcrash (trigger stops executing). In theory the OP limit is necessary so the game can't get stuck in an infinite loop that would lock up or crash it; instead after doing too many things without a break the game engine manually stops the trigger(s) from executing. When you threadcrash in a Map Init trigger, all other map init triggers that come 'after' it will never be run. The first trigger you linked in your first post above uses Map Init as its event and was likely not being run (which sets up all the configuration variables for the spell, without which the spell will fail to do anything) because the Trees trigger happened 'before' it and caused a threadcrash.

Instead of using the Map Init event, you should use the Elapsed Game Time = 0.10 event (0.10 is just an example; you can pick any same, small amount of time for all of them or a series of different times if you need some triggers to init before others run their inits). This means that if one of these triggers causes a threadcrash it won't also stop all of your other init triggers from running properly. Just the one that crashed won't have finished.

So what actually caused the threadcrash? This line: Destructible - Pick every destructible in (Playable map area) and do (Actions). Depending on the size of your map you may have thousands of destructibles, and picking them all at once is a recipe for hitting the OP limit real quick (this post by weaaddar suggests the actual number of operations varies wildly depending on what you're doing). Instead what you want to do is divide your map into a series of regions, then pick the destructibles in each of those regions in succession with a small Wait action between them. Using a Wait action will reset the OP count to 0, avoiding the threadcrash. Depending on the size of your map maybe you only need 2 regions or maybe you need 9, idk.

  • Destructible - Pick every destructible in (Tree Region 1 <gen>) and do (Actions)
    • Loop - Actions
      • Destructbile - Make (Picked destructible) Invulnerable
  • Wait 0.00 seconds //this won't actually be 0 seconds, this action has a minimum wait time of ~0.27s, but putting 0 makes it as short as it can be
  • Destructible - Pick every destructible in (Tree Region 2 <gen>) and do (Actions)
    • Loop - Actions
      • Destructbile - Make (Picked destructible) Invulnerable
  • Wait 0.00 seconds
  • Destructible - Pick every destructible in (Tree Region 3 <gen>) and do (Actions)
    • Loop - Actions
      • Destructbile - Make (Picked destructible) Invulnerable
  • -------- etc. --------
Three other quick comments:
  • Destructibles don't have a 'group' type variable so actually nothing is leaked with a Destructible - Pick action, unless it's using a location for a "within X of <location>" destructibles in range, which will leak the location like normal.
  • The bj_wantDestroyGroup trick only works for unit groups (and for completeness: it doesn't work with "units of player" unit groups).
  • After you create a visibility modifier you'll want to assign it to a variable so you can enable/disable it later, if it's not supposed to be a permanent visibility modifier.
  • Another possible solution instead of making the trees invulnerable would be to set their object health (in the OE) to the maximum that field allows; units probably won't be able to deal enough damage to destroy trees with that much health.
  • Two of the most helpful tutorials I end up having to link to people all the time:
    Things That Leak
    Visualize: Dynamic Indexing
 
Status
Not open for further replies.
Top