Wrong Code Issue - Select units though 'in range & matching conditions'

Klein~

TH.net Regular
Reaction score
0
Based on undead skill: Carrion Swarm

Trigger:
  • Firebolt
    • Events
    • Unit - A unit Starts the effect of an ability
    • Conditions
    • (Ability being cast) Equal to Firebolt
    • Actions
    • Set HeroInt = (Real((Intelligence of (Triggering unit) (Include bonuses))))
    • Unit - Create 1 DUMMY-Firebolt for (Triggering player) at ((Position of (Triggering unit)) offset by 110.00 towards (Facing of (Triggering unit)) degrees) facing (Target point of ability being cast)
    • Unit - Add a 2.50 second Generic expiration timer to (Last created unit)
    • Unit Group - Add (Last created unit) to Firebolt


Trigger:
  • Firebolt2
    • Events
    • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
    • Unit Group - Pick every unit in Firebolt and do (Actions)
    • Loop - Actions
    • Set FireboltU = (Picked unit)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • (Number of units in (Units within 70.00 of (Position of (Picked unit)) matching ((((Matching unit) is alive) Equal to True) or (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True)))) Greater than 0
    • Then - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • (Number of units in (Units within 70.00 of (Position of (Picked unit)) matching ((Number of units in (Units within 70.00 of (Position of (Picked unit)) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an enemy of (Trigger Greater than 0
    • Then - Actions
    • <b>Unit Group - Add all units of (Units within 100.00 of (Position of FireboltU) matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True))) to FireboltTarget</b>
    • Unit Group - Pick every unit in FireboltTarget and do (Actions)
    • Loop - Actions
    • <b>Unit - Cause FireboltU to damage (Picked unit), dealing (((1.00 + ((HeroInt x 2.00) / 100.00)) x 150.00) / (Real((Number of units in (Units within 100.00 of (Position of (Triggering unit)) matching ((((Picked unit) is alive) Equal to True) and (((Picked unit) belongs to an enemy of (Triggering player)) Equal to Tr damage of attack type Spells and damage type Fire</b>
    • Unit Group - Remove (Picked unit) from FireboltTarget
    • Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 22.00 towards (Facing of (Picked unit)) degrees)
    • Sound - Play Incinerate1 &lt;gen&gt;
    • Set FireboltEffect = (Position of (Picked unit))
    • Special Effect - Create a special effect at FireboltEffect using Abilities\Weapons\SteamTank\SteamTankImpact.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation (udg_FireboltEffect)
    • Else - Actions
    • Unit Group - Add all units of (Units within 100.00 of (Position of (Picked unit)) matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True))) to FireboltTarget
    • Unit Group - Pick every unit in FireboltTarget and do (Actions)
    • Loop - Actions
    • Unit - Cause FireboltU to damage (Picked unit), dealing (((1.00 + ((HeroInt x 1.00) / 100.00)) x 90.00) / (Real((Number of units in (Units within 100.00 of (Position of (Triggering unit)) matching ((((Picked unit) is alive) Equal to True) and (((Picked unit) belongs to an enemy of (Triggering player)) Equal to Tru damage of attack type Spells and damage type Fire
    • Unit Group - Remove (Picked unit) from FireboltTarget
    • Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 18.00 towards (Facing of (Picked unit)) degrees)
    • Sound - Play Incinerate1 &lt;gen&gt;
    • Set FireboltEffect = (Position of (Picked unit))
    • Special Effect - Create a special effect at FireboltEffect using Abilities\Weapons\SteamTank\SteamTankImpact.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation (udg_FireboltEffect)
    • Else - Actions
    • Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 18.00 towards (Facing of (Picked unit)) degrees)


Trigger:
  • Firebolt3
    • Events
    • Unit - A unit Dies
    • Conditions
    • (Unit-type of (Triggering unit)) Equal to DUMMY-Firebolt
    • Actions
    • Special Effect - Create a special effect at (Position of (Triggering unit)) using Abilities\Spells\Other\Doom\DoomDeath.mdl
    • Sound - Play Incinerate1 &lt;gen&gt; at 100.00% volume, located at (Position of (Triggering unit)) with Z offset 0.00
    • Special Effect - Destroy (Last created special effect)
    • Unit - Remove (Triggering unit) from the game


I'm having trouble with this part:

Unit Group - Add all units of (Units within 100.00 of (Position of FireboltU) matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True))) to FireboltTarget

Unit - Cause FireboltU to damage (Picked unit), dealing (((1.00 + ((HeroInt x 2.00) / 100.00)) x 150.00) / (Real((Number of units in (Units within 100.00 of (Position of (Triggering unit)) matching ((((Picked unit) is alive) Equal to True) and (((Picked unit) belongs to an enemy of (Triggering player)) Equal to Tr damage of attack type Spells and damage type Fire

Either these two code parts aren't working. I mean, when the ability is used the dummy is moved towards the enemy but does not damages it.

I think it may be wrong use of 'Matching unit', 'Picked unit' and 'Triggering unit'.

Thanks for helping.
 

keychup

Active Member
Reaction score
34
Looks like you need a hashtable.

Starts the effect of an ability
Create the dummy unit
Set SpecificGroup = Last Created Unit Group
Save SpecificGroup as String(SpecificGroup) of Key(LastCreatedUnit) in (Hashtable)
Add LastCreatedUnit to Bolts

Then every 0.01 seconds:
Pick every unit in Bolts
-Set BoltDummy = PickedUnit
-Set PointA = Position of BoltDummy
-Set SpecificGroup = Load String(SpecificGroup) of Key(PickedUnit) in (Hashtable)
-Set Generic Group = Units within range of PointA Matching condition/s
-Pick every unit in GenericGroup
--If-Matching unit is not in SpecificGroup
--Then-DamageUnit/AddtoSpecificGroup
-Save SpecificGroup as String(SpecificGroup) of Key(PickedUnit) in (Hashtable)
-Set PointB = PointA offset 20 towards angle
-Move BoltDummy to PointB facing angle (or SetUnitX/Y, GetLocationX/Y)
-Custom String: call RemoveLocation (udg_PointA)
-Custom String: call RemoveLocation (udg_PointB)
 

Klein~

TH.net Regular
Reaction score
0
I don't know how to use hashtable man :( I already read about and looked out for examples but nothing concret.
 

Imp Midna

Active Member
Reaction score
52
vypur85 is right. Triggering Player doesnt work because its not a valid reaction to "0.05 seconds have passed". Time and Player do have thery few in common in general. Well, Triggering Player doesnt work. Use Owner of Matching unit, just as vypur85 said. No need for hashtables.
 

keychup

Active Member
Reaction score
34
well, hope you keep mapping until you learn to use hashtables. It makes it dreadfully easy to set individual variables for each unit.
 

Klein~

TH.net Regular
Reaction score
0
well, hope you keep mapping until you learn to use hashtables. It makes it dreadfully easy to set individual variables for each unit.

I'm trying... Just released it is just like a vector that you can store values and load.
 

Tharius

Occasionally Around
Reaction score
39
Unit Group - Add all units of (Units within 100.00 of (Position of FireboltU) matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True))) to FireboltTarget

Replacing "Triggering player" with "Owner of Matching unit" won't work for this part, because Matching unit can't ever belong to an enemy of its own owner. You would want to use "Owner of FireboltU" (the "Matching unit" being added to FireboltTarget is an enemy target of the spell, whereas "FireboltU" is the picked unit that is - presumably - doing the damage).
 
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