• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] Selection Function in Trigger help

Level 8
Joined
Oct 6, 2022
Messages
185
Hello, i would like to know how to make this.

when casting spell, the owner of the T_unit(TriggeringUnit) will not be able to select it until the trigger orders it to be selected again.
for example: the T_unit cast rain of fire, the player won't be able to select it until the rain of fire ends its duration. And when the rain of fire ends or the T_Unit got interrupted, the trigger will select the T_unit again.

BUT, here's the condition. The T_unit will be selected if the player didn't select any other unit.
And if this T_unit was part of the group of the selected unit(like 5 footman and the T_unit for example), it'll be added to the selection again. unless the player group selection reach its maximum capacity like 12 units and when the T_Unit cast and was remove from the selection which it would be only 11 units in group selection and if the player selects another unit to fill up the group selection to make it 12 again, the T_Unit won't be selected.

anyone could able to do this? I hope you guys could help me with this.
 
Last edited:
Level 12
Joined
Jul 5, 2014
Messages
551
I'm a bit confused about your intentions. Do you want to have a selected unit, no matter what? There's a trigger to instantly deselect the selected unit. There's a boolean recognizing if a unit is selected and you can use a unit group where you put every selected units (minus the particular unit). Then, you can use integer condition to count how many units are in that group. If 0, then select the triggering unit.
 
Level 8
Joined
Oct 6, 2022
Messages
185
• The individual selection where you only have the T_Unit as your last selected unit is "what if while i can't select this T_unit when casting this rain of fire and then i select this other unit or building, would i returned to T_unit after it cast rain of fire?" You Shouldn't, because your last selected unit should only be T_unit and not this other units or buildings.
• The group of units that i have mentioned are only the time the player multiple select units to add to it's selection "what if i cast this rain of fire while i have this 5 units in my selection, would it still be return to my team or not?" the answer is yes, it'll still be added to your selection as long as you won't do this where you reach more than maximum selection which is 12, cast the rain of fire and selects another new unit to just fill up your multiple select rather than just wait unit T_Unit ends it's rain of fire.
 
Level 12
Joined
Jul 5, 2014
Messages
551
• The individual selection where you only have the T_Unit as your last selected unit is "what if while i can't select this T_unit when casting this rain of fire and then i select this other unit or building, would i returned to T_unit after it cast rain of fire?" You Shouldn't, because your last selected unit should only be T_unit and not this other units or buildings.
• The group of units that i have mentioned are only the time the player multiple select units to add to it's selection "what if i cast this rain of fire while i have this 5 units in my selection, would it still be return to my team or not?" the answer is yes, it'll still be added to your selection as long as you won't do this where you reach more than maximum selection which is 12, cast the rain of fire and selects another new unit to just fill up your multiple select rather than just wait unit T_Unit ends it's rain of fire.
That's still unclear. Maybe because I don't know the why of it. The intention is that the T_Unit is always selected when not using rain of fire? Maybe a little context would help about why you want this selection thing.
 
Level 8
Joined
Oct 6, 2022
Messages
185
sorry let me try to clear it up, The OP(owner player) has still a free will to select other things such as units, buildings or whatever the OP wishes. it's just that when the OP order the T_Unit to cast the rain of fire, that's when the deselection and selection thing starts.
the trigger where the T_Unit won't be able to select by the OP and only happens every time the unit cast rain of fire. The T_Unit "cannot be selected" by the OP when casting rain of fire but then turns off the "cannot be selected" and selects the T_Unit once(not permanent) as long as it meet the conditions...


I know it's simple to make the basic select and deselection function, but I've came up an idea that maybe this new selection and deselection function that I've think is somewhat interesting since it's not just basic but it has some conditions to make it work satisfyingly.
 
Last edited:
Level 12
Joined
Jul 5, 2014
Messages
551
The player has still a free will to select other things such as units, buildings or whatever the player wishes. it's just that when the player order the T_Unit to cast the rain of fire, that's when the deselection and selection thing starts.
the trigger where the T_Unit won't be selected and be selected only happens every time the unit cast rain of fire. The T_Unit "cannot be selected" when casting rain of fire but then turns off the "cannot be selected" and selects the T_Unit once(not permanent) as long as it meet the conditions...


I know it's simple to make the basic select and deselection function, but I've came up an idea that maybe this new selection and deselection function that I've think is somewhat interesting since it's not just basic but it has some conditions to make it work satisfyingly.
So, you want absolute lack of selection rather than instant deselection the moment someone selects the unit while casting? I'm not sure if there's a function for that. The closest thing I can think of is changing the owner of unit while rain of fire is being cast.
 
Level 8
Joined
Oct 6, 2022
Messages
185
by means when changing owner, would that lead to an issues? i have this old streak system where the owner of the T_unit gets the streak and gets the score. if i set it as neutral the neutral gets the score or i might say that "unit has been killed by neutral" which it would be the same as the others, i believe doin that would lead to some sort of new issues.
 
Level 12
Joined
Jul 5, 2014
Messages
551
by means when changing owner, would that lead to an issues? i have this old streak system where the owner of the T_unit gets the streak and gets the score. if i set it as neutral the neutral gets the score or i might say that "unit has been killed by neutral" i believe doin that would lead to some sort of new issues.
What score? The ending score screen? I'm not in front of an editor now but isn't there a trigger to give every score x player gets to another player?
 
Level 8
Joined
Oct 6, 2022
Messages
185
no not the ending score screen but the ingame streaks and multiboard where it goes "Player has been killed by ThisPlayer" + gets kill points. it'll be the same goes as the player that doesn't exist from the game, they got the streak and kill points but not the original owner of the unit.
 
Level 12
Joined
Jul 5, 2014
Messages
551
no not the ending score screen but the ingame streaks and multiboard where it goes "Player has been killed by ThisPlayer" + gets kill points. it'll be the same goes as the player that doesn't exist from the game, they got the streak and kill points but not the original owner of the unit.
Can't you trigger this passive player's scores to be added to original owner player? I'm pretty sure there supposed to be an option like that. If player neutral gets 1 point, add 1 point to player original owner.
 
Level 8
Joined
Oct 6, 2022
Messages
185
i've approach it, i believe i won't be able to do such thing without any references(at least for me)... i believe you guys could make that but, that'll be another topic.

what should be talked about is this idea of Selection Function's content, and how it would make it work.
 
Last edited:
Level 12
Joined
Jul 5, 2014
Messages
551
i've approach it, i believe i won't be able to do such thing without any references(at least for me)... i believe you guys could make that but, that'll be another topic.

what should be talked about is this idea of Selection Function's content, and how it would make it work.
I mean, if you can keep a kill count for a player, you can definitely keep track on another player and just give points for his points. I've never used leaderboard though, so it's not my expertise.

I'm not sure preventing selection is viable. There maybe "you can select nobody" option but the first time I've seen playing around with selection was in StarCraft 2.

In the last undead campaign, you have Arthas channeling to take over obelisks. You can select him but you can't control or move him. Wouldn't something like that work for you?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
The Selection actions are slow and unreliable, pretty much unusable for this sort of thing.

What WarCortez is saying is that you have a Player variable that tracks a unit's "original owner". Here's a method using Unit Indexing, which makes things simple:
  • Events
    • Unit - A unit Enters playable map area
  • Conditions
  • Actions
    • -------- Track the original owner of this unit so we always know who it initially belonged to: --------
    • Set Variable Original_Owner[(Custom value of (Triggering unit))] = (Owner of (Triggering unit))
Now you simply reference this Player variable instead of (Owner of (Killing unit)) or (Owner of (Dying unit)) in your Multiboard triggers.
  • Events
    • Unit - A unit Dies
  • Conditions
    • ((Dying unit) is a Hero) Equal to True
  • Actions
    • -------- Get the original owners of these units: --------
    • Set Variable Dying_Player = Original_Owner[(Custom value of (Dying unit))]
    • Set Variable Killing_Player = Original_Owner[(Custom value of (Killing unit))]
    • -------- Get their player numbers: --------
    • Set Variable Dying_PN = (Player number of Dying_Player)
    • Set Variable Killing_PN = (Player number of Killing_Player)
    • -------- Increase the kill/death scores: --------
    • Set Variable Hero_Kills[Killing_PN] = (Hero_Kills[Killing_PN] + 1)
    • Set Variable Hero_Deaths[Dying_PN] = (Hero_Deaths[Dying_PN] + 1)
You're now properly tracking Hero Kills and Hero Deaths for each Player with regards to who the unit's TRULY belong to.

Also, at any point in time you can return the unit back to it's original owner:
  • Actions
    • Set Variable Some_Unit = any unit you want...
    • Unit - Change ownership of Some_Unit to Original_Owner[(Custom value of Some_Unit)] and Change color
It takes a little to get used to this design but I don't think it's that confusing. You're linking variables to your Units (using custom value) and linking variables to your Players (using player number).

That being said, there may be a better solution all together.
 
Last edited:
Top