HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Picking units in range problem

01-07-2011, 01:23 PM#1
Malfurion
Hey, it's me again.
I wanted to create an ability which swaps life and mana, which worked perfectly fine. Now I wanted to create a improved version which distributes the normally lost life or mana on allied units near the caster, but it won't work, because the "Pick every unit in range" command won't work...

Here is the Trigger
Trigger:
Conversion
Collapse Events
Unit - A unit Starts to cast an ability
Collapse Conditions
(Ability being cast) Equal to Conversion
Collapse Actions
Set COCaster = (Casting unit)
Set COLife = (Life of COCaster)
Set COMana = (Mana of COCaster)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse 'IF'-Conditions
(COCaster has buff Improved Conversion ) Equal to True
Collapse 'THEN'-Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse 'IF'-Conditions
(Max. Life of COCaster) Smaller then COMana
Collapse 'THEN'-Actions
Set KORest = (COMana - (Max. Life of COCaster))
Unit Group - Pick every unit in (Units within 650.00 of (Position of COCaster)) and do (Set COGroup = (Last created unit group))
Game - Display to (All players) the text: (String((Number of units in COGroup)))
Collapse Unit Group - Pick every unit in COGroup and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse 'IF'-Conditions
(Owner of (Picked unit)) Unequal to Neutral hostile
Collapse 'THEN'-Actions
Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + (CORest / (0.50 x (Real((Level of Improved Conversion for COCaster))))))
'ELSE'-Actions
'ELSE'-Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse 'IF'-Conditions
(Max. Mana of COCaster) Smaller then COLife
Collapse 'THEN'-Actions
Set KORest = (COLife - (Max. Mana of COCaster))
Unit Group - Pick every unit in (Units within 650.00 of (Position of COCaster)) and do (Set COGroup = (Last created unit group))
Collapse Unit Group - Pick every unit in COGroup and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse 'IF'-Conditions
(Owner of (Picked unit)) Unequal to Neutral hostile
Collapse 'THEN'-Actions
Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (CORest x (0.50 x (Real((Level of Improved Conversion for COCaster))))))
'ELSE'-Actions
'ELSE'-Actions
'ELSE'-Actions
Unit - Set life of COCaster to COMana
Unit - Set mana of COCaster to COLife

"Game - Display to (All players) the text: (String((Number of units in COGroup)))" mostly gives out "0" and sometimes "1" even when 2 or more units are around the caster and in range.
I don't get it^^ do you know what to do or what's wrong with the trigger?
01-07-2011, 02:36 PM#2
Idontneedaname
Are COCaster and KOCaster the same variable? If not, start there.
01-07-2011, 02:39 PM#3
Malfurion
Quote:
Originally Posted by Idontneedaname
Are COCaster and KOCaster the same variable? If not, start there.
Oh, yeah they are the same. I had to translate the trigger into english and apprently I forgot to change that...
01-07-2011, 03:56 PM#4
Idontneedaname
Trigger:
Unit Group - Pick every unit in (Units within 650.00 of (Position of COCaster)) and do (Set COGroup = (Last created unit group))
Unit Group - Pick every unit in COGroup and do (Actions)

->

Trigger:
Set COGroup = (Units within 650.00 of (Position of (COCaster)))
Collapse Unit Group - Pick every unit in COGroup and do (Actions)
Loop - Actions

Give it a shot.
01-09-2011, 10:07 PM#5
Malfurion
Quote:
Originally Posted by Idontneedaname
Trigger:
Set COGroup = (Units within 650.00 of (Position of (COCaster)))
Collapse Unit Group - Pick every unit in COGroup and do (Actions)
Loop - Actions

This method works perfect! Thank you :D
01-10-2011, 06:12 AM#6
Bribe
What you didn't realise you did was you created a group for each "picked unit" in your original method and set it to COGroup, which is a fantastic example of how much GUI fails to explain what it's doing.