Very Annoying Crash

Knocksious

Sweet, I got 2 little green bars!
Reaction score
46
Ok

I have an item ability that adds damage based on how many kills you have made with that item

and now whenever a unit attacks something with that item, game crash

The annoying part is that it never used to happen

I will post it's trigger, and all related triggers
please ask any questions whatsoever

somewhat unnecessary info/explanations to references

The name of the item is "Bloodthirster"
"Thundercaller" is another item that casts Chain lightning after 10 attacks



These next 2 triggers set up the event for the Bloodthirster attack ability

Code:
Takes Damage Trigger Setup1
    Events
        Time - Elapsed game time is 1.50 seconds
    Conditions
    Actions
        Set TempUnitGroup = (Units in (Entire map))
        Unit Group - Pick every unit in TempUnitGroup and do (Actions)
            Loop - Actions
                Trigger - Add to ThunderCaller <gen> the event (Unit - (Picked unit) Takes damage)
                Trigger - Add to Bloodthirster Attack <gen> the event (Unit - (Picked unit) Takes damage)

Code:
Takes Damage Trigger Setup2
    Events
        Unit - A unit enters (Entire map)
    Conditions
    Actions
        Trigger - Add to ThunderCaller <gen> the event (Unit - (Entering unit) Takes damage)
        Trigger - Add to Bloodthirster Attack <gen> the event (Unit - (Entering unit) Takes damage)


These Next triggers are the only 2 that bloodthirster uses it is referenced in one other

Code:
BloodthirsterCharge
    Events
        Unit - A unit Dies
    Conditions
        ((Killing unit) has an item of type Bloodthirster) Equal to True
    Actions
        Set AttackItem = (Item carried by (Killing unit) of type Bloodthirster)
        Item - Set charges remaining in AttackItem to ((Charges remaining in AttackItem) + 1)

Code:
Bloodthirster Attack
    Events
    Conditions
        ((Damage source) has an item of type Bloodthirster) Equal to True
    Actions
        Custom script:   local item AttackItem
        Set AttackItem = (Item carried by (Damage source) of type Bloodthirster)
        Unit - Cause (Damage source) to damage (Triggering unit), dealing (10.00 x (Real((Charges remaining in AttackItem)))) damage of attack type Hero and damage type Normal


This next trigger is the only one that Thundercaller uses, I included it because it has the same event as Bloodthirster


Code:
ThunderCaller
    Events
    Conditions
        ((Damage source) has an item of type ThunderCaller) Equal to True
    Actions
        Custom script:   local location AttackPos
        Set AttackItem = (Item carried by (Damage source) of type ThunderCaller)
        Set AttackPos = (Position of (Triggering unit))
        Item - Set charges remaining in AttackItem to ((Charges remaining in AttackItem) + 1)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Charges remaining in AttackItem) Greater than or equal to 10
            Then - Actions
                Unit - Create 1 Dummy Caster for (Owner of (Damage source)) at AttackPos facing Default building facing degrees
                Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
                Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Triggering unit)
                Item - Set charges remaining in AttackItem to 0
            Else - Actions
                Do nothing
        Custom script:   call RemoveLocation (AttackPos)
------------------------------------------------------------------------------


Now, all of this worked fine until I added these seemingly unrelated triggers
(Note: In order to even pick up Bloodthirster the Player's class <Class[PlayerNumber(PickedPlayer)] Has to be equal to 1>


somewhat related trigger (similar event)
Code:
Ranged Unit Ammo
    Events
        Unit - A unit Is attacked
    Conditions
        Class[(Player number of (Owner of (Attacking unit)))] Equal to 3
    Actions
        Custom script:   local item AmmoItem
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Or - Any (Conditions) are true
                    Conditions
                        ((Attacking unit) has an item of type Rusty Javelins) Equal to True
                Or - Any (Conditions) are true
                    Conditions
                        (Unit-type of (Attacking unit)) Equal to Javlineer (human)
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Attacking unit) has an item of type Rusty Javelins) Equal to True
                    Then - Actions
                        Set AmmoItem = (Item carried by (Attacking unit) of type Rusty Javelins)
                    Else - Actions
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Attacking unit) has an item of type Quiver of Arrows) Equal to True
                Or - Any (Conditions) are true
                    Conditions
                        (Unit-type of (Attacking unit)) Equal to Archer (Elf)
            Then - Actions
                Set AmmoItem = (Item carried by (Attacking unit) of type Quiver of Arrows)
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Charges remaining in AmmoItem) Greater than 0
            Then - Actions
                Item - Set charges remaining in AmmoItem to ((Charges remaining in AmmoItem) - 1)
                Skip remaining actions
            Else - Actions
        Unit - Order (Attacking unit) to Stop

------------------------------------------------------------------------------

The rest of the triggers I added (before I found out about this crash, and after it was working) are generic "unit enters region" hero selection type things



I need this to work, if it would help you at all to get a copy of my map, just PM me your email telling me so. I am deathly afraid of idea stealers, so if you have like 0 rep, or like 3 posts I am not going to give you my map (I hope this isn't too harsh)
 
Reaction score
456
In the triggers where you have Unit Takes Damage event, you should turn it off before the damaging action and after the damaging action turn it on again. Else it causes infinite loop.

Ex.

event
unit takes damage
condition
action
unit damage damage source

everytime the bolded part is executed, it runs the trigger again. So you gotta do:

event
unit takes damage
condition
action
turn off this trigger
unit damage damage source
turn on this trigger
 

Knocksious

Sweet, I got 2 little green bars!
Reaction score
46
works like a charm

and all that writing for such a simple answer

Shoulda seen that one. Thanks, Über
 
Reaction score
456
I asked same question when I was making backstab spell. SFilip tolhd hmehh hthat.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top