Just want to check out on creating a Function where when a Unit from Unit Group dies, the said Function will reset Units in the said Unit Group. Just to paint the picture:-
Say for example,
Set Variable - Strike Platform(1) == Unit 1 from Unit Group (Strike Platform Group)
- Strike Platform(2) == Unit 2 from Strike Platform Group
- Strike Platform(3) == Unit 3 from Strike Platform Group, and so on.
The Issue here being when Unit dies or being removed, say, Unit 1 from Strike Platform Group. Unit 2 from Strike Platform Group will then be indexed as Unit 1 from Unit Group, Unit 3 will then become Unit 2 from Unit Group, and so on. The Unit Indexing is such a way that the first unit created in unit group will be Unit 1 from Unit Group, the second unit as Unit 2 from Unit Group and so on.
The Logic here being if Unit 1 from Unit Group dies,
Then, Strike Platform(2) == Unit (2 - 1) from Strike Platform Group
Strike Platform(3) == Unit (3 - 1) from Strike Platform Group
Strike Platform(10) == Unit (10-1) from Strike Platform Group
Say that a Variable - (Index) represents each Integer for Strike Platform,
Hence,
For Each Integer (Index) from 1 to 10 with Increment 1,
Set Strike Platform(Index) == Unit (Index-1) from Strike Platform Group
The issue/problem arises when say, Unit 4 from Unit Group dies,
Then, Strike Platform(1) == Unit 1 from Strike Platform Group, not Unit (1 - 1) from Strike Platform Group
Strike Platform(2) == Unit 2 from Strike Platform Group, not Unit (2 - 1) from Strike Platform Group
Strike Platform(3) == Unit 3 from Strike Platform Group, not Unit (3 - 1) from Strike Platform Group
How do I then create the function then?
Or do I state a condition which states Unit Is Alive != Unit 1 from Unit Group,
Then, it will be a very long list of Function till -> Unit Is Alive != Unit 10 from Unit Group.
I probably need someone who is well-versed with Functions to clarify this. Thanks.
What are you trying to use this function for? If you want a unit to have a specific value then would not using an unit variable array be better?
Thanks for the reply. I'am trying to mark the first unit created, second unit created, and so on for HH-Strike Fighter Platform. Is there any other way to mark the unit in order/sequence it was created (first unit, second unit, etc.) other than the function - Unit from Unit Group?
The Unit from Unit Group function perform exactly the sequence/order when the unit was created in a group in the form of Index. However, when a unit from the unit group dies, the Unit - Index will be replaced by subsequent Index, say - Unit 4 from Unit Group dies, Unit 4 will then be replaced by Unit 5, Unit 5 from Unit Group will be replaced by Unit 6, and so on in a subsequent order. In other words, I need to resetthe Units in the group back to sequence/order they were created when a unit in the said group dies.
Yea, I'm not sure what you're using this for either...
a Function where when a Unit from Unit Group dies
You can use the condition "Unit in unit group" for this. If using the unit dies event, the condition will look like this
((Triggering unit) is in Strike platform group) == True
Thanks for the reply. Just wondering if there is an Event - Unit From Unit Group Dies. Then I might just state a condition - Unit 1 from Unit Group == (Triggering Unit). This will then eliminate the need for a function or action definition.
EDIT : Never mind then, I can still use the Event - Any Unit dies, and state the condition - (Triggering Unit) == Unit 1 from Unit Group.
I would just use a Unit variable array. Have on unit creation a Set Variable action to set the array for the integer to the last crated unit and than add +1 to the local integer variable used for the index of the unit variable.
I would just use a Unit variable array. Have on unit creation a Set Variable action to set the array for the integer to the last crated unit and than add +1 to the local integer variable used for the index of the unit variable.
Thanks for the feedback. However, the function - last created unit can only mark units created through triggers. The units mentioned - HH-Strike Fighter Platform are created through ability data - HH-SCV Build. I figured out that either I mark the sequence of units created through setting up a variable array which marks the Effect History count of the Unit Effect or a variable array which marks the units from unit group. Either way.
At the same time, are you aware of any tutorials that will guide us on how to use the Effect - History Entry/Count via triggers? Thanks again.
This ability create the units directly, but however, I want to integrate them with triggers to create Strike Fighters on top of the Strike Platforms. Hence, I need to mark each Strike Platforms by firstly adding them to a unit group, then using variable arrays to mark each units from the group.
I have been thinking about some Unit Indexing library as well but I think it might not be required as there are only 10 units limit to the arrays. Thanks.
Edit : [Solved]. Don't actually require special functions to modify count each time the Strike Fighter Platform or Bomber Unit dies.
I solved it by using a pseudo-code. The following:-
1. Create a dummy effect when the Platform (Specific Unit) dies. Then under Unit:Effect-Death of the Platform, link this dummy effect to it. So, the function Triggering Effect Unit (Caster) will refer to the unit caster (hereby the Platform).
2. Create a condition if-then-else for the dummy effect. Here, you put in a pseudo-condition, that is Distance between points (The point for position of (Triggering Effect Unit(Caster)) and position of Closest Unit at Point (Closest Unit for position of (Triggering Effect Unit(Caster)) in Bomber Unit group) < 1.0 Why distance between position of units <1.0 is because the offset point for X = +0.26 and the offset point for Y = -0.26 (X of Point and Y of Point for the created Bomber Unit on top of the Platform Unit). Therefore, the distance measured by the square root of 0.26^2 + 0.26^2 = 0.3677 (Which is less than 1.0). Also, note that the Z of point is not taken into account for the measured distance.
3. Hence, create a local/global variable and set the variable to Closest Unit at Point (Closest Unit for position of (Triggering Effect Unit(Caster)) in Bomber Unit group). This will then reference the closest unit in the Bomber Unit Group to the specific Platform Unit with distance in between them of less than 1.0.
4. Continue with the trigger actions whether you want to kill the Bomber Unit (Unit Variable set in Point 3) when the specific Platform Unit dies. You can also order the Bomber Unit to Precision-Strike a target by creating a dummy effect for the said ability and creating an Issue Order action for the said Bomber Unit.
Thanks. Cheers.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hi guys,
Just want to check out on creating a Function where when a Unit from Unit Group dies, the said Function will reset Units in the said Unit Group. Just to paint the picture:-
Say for example,
Set Variable - Strike Platform(1) == Unit 1 from Unit Group (Strike Platform Group)
- Strike Platform(2) == Unit 2 from Strike Platform Group
- Strike Platform(3) == Unit 3 from Strike Platform Group, and so on.
The Issue here being when Unit dies or being removed, say, Unit 1 from Strike Platform Group. Unit 2 from Strike Platform Group will then be indexed as Unit 1 from Unit Group, Unit 3 will then become Unit 2 from Unit Group, and so on. The Unit Indexing is such a way that the first unit created in unit group will be Unit 1 from Unit Group, the second unit as Unit 2 from Unit Group and so on.
The Logic here being if Unit 1 from Unit Group dies,
Then, Strike Platform(2) == Unit (2 - 1) from Strike Platform Group
Strike Platform(3) == Unit (3 - 1) from Strike Platform Group
Strike Platform(10) == Unit (10-1) from Strike Platform Group
Say that a Variable - (Index) represents each Integer for Strike Platform,
Hence,
For Each Integer (Index) from 1 to 10 with Increment 1,
Set Strike Platform(Index) == Unit (Index-1) from Strike Platform Group
The issue/problem arises when say, Unit 4 from Unit Group dies,
Then, Strike Platform(1) == Unit 1 from Strike Platform Group, not Unit (1 - 1) from Strike Platform Group
Strike Platform(2) == Unit 2 from Strike Platform Group, not Unit (2 - 1) from Strike Platform Group
Strike Platform(3) == Unit 3 from Strike Platform Group, not Unit (3 - 1) from Strike Platform Group
How do I then create the function then?
Or do I state a condition which states Unit Is Alive != Unit 1 from Unit Group,
Then, it will be a very long list of Function till -> Unit Is Alive != Unit 10 from Unit Group.
I probably need someone who is well-versed with Functions to clarify this. Thanks.
What are you trying to use this function for? If you want a unit to have a specific value then would not using an unit variable array be better?
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
Yea, I'm not sure what you're using this for either...
You can use the condition "Unit in unit group" for this. If using the unit dies event, the condition will look like this
I would just use a Unit variable array. Have on unit creation a Set Variable action to set the array for the integer to the last crated unit and than add +1 to the local integer variable used for the index of the unit variable.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
This ability create the units directly or use a create unit effect?
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
In reply to DrSuperEvil:
This ability create the units directly, but however, I want to integrate them with triggers to create Strike Fighters on top of the Strike Platforms. Hence, I need to mark each Strike Platforms by firstly adding them to a unit group, then using variable arrays to mark each units from the group.
I have been thinking about some Unit Indexing library as well but I think it might not be required as there are only 10 units limit to the arrays. Thanks.
Edit : [Solved]. Don't actually require special functions to modify count each time the Strike Fighter Platform or Bomber Unit dies.
I solved it by using a pseudo-code. The following:-
1. Create a dummy effect when the Platform (Specific Unit) dies. Then under Unit:Effect-Death of the Platform, link this dummy effect to it. So, the function Triggering Effect Unit (Caster) will refer to the unit caster (hereby the Platform).
2. Create a condition if-then-else for the dummy effect. Here, you put in a pseudo-condition, that is Distance between points (The point for position of (Triggering Effect Unit(Caster)) and position of Closest Unit at Point (Closest Unit for position of (Triggering Effect Unit(Caster)) in Bomber Unit group) < 1.0 Why distance between position of units <1.0 is because the offset point for X = +0.26 and the offset point for Y = -0.26 (X of Point and Y of Point for the created Bomber Unit on top of the Platform Unit). Therefore, the distance measured by the square root of 0.26^2 + 0.26^2 = 0.3677 (Which is less than 1.0). Also, note that the Z of point is not taken into account for the measured distance.
3. Hence, create a local/global variable and set the variable to Closest Unit at Point (Closest Unit for position of (Triggering Effect Unit(Caster)) in Bomber Unit group). This will then reference the closest unit in the Bomber Unit Group to the specific Platform Unit with distance in between them of less than 1.0.
4. Continue with the trigger actions whether you want to kill the Bomber Unit (Unit Variable set in Point 3) when the specific Platform Unit dies. You can also order the Bomber Unit to Precision-Strike a target by creating a dummy effect for the said ability and creating an Issue Order action for the said Bomber Unit.
Thanks. Cheers.