So... Let's say I have a unit to which I will add a behavior. I want to add a requirement to this behavior so it will only be active if that requirement is met.
But I want this requirement to be met only if I activate it using a trigger.
How can I do this ?
Why am I trying to do this: On my map there are 15 standard units that can be built. There are 21 nations that can be chosen and I want to add 6 special units for each nation , that will mean I would have to create 126 new units. That will be too much work ..
So I thought an easier way is to create a bunch of behaviors and add them to the units I want, and I will only enable the ones I want for each nation using triggers.
If there is another way to accomplish what I want, let me know .
Well, if you use triggers anyway, I would recommend to just apply the behavior via trigger, there is an action to do that. If you want to use a requirement, you can have that requirement check for another behavior, which you would then add via trigger (which would be slightly silly), or, if you want it to affect all units of the same type and player at once, you can research an upgrade and check that in a requirement (would make slightly more sense, but still you could just apply the behavior to all units of the player).
Also note, that you cannot modify all the values of units via behaviors, if you want the new units use their own models/sounds/portraits/wireframes etc etc, you are better off just creating those 126 units. It will probably take some time, but the end result might be a lot better.
That depends on your setup and the conditions that need to be fulfilled for the behaviors to apply, but the general structure could look like this
Event: Unit - Any Unit creates a unit
Action :
If (Unit type of created unit = SpecialUnit1) then Add 1 SpecialBehavior to created unit
If (Unit type of created unit = SpecialUnit2) ....
(or I believe there is even a Switch statement in Gui you could make use of)
Note to use Created Unit (refers to the unit, which triggers the create event), not Last Created Unit (refers to the last unit in this thread created via trigger).
So... Let's say I have a unit to which I will add a behavior. I want to add a requirement to this behavior so it will only be active if that requirement is met.
But I want this requirement to be met only if I activate it using a trigger.
How can I do this ?
Why am I trying to do this: On my map there are 15 standard units that can be built. There are 21 nations that can be chosen and I want to add 6 special units for each nation , that will mean I would have to create 126 new units. That will be too much work ..
So I thought an easier way is to create a bunch of behaviors and add them to the units I want, and I will only enable the ones I want for each nation using triggers.
If there is another way to accomplish what I want, let me know .
Well, if you use triggers anyway, I would recommend to just apply the behavior via trigger, there is an action to do that. If you want to use a requirement, you can have that requirement check for another behavior, which you would then add via trigger (which would be slightly silly), or, if you want it to affect all units of the same type and player at once, you can research an upgrade and check that in a requirement (would make slightly more sense, but still you could just apply the behavior to all units of the player).
Also note, that you cannot modify all the values of units via behaviors, if you want the new units use their own models/sounds/portraits/wireframes etc etc, you are better off just creating those 126 units. It will probably take some time, but the end result might be a lot better.
How exactly should the trigger look like ? I want it to apply this behavior to units that will be produced at a building by that nation .
That depends on your setup and the conditions that need to be fulfilled for the behaviors to apply, but the general structure could look like this
Event: Unit - Any Unit creates a unit
Action :
If (Unit type of created unit = SpecialUnit1) then Add 1 SpecialBehavior to created unit
If (Unit type of created unit = SpecialUnit2) ....
(or I believe there is even a Switch statement in Gui you could make use of)
Note to use Created Unit (refers to the unit, which triggers the create event), not Last Created Unit (refers to the last unit in this thread created via trigger).
Yey, I made it work. Thank you for your help !