• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Not sure why this won't work properly

Status
Not open for further replies.
Level 3
Joined
Apr 6, 2012
Messages
22
I originally posted this over on thehelper.net for help, but they don't seem to be replying over there so I thought I'd ask the awesome people over at THW for help instead. Here's the thread I posted there:

Eh. Feels like I'm asking too many questions which I should solve myself today, but I'm really confused about this one...

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Earth Slam
  • Actions
    • Set Temp_Point = (Position of (Triggering Unit))
    • Set Temp_Group = (Units within (100+(100x(Real((Level of (Ability being cast) for (Triggering Unit)))))) of Temp_Point matching (((Matching unit) belongs to an enemy of (Owner of (Triggering Unit))) Equal to True))
    • Unit Group - Pick every unit in Temp_Group and do (Actions)
      • Loop - Actions
        • Set Ability_Arees2Earth_TargPos = (Position of (Picked Unit))
        • Unit - Move (Picked unit) instantly to (Temp_Point offset by (100x(Real((Level of (Ability being cast) for (Triggering Unit))))) towards (Angle from Temp_Point to Ability_Arees2Earth_TargPos) degrees)
        • Custom script - call RemoveLocation(udg_Ability_Arees2Earth_TargPos)
    • Custom script - call RemoveLocation(udg_Temp_Point)
    • Custom script - call DestroyGroup(udg_Temp_Group)
It's supposed to select every unit in a 200/300/400/500 area (depending on ability level) around the caster and push each one away from the caster by 100/200/300/400 units (depending on ability level), but it seems to only affect one unit in that area and instead of pushing it away, it pulls it towards the caster... Really weird.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
1) You should only ever have 3 temporary locations in your map, since you named one of then "Ability_Arees2Earth_TargPos", I'm going to assume you've got more of them like that.
I like to call them "tempLoc1", "tempLoc2" and "tempLoc3". These names are just guidelines, but 3 temp-locs really is all you need (caster, target and offset).

2) You missed 1 location leak: "Temp_Point offset by [...]" leaks (it creates another location that is at an offset of Temp_Point).

Why this doesn't work is strange. I created the exact same trigger (save for the variable names and the leak) and it did exactly what you wanted it to do.
Perhaps you could upload the map here, in order for me to test?

  • Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set tempLoc1 = (Position of (Triggering unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within (100.00 + (100.00 x (Real((Level of (Ability being cast) for (Triggering unit)))))) of tempLoc1 matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
        • Loop - Actions
          • Set tempLoc2 = (Position of (Picked unit))
          • Set tempLoc3 = (tempLoc1 offset by (100.00 + (100.00 x (Real((Level of (Ability being cast) for (Triggering unit)))))) towards (Angle from tempLoc1 to tempLoc2) degrees)
          • Unit - Move (Picked unit) instantly to tempLoc3
          • Custom script: call RemoveLocation( udg_tempLoc2 )
          • Custom script: call RemoveLocation( udg_tempLoc3 )
      • Custom script: call RemoveLocation( udg_tempLoc1 )
 
Level 3
Joined
Apr 6, 2012
Messages
22
Actually, I only have 1 Temporary Location (at least at the map's current stage) which is Temp_Point. The other one used here is only used in this trigger (haven't used it anywhere else). I usually only ever require 1 temporary location per trigger.

Didn't realise "
 

Attachments

  • Buggy Ability.w3x
    111.7 KB · Views: 42
Level 28
Joined
Jan 26, 2007
Messages
4,789
Actually, I only have 1 Temporary Location (at least at the map's current stage) which is Temp_Point. The other one used here is only used in this trigger (haven't used it anywhere else). I usually only ever require 1 temporary location per trigger.
I'm sorry for the confusion, but that's exactly what I meant.
You only need 3 temporary* point variables for all your triggers.
So I advise you to remove all those locations with funky names and replace them with Temp_Point2 and 3 (or however you wish to name it).
Every time you use those locations, start with the first variable and then use the others if needed.

* Temporary variables are variables that get removed right after setting them. This is usually to remove the leaks (as you've done in your trigger), or just for simplicity (so you don't have to repeat something again and again).
The variable "Ability_Arees2Earth_TargPos" is temporary in that it's never stored to carry information from 1 trigger to the other.


By the way, doesn't your unit group leak in that trigger? Or does "set bj_wantDestroyGroup = true" resolve that (never heard of that script before. I never use scripts unless it is to remove leaks)?
It removes the leak as well :). It's also shorter (1 line less), so most people use "set bj_wantDestroyGroup = true" nowadays.
Anyway, in case you want to use it as well: note that it's only for the first group it encounters.
If you use 2 unit groups right after each other, only the first one will get removed with this (you have to reset the value to "true" for the second one).


I'm even more confused as to why this one won't work properly... It's so basic though. I think it's a problem with the range detection though as it seems as though units get pulled only within a very short range (which is why it seemed earlier like only 1 unit was being pulled).
Well, 200 range (level 1) is very short. 200 range is barely outside of the melee-range (which varies from 90 to 125, but is 100 by default).

The spell seems to work just fine for me (I first tested with all the default values, stood right next to a group of footmen and cast the ability, for the second test I increased the pull-range and was able to pull nearly all the footmen in the region next to me).
Maybe you should just consider increasing the range a bit?
 
Level 3
Joined
Apr 6, 2012
Messages
22
That's weird, because when I cast it at max level it seems to only pull about 200 units...

Yet other spells which work on the same principle (affect units within the same calculation of range) will affect a larger area. I guess I'll just try and change the range calculation on the spell individually and see if it works to make it a more acceptable range.

And yeah, I do understand what you mean with temp variables :p
I guess I expressed myself wrong, because what I meant is that I do not have any point variables other than Temp_Point and Ability_Arees2Earth_TargPos... at all.
 
Status
Not open for further replies.
Top