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.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • 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 Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top