you need to track the number of units owned in a variable and then deal damage with a trigger function, use arithmetic to do e.g. 10x your variable
what have you tried so far? care to share your triggers?
This is really close to want i need but, as i said i need to count only summoned units and should work for any player (using their own summoned units)Hello there !
I found out that some of the new natives to set real values fields of abilities have been added to GUI.
You could try something like that :
Set Ability Damage
Events
Unit - A unit owned by Player 1 (Red) Begins casting an ability
Conditions
(Ability being cast) Equal to Shadow Strike
Actions
Ability - Set Ability: (Unit: (Casting unit)'s Ability with Ability Code: Shadow Strike)'s Real Level Field: Damage ('Hbz2') of Level: (Level of Shadow Strike for (Triggering unit)) to (10.00 x (Real((Count non-structure units controlled by Player 1 (Red) (Exclude incomplete units)))))
I dont get the "Real()" part, can u explain what it is ? how do i do it ?If you read the trigger carefully you will notice the Real() so you first need to use conversion integer to real.
I am not used to GUI in all fairness, maybe there is a way to add summoned units.*
EDIT oh and for any player, just add them thats all.
It was just an example i made quickly because I had WE opened on a new map
EDIT 2: I am not sure but maybe "count living units owned by player" would include summoned unit.
EDIT 3 never mind, I just read your other messages, it seems you only want to account for summoned units. This should be doable with a pick and unit type comparison with "UNIT_TYPE_SUMMONED".
EDIT 4 : sorry for so many edits.
Try this :
Of course as you've noticed I used shadow strike ability because it has a damage field...
Set Ability Damage
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Shadow Strike
Actions
Ability - Set Ability: (Unit: (Casting unit)'s Ability with Ability Code: Shadow Strike)'s Real Level Field: Damage ('Hbz2') of Level: (Level of Shadow Strike for (Casting unit)) to (10.00 x (Real((Number of units in (Units owned by (Owner of (Casting unit)) matching (((Casting unit) is Summoned) Equal to True).)))))
I understood out less than half of what you said xDNumber of units is an integer.
But when making the trigger in GUI, the new damage you want to set is a real value.
If you try to set a real value the editor won't let you access the values returning an integer, and the number of units that are summoned for the player is an integer.
So be able to access the "Number of units", you have to tell the trigger editor that you are looking for an integer converted to real rather than a real when you are setting up the new damage.
If you just search in the real values choices, there will be no "number of units" because it is not a real value ^^
It doesnt workWell first of all, understand I am not comfortable with GUI triggers
But the way it works is this.
When you're in the trigger editor and you chose let's say a real value you want to assign like the damage.
But we want to set the dame to the number of summoned units x 10
Problem is the damage is a real number
and the number of summoned units is an integer
So when you will search for what to put in the value of the damage of the ability, when you will do arithmetic to make a multiplication, for the trigger editor it will still be real values so once you chose 10 for left number, then the multiplication, you will be stuck because it won't offer you to select "number of units". So you first need to chose "convert integer to real, then inside the value will be an integer, and in integer values the trigger editor will let you use "number of units...."
I know it can be confusing, but being able to use integer values in real numbers is what is called type casting, and Jass / GUI do not support this. Thats why you have to use the conversion.
By the way, sorry, but as shadowstrike is a hero ability, it has made the trigger even more complicated because you usually set the damage for the level of the ability that your hero has.
If you use a unit ability with some damage, it will be easier because unit abilities don't have a level.
Wooo....
Sounds much more complicated when you have to explain every little bit![]()
function BlzSetAbilityRealLevelFieldBJ takes ability whichAbility, abilityreallevelfield whichField, integer level, real value returns nothing
set bj_lastInstObjFuncSuccessful = BlzSetAbilityRealLevelField(whichAbility, whichField, level, value)
endfunction
Hi, first of all thanks for helping me.Everything is indexed starting at 0 with these new natives which means that level 1 is actually level 2. So when you say "level of ability being cast" you're actually saying "level of ability being cast + 1". Or in this case, level of Shatter is really 1 level higher than it should be. An easy solution is to subtract 1 from the level, so: "Level of ability being cast - 1" or "Level of Shatter - 1".
Along with that it's also likely that the chosen Damage field is incorrect. Here's just a few of the different Damage fields:
See the Rawcodes ('Uin1'), ('Htb1'), etc... those are specific to each ability that deals damage. The one that Macadamia referenced was specific to Shadow Strike, but if your ability isn't based on Shadow Strike then this won't work.
Actions
Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s Real Level Field: Damage ('Uin1') of Level: 0 to 1000.00
Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s Real Level Field: Damage ('Htb1') of Level: 0 to 1000.00
Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s Real Level Field: Damage ('Osh1') of Level: 0 to 1000.00
Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s Real Level Field: Damage ('Nfd3') of Level: 0 to 1000.00
Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s Real Level Field: Damage ('Ucs1') of Level: 0 to 1000.00
So the question is, what ability is Shatter based on @Meetius?
And what is it's Damage field rawcode? (Press Control + D in the Object Editor to view Raw data)
I have an example of this in the picture I attached below, it displays the rawcode for Storm Bolt's Damage field which is 'Htb1'.
Hello there.
@Meetius : you mean Storm Bolt, right ? If I remember correctly Lightning Bolt is a Wow spell, no ?
I attached my test map, I gave a Shatter ability to Maiev based on StormBoilt with the appropriate real field.
It works great but with 1 downside : the tooltip of the ability does not change even if the damage does.
So you will have to change the tooltip manually for each level everytime the damage is changed.
Yep, same for me, cant test for the same reason...Hope you will be able to.
I am stuck with testing at the moment battlenet servers seem overloaded for me so it refuses to start maps from WE.
EDIT : you mean you use chain lightning ??? For this ability the real value field will be Ocl1 - Damage per Target
Okay, i'll try and let you knowShould be ok, just use the proper Real Value field that I just mentioned and it should work great.
It seems easier to do it than to say it, I don't know what else to do to make it workHehe.
Well as you can compare the unit classification with UNIT_TYPE-SUMMONED, it would be easy to pick all units belonging to a player with that condition and then remove every picked unit.
Not in front on WE right now, but I believe this is easy to do in the GUI editor.
This is an easy way and it works for sure but, there other heroes with a "summon ability" (other than more than one player ^^') so it doesnt work as i want it to work :cPick every unit owned by triggering player matching matching unit classification equal to summoned.
You can also add the summoned units to a Unit Group to have more control over it.
This allows you to control which types of summoned units are being tracked. Then you can do "Pick every unit in SummonUnitGroup and kill picked unit". Make sure to clear the Unit Group of the summoned units once you kill them.
Events:
A unit spawns a summoned unit
Conditions:
Unit-type of summoned unit equal to Water Elemental
Actions:
Add summoned unit to SummonUnitGroup
My map is even more complex than this, its an arena with four team, each team have up to four player (but a single hero can be chosen only once per team).Well I understand, in your map you have 2 opposing heroes using their spawned units as pawns.
Even if you end up with several heroes, you have 2 options : use @Uncle method and use 1 group per hero.
Or "mark" your summoned units with a number by setting their unit user data, and when it comes to removing, use that unit user data value in a condition to check if it should be removed.
Hope it doesn't sound too vague.
EDIT : sorry confused myself with the map![]()
You make 1 Group with an Array. SummonUnitGroup[1] belongs to Player 1, SummonunitGroup[2] belongs to Player 2, etc...My map is even more complex than this, its an arena with four team, each team have up to four player (but a single hero can be chosen only once per team).
That said, since making 16 groups seems a bit too much (xD), how this "mark" this works ? do you mind explaining it to me ? ^^'
That's exactly what is called "making 16 groups" xDYou make 1 Group with an Array. SummonUnitGroup[1] belongs to Player 1, SummonunitGroup[2] belongs to Player 2, etc...
And then how do i call a specific number ?Its just a value you can give to the unit that is not related to the fields you find in the object editor, its called UnitUserData and I believe you can set any integer value yo a unit that way.
Let's say you have 16 heroes in total, well when the units are summoned, just change their UnitUserData to the number of the hero and then you can access this number at any time.
OK just had a look in trigger editor, the UnitUserData is actually called Unit - Custom Value in GUI
But i still dont understand how to call a specific number ^^'You call that number when you pick every summoned unit : you read the custom value and if it matches your hero number then you remove the unit
EDIT as for setting the custom value, just use something like that (in that example I set it to the player owning the summoning unit number, but if there are several heroes, maybe you could set the custom values of the heroes first and then give the summoned unit the same custom value as the hero.
EDIT 2 : you could even use the heroes Unit Ids as custom values for the summoned units, thats an idea that just popped up ^^
Set Ability Damage
Events
Unit - A unit Spawns a summoned unit
Conditions
Actions
Unit - Set the custom value of (Summoned unit) to (Player number of (Owner of (Summoning unit))
I still don't know how to create such a thing (I just copied / pasted it from your map to mine xD) but it workedHere's how to do the Unit Group stuff.
SummonGroup is a Unit Group variable with an Array.
Add To Group
Events
Unit - A unit Spawns a summoned unit
Conditions
Or - Any (Conditions) are true
Conditions
(Unit-type of (Summoned unit)) Equal to Water Elemental (Level 1)
(Unit-type of (Summoned unit)) Equal to Water Elemental (Level 2)
(Unit-type of (Summoned unit)) Equal to Water Elemental (Level 3)
Actions
Unit Group - Add (Summoned unit) to SummonGroup[(Player number of (Triggering player))]
Kill Summons
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Kill Summons
Actions
Unit Group - Pick every unit in SummonGroup[(Player number of (Triggering player))] and do (Actions)
Loop - Actions
Unit - Kill (Picked unit)
Summon Dies
Events
Unit - A unit Dies
Conditions
((Triggering unit) is in SummonGroup[(Player number of (Triggering player))].) Equal to True
Actions
Unit Group - Remove (Triggering unit) from SummonGroup[(Player number of (Triggering player))].
And for Macadamia's method, I think a Unit Indexer is what you'd want to use here, it's very GUI friendly.
GUI Unit Indexer 1.4.0.0