Pick Unit in Group

TheOverWhelm

Member
Reaction score
16
I'm a little pissed off at this whole thing, since none of it makes sense at all. Due to my 25 hours of being awake, it makes it a bit more annoying.
I'm doing a spell does that X damage closer to its target point, adding on Y damage but Y damage has a bigger AoE and also has a KB effect and hurts allies.. X damage doesn't hurt allies.
I have another trigger that calls the exact same functions and works perfectly, no issues at all, this trigger is call PaladinFistOfHeaven.
When the not-working trigger (called LightningExplosion) starts picking units, they get to a point and decide to QUIT picking the units. Literally, they just stop halfway through the pick and start with the next unit.
The "1" message appears, but nothing after.
Note: Been messing around with it, hence the additional actions, etc
Trigger:
  • LightningElectricalExplosion
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Electrical Explosion
    • Actions
      • Custom script: local integer i = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
      • Set TempPoint = (Target point of ability being cast)
        • Do Multiple ActionsFor each (Integer A) from 1 to 5, do (Actions)
          • Loop - Actions
            • Special Effect - Create a special effect at TempPoint using Doodads\Cinematic\Lightningbolt\Lightningbolt.mdl
            • Set TempEffect = (Last created special effect)
            • Custom script: call ExecuteFunc("PassEffect")
        • Do Multiple ActionsFor each (Integer A) from 1 to 3, do (Actions)
          • Loop - Actions
            • Special Effect - Create a special effect at TempPoint using war3mapImported\AncientExplode.mdx
            • Set TempEffect = (Last created special effect)
            • Custom script: call ExecuteFunc("PassEffect")
      • Set TempUnitGroup = (Units within (300.00 + (50.00 x (Real((Level of (Ability being cast) for (Triggering unit)))))) of TempPoint matching (((Matching unit) is dead) Equal to (==) False))
      • Custom script: set udg_TempReal = (3*udg_ZZZWisdom<i>)-(udg_ZZZStrength<i>*4)
      • Custom script: set udg_TempReal4 = 2*udg_ZZZFocus<i>
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: Wtf
          • Set TempUnit = (Picked unit)
          • Set TempPoint2 = (Position of TempUnit)
          • Set TempReal2 = (Distance between TempPoint and TempPoint2)
          • Game - Display to (All players) the text: 1
          • <span style="color: Red">Custom script: set udg_TempReal3 = AoEEffect(0,udg_TempReal2,udg_TempReal,.003)
          • Game - Display to (All players) the text: 2
          • Custom script: set udg_TempReal6 = AoEEffect(0,udg_TempReal2,udg_TempReal4,.0018)
          • Game - Display to (All players) the text: 3
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (TempUnit belongs to an enemy of (Owner of (Matching unit))) Equal to (==) True
              • Then - Actions
                • Custom script: call DamageUnit(udg_TempReal3+udg_TempReal6, udg_TempUnit,GetTriggerUnit(), 0)
                • Unit - Cause (Triggering unit) to damage TempUnit, dealing (TempReal3 + TempReal6) damage of attack type Spells and damage type Normal
                • Game - Display to (All players) the text: WHY THEFUCKENEMIES
              • Else - Actions
                • Custom script: call DamageUnit(udg_TempReal6, udg_TempUnit,GetTriggerUnit(), 0)
                • Unit - Cause (Triggering unit) to damage TempUnit, dealing TempReal6 damage of attack type Spells and damage type Normal
                • Game - Display to (All players) the text: WHY THEFUCKALLIES
          • Custom script: call RemoveLocation(udg_TempPoint2)
          • Custom script: call AddKnockBack(udg_TempUnit, udg_TempPoint2, udg_TempReal6*12)</span>
      • Custom script: call DestroyGroup(udg_TempUnitGroup)
      • Custom script: call RemoveLocation(udg_TempPoint)
    • </i></i></i>


Here is the trigger that calls the same things but works.
Trigger:
  • PaladinFistOfHeaven
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Fist of Heaven
    • Actions
      • Custom script: local effect e = null
      • Set TempUnit2 = (Casting unit)
      • Set TempReal3 = ((4.00 + (2.00 x (Real((Level of (Ability being cast) for (Triggering unit)))))) x (Real(ZZZEndurance[(Player number of (Owner of (Triggering unit)))])))
      • Set TempReal = (10.00 x (Real(ZZZFocus[(Player number of (Owner of (Triggering unit)))])))
      • Set TempPoint = (Target point of ability being cast)
      • Special Effect - Create a special effect at TempPoint using war3mapImported\Lightnings.mdx
      • Custom script: set e = bj_lastCreatedEffect
      • Set TempUnitGroup = (Units within TempReal of TempPoint matching ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to (==) True) and (((Matching unit) is alive) Equal to (==) True)))
      • Set TempInteger = 3
      • Set TempReal6 = 0.00
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • Set TempPoint2 = (Position of TempUnit)
          • Set TempReal2 = (Distance between TempPoint2 and TempPoint)
          • Custom script: set udg_TempReal5 = AoEEffect(5, udg_TempReal2, udg_TempReal3, .05)
          • Set TempReal6 = (TempReal6 + TempReal5)
          • Set TempReal4 = (TempReal3 x 10.00)
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • TempReal4 Greater than or equal to (&gt;=) 2200.00
              • Then - Actions
                • Set TempReal4 = 2200.00
              • Else - Actions
          • Custom script: call AddKnockBack(udg_TempUnit, udg_TempPoint, udg_TempReal4)
          • Custom script: call DamageUnit(udg_TempReal5, udg_TempUnit, udg_TempUnit2, udg_TempInteger)
          • Custom script: call RemoveLocation(udg_TempPoint2)
      • Unit Group - Remove all units from TempUnitGroup
      • -------- --------
      • Set TempReal6 = (TempReal6 x 0.10)
      • Set TempUnitGroup = (Units within TempReal of TempPoint matching ((((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to (==) True) and (((Matching unit) is alive) Equal to (==) True)))
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Set TempReal = (Real((Number of units in TempUnitGroup)))
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • TempReal Not equal to (!=) 0.00
          • Then - Actions
            • Set TempReal6 = (TempReal6 / TempReal)
          • Else - Actions
            • Unit Group - Remove all units from TempUnitGroup
            • Skip remaining actions
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • Set TempUnit2 = (Picked unit)
          • Custom script: call HealingText(udg_TempReal6,udg_TempUnit2)
      • Unit Group - Remove all units from TempUnitGroup
      • Wait 0.00 seconds
      • Custom script: call DestroyEffect(e)

I know they're confusing to look at. But the Fist of Heaven does damage, knockback, and heals nearby allies for 10% of damage done.
Here is the AoEEffect function.
JASS:
function AoEEffect takes real MinDam, real Distance, real MaxDam, real MinNum returns real
local real r = (MaxDam*Pow(Distance,-1))*(MaxDam/(MinNum*MaxDam))
if r &gt;= MaxDam then
    set r=MaxDam
endif
if r &lt; MinDam then
    set r=MinDam
endif
return r
endfunction

The Knockback effect works fine and is not the center of the issue, AoEEffect seems to be.
Dunno what to do.
 

meOme

New Member
Reaction score
31
I don't know why it works one time and not the other, sorry.

But your AOEEffect-Trigger is needlessly complicated.

You have: (MaxDam*Pow(Distance,-1))*(MaxDam/(MinNum*MaxDam))

Now, Pow(Distance,-1) is the same as 1/Distance.

And (MaxDam/(MinNum*MaxDam)) is just MinNum.

So in the end, what your AOEEffectfunction actually does is:
JASS:
function AoEEffect takes real MinDam, real Distance, real MaxDam, real MinNum returns real
local real r = MaxDam * MinNum / Distance
if r &gt;= MaxDam then
    set r=MaxDam
endif
if r &lt; MinDam then
    set r=MinDam
endif
return r
endfunction
 

TheOverWhelm

Member
Reaction score
16
Having put it in a graphing calculator I got different numbers. I'll keep it the same and simplify at a later date WHEN everything is working. I rather not go messing with things that "aren't broke"
 

sentrywiz

New Member
Reaction score
25
I'm wondering why do you use gui when you know jass. Or you atleast use lots of custom scripts. Wouldn't this be a very easy spell to do in jass?
I don't understand half the custom scripts you used. So I can't check them

Trigger:
  • Set TempUnitGroup = (Units within (300.00 + (50.00 x (Real((Level of (Ability being cast) for (Triggering unit)))))) of TempPoint matching (((Matching unit) is dead) Equal to (==) False))


(((Matching unit) is dead) Equal to (==) False))

I suggest you change this to Matching Unit is Alive equal to true. I had bad experience with Matching Unit is Dead equal to false.

JASS:
local real r = (MaxDam*Pow(Distance,-1))*(MaxDam/(MinNum*MaxDam))


I agree with meOme (not that I know that much jass ) but this line of code is kinda written unnecessarily complex.
 

TheOverWhelm

Member
Reaction score
16
Unit is Alive simply checks the IsUnitDead and just inverts the answer, while the IsUnitDead does an HP check (which I don't want to spend time on).

I know this, I was testing around some equations with my calc and never thought to simplify them, which I will once this trigger is fixed. I rather not do it now since I have been awake for quite awhile.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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