Spell not working: supposed to hit enemies in a line only once

eskimojoe_66

Member
Reaction score
2
Hi, I'm trying to make a spell that fires out a missile, hitting all enemies it passes through once per missile. Although the first missile works as expected, all subsequent casts cause the missiles to damage enemies it passes through multiple times.

For the life of me, I can't figure out what's going wrong! Maybe all I need is a fresh pair of eyes (see GUI code below).

Cast Trigger:
Code:
Events
    Unit - A unit Starts the effect of an ability
Conditions
    (Ability being cast) Equal to Reaper
Actions
    Set WPreaper_lochero = (Position of hero_unit)
    Set WPreaper_loccast = (Target point of ability being cast)
    Set WPreaper_anglecast = (Angle from WPreaper_lochero to WPreaper_loccast)
    Set WPreaper_locspawn = (WPreaper_lochero offset by 50.00 towards WPreaper_anglecast degrees)
    Unit - Create 1 missile reaper for Player 1 (Red) at WPreaper_locspawn facing WPreaper_anglecast degrees
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            WPreaper_intslots Greater than or equal to 5
        Then - Actions
            Set WPreaper_intslots = 1
        Else - Actions
            Set WPreaper_intslots = (WPreaper_intslots + 1)
    Unit - Set the custom value of (Last created unit) to WPreaper_intslots
    Unit Group - Add (Last created unit) to WPreaper_groupmissile
    Trigger - Turn on reaper move <gen>
    Custom script:  call RemoveLocation(udg_WPreaper_lochero)
    Custom script:  call RemoveLocation(udg_WPreaper_loccast)
    Custom script:  call RemoveLocation(udg_WPreaper_locspawn)

Missile Move/Damage Enemies Trigger:
Code:
Events
    Time - Every 0.01 seconds of game time
Conditions
Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Number of units in WPreaper_groupmissile) Greater than 0
        Then - Actions
            Unit Group - Pick every unit in WPreaper_groupmissile and do (Actions)
                Loop - Actions
                    Set WPreaper_tempint = (Custom value of (Picked unit))
                    Set WPreaper_anglemove = (Facing of (Picked unit))
                    Set WPreaper_locstart = (Position of (Picked unit))
                    Set WPreaper_locend = (WPreaper_locstart offset by 7.00 towards WPreaper_anglemove degrees)
                    Unit - Move (Picked unit) instantly to WPreaper_locend
                    Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - 7.00)
                    Unit Group - Remove all units from WPreaper_grouptarget
                    Set WPreaper_grouptarget = (Units within 85.00 of WPreaper_locend matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) is in WPreaper_grouphit[(Custom value of (Picked unit))]) Equal to False)) and (((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to
                    Unit Group - Pick every unit in WPreaper_grouptarget and do (Actions)
                        Loop - Actions
                            Unit Group - Add (Picked unit) to WPreaper_grouphit[WPreaper_tempint]
                            Unit - Cause hero_unit to damage (Picked unit), dealing 90.00 damage of attack type Spells and damage type Normal
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            (Mana of (Picked unit)) Less than or equal to 0.00
                        Then - Actions
                            Unit - Kill (Picked unit)
                            Unit Group - Remove (Picked unit) from WPreaper_groupmissile
                        Else - Actions
                    Custom script:  call RemoveLocation(udg_WPreaper_locstart)
                    Custom script:  call RemoveLocation(udg_WPreaper_locend)
        Else - Actions
            Trigger - Turn off (This trigger)

Any help will be greatly appreciated!
 

eskimojoe_66

Member
Reaction score
2
hmmm... I've tweaked around with this spell and I'm fairly certain that there is no problem with my triggers, but a bug with unit arrays @@ it works with array number 1 (i.e. WPreaver_grouphit[1]) but not with 2 or above... is this a known problem?
 

Solu9

You can change this now in User CP.
Reaction score
216
Do all players WPreaver_grouphit[X] belong to an enemy of the casting hero?
 

eskimojoe_66

Member
Reaction score
2
yes, all enemies in grouptarget are moved into grouphit[x] so they can only be enemies.

I played around with the second trigger: it works when I change all instances of [x] to 1 but not when [x] is 2 or greater... weird

I figured out a compromise where i just created a separate unit group like this:
WPreaper_grouphit1
WPreaper_grouphit2...
But I'm still confused as to why unit group arrays aren't working for me...
 

Solu9

You can change this now in User CP.
Reaction score
216
I think it has something to do with the custom value. Can you tweak it to something like [Player Number (x-y)]?
 

eskimojoe_66

Member
Reaction score
2
Sorry i didn't make it clear! this is a single player map im making for myself, the only playable slot is player 1(red). The thing is this spell has no cooldown so at any time there can be as many as 3 missiles in play (all from the one hero). Enemies can be hit only once by each missile.

As I've said, I've created a workaround (so the spell works) but I'd still like to know the problem (in case I need to use a similar system in the future). Thanks for your input!
 
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

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top