As the title states, how do you make an upgrade change the weapon type used by a unit. I've found ways to modify the weapon(although I don't seem to be able to modify everything)
I still can't find a way to do this. Basically, what I need is an upgrade that will make the banshee shoot while moving and another upgrade that gives the High templar an attack and lots of other upgrades. In the upgrade effects menu I can't change all the fields I want, I can't change the weapon used by a unit.
I've tried to do similar things and meet with little success, I think one possible strategy is to add all weapons you wish the unit to use under the units combat list. The Weapon will be disabled by default (a flag on the weapon), and then have the upgrade enable the weapon in some way (not sure exactly how to do that) as well as show the weapon in the units data panel (I know this is done on some campaign upgrades).
I've solved it, give the weapon to the unit and make the weapon default hidden, make a behavior that suppresses the weapon (like the Ghosts hold fire) and give it to the unit. Make a requirement 'Weapon Suppress' which has NOT logic with regard to the upgrade, then Create a validator linking to the requirement. Put this Validator in the 'Remove Validator' section of the Behavior, this causes the Behavior to be permanently removed when the validator returns false which occurs when the research is completed, allowing the weapon to be used. The upgrade itself can remove the hidden flag from the Weapon making it appear in the units weapon list.
Reversing the process should be able to remove a Weapon by hiding and disabling it.
That sounds like an awful overkill, but I'll try it out. Thanks.
I thought I found a better/easier way to do it. I added both weapons(the one the unit has at the start and the one it changes to after the upgrade finishes)
I made the upgraded weapon have the option "disabled" and "hidden". I then made the upgrade hide and disable the first weapon and show and enable the upgraded weapon. This seemed like a good way to do it but unfortunately I can't get the disable/enable to work through upgrades. There's a field for it but it doesn't seem to work.
I go into the upgrade's effects and add a new effect. I chose the type Weapon and choose the upgraded weapon.
In the fields, I pick "Options [Option=Disabled]: Enabled" I choose the operation "Set" and I don't have the Enabled box checked.
I thought this would disable the disabled field, however it doesn't work. I tried changing it to enable instead to no avail. I tried changing the operation to add or subtract but it doesn't seem to work either.
Create your units with NO weapons. None. Zero. Nada.
Now, create the default weapon that you would like the unit to have. Then create a behavior with infinite duration. Go to the "Weapons tab" and have the behavior add the weapon to the unit when it is active. Now, go to the unit and give the unit the behavior. Let's call this behavior Weapon 1.
That may seem like overkill, but I'll explain why this is necessary for a good, modular solution.
So, step 2, you're going to repeat the above process for the other weapon that you would like the unit to be able to use. The catch is that with the second behavior, you also go into the behaviors tab and include disable Weapon 1.
Alright, so that gives you your two behaviors. Now if you want this to be an upgrade, what you do is create a Requirement which is basically "Weapon 2 is Completed Or Better."
With that, you give the 2nd behavior to your unit as well. What will happen here is that the unit will have the standard weapon, and then when the upgrade comes through, the Weapon 2 behavior will become active, enabling the new weapon and disabling behavior 1.
The reason for doing this is that it's clean - the UI updates instantly and there is no lag in updating the weapon box. Also, a modular system such as this one allows you to do much more than change weapon on upgrade. I have created units which can swap between weapons in the field through abilities. And not just between two weapons, but as many as you'd like.
To do that, you'll need some validators and some Ability - Behaviors. Or, you'll need some Effect - Apply Behaviors and some Ability - Instant Effects (depending on if you want a cast time, etc...the former is easier if you do not care)
Aaanyways, I've rambled for a bit, but I hope this helps you. :)
For some weird reason doing it this way messes up my weapon. I'm trying to make the upgrade give my banshees the ability to shoot while moving. If I only give the banshee the second weapon(with turret) it works okay(it still doesn't turn against the target like the phoenix but that's not necessary) but if I add the behaviors and remove the weapon it doesn't work properly.
Basically, when I research the upgrade the UI around the weapon flashes quickly(no problem, just an observation) but the second weapon doesn't work properly. It doesn't attack targets if I don't tell it to. If I tell it to attack it goes very close to the unit before attacking and it also prints "Error" in red letters(This does not show up in the trigger debugging window though)
If I tell the banshee to attack a target and then move away, it seems to work so even if it goes close to shoot, I'm able to shoot at range 6(default)
I'm not entirely sure what to tell you; I use the method as above and it works perfectly. The weapon box shouldn't flash if you are just doing a behavior swap.
Also, if you assign the weapon to a turret, then yes, the banshee will not turn to face the enemy - it must be a standard weapon. I think part of what is going on here is that the weapons you are creating do not have default options - compare it to the regular banshee weapon (or hell, just copy it twice, then change the upgraded version to allow fire while moving).
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
As the title states, how do you make an upgrade change the weapon type used by a unit. I've found ways to modify the weapon(although I don't seem to be able to modify everything)
@Siretu: Go
Upgrades effect all units of a specific type from my understanding ....
What you could do is create a behaviors that change what your weapons actually do.
Weapons are just effects anyways.
So you could make a behavior for all your weapons and do it that way.
This would require a Dummy weapon that does no damage but just sets off the Combat . The behaviors would handle the rest o
@Yaos01: Go
upgrades generally effect all units of a specific type.
I'm sorry if I was unclear. I meant a unit type. Not a specific unit.
I still can't find a way to do this. Basically, what I need is an upgrade that will make the banshee shoot while moving and another upgrade that gives the High templar an attack and lots of other upgrades. In the upgrade effects menu I can't change all the fields I want, I can't change the weapon used by a unit.
I've tried to do similar things and meet with little success, I think one possible strategy is to add all weapons you wish the unit to use under the units combat list. The Weapon will be disabled by default (a flag on the weapon), and then have the upgrade enable the weapon in some way (not sure exactly how to do that) as well as show the weapon in the units data panel (I know this is done on some campaign upgrades).
I've solved it, give the weapon to the unit and make the weapon default hidden, make a behavior that suppresses the weapon (like the Ghosts hold fire) and give it to the unit. Make a requirement 'Weapon Suppress' which has NOT logic with regard to the upgrade, then Create a validator linking to the requirement. Put this Validator in the 'Remove Validator' section of the Behavior, this causes the Behavior to be permanently removed when the validator returns false which occurs when the research is completed, allowing the weapon to be used. The upgrade itself can remove the hidden flag from the Weapon making it appear in the units weapon list.
Reversing the process should be able to remove a Weapon by hiding and disabling it.
That sounds like an awful overkill, but I'll try it out. Thanks.
I thought I found a better/easier way to do it. I added both weapons(the one the unit has at the start and the one it changes to after the upgrade finishes)
I made the upgraded weapon have the option "disabled" and "hidden". I then made the upgrade hide and disable the first weapon and show and enable the upgraded weapon. This seemed like a good way to do it but unfortunately I can't get the disable/enable to work through upgrades. There's a field for it but it doesn't seem to work.
I go into the upgrade's effects and add a new effect. I chose the type Weapon and choose the upgraded weapon. In the fields, I pick "Options [Option=Disabled]: Enabled" I choose the operation "Set" and I don't have the Enabled box checked.
I thought this would disable the disabled field, however it doesn't work. I tried changing it to enable instead to no avail. I tried changing the operation to add or subtract but it doesn't seem to work either.
Okay, here's how to do this one.
Create your units with NO weapons. None. Zero. Nada.
Now, create the default weapon that you would like the unit to have. Then create a behavior with infinite duration. Go to the "Weapons tab" and have the behavior add the weapon to the unit when it is active. Now, go to the unit and give the unit the behavior. Let's call this behavior Weapon 1.
That may seem like overkill, but I'll explain why this is necessary for a good, modular solution.
So, step 2, you're going to repeat the above process for the other weapon that you would like the unit to be able to use. The catch is that with the second behavior, you also go into the behaviors tab and include disable Weapon 1.
Alright, so that gives you your two behaviors. Now if you want this to be an upgrade, what you do is create a Requirement which is basically "Weapon 2 is Completed Or Better."
With that, you give the 2nd behavior to your unit as well. What will happen here is that the unit will have the standard weapon, and then when the upgrade comes through, the Weapon 2 behavior will become active, enabling the new weapon and disabling behavior 1.
The reason for doing this is that it's clean - the UI updates instantly and there is no lag in updating the weapon box. Also, a modular system such as this one allows you to do much more than change weapon on upgrade. I have created units which can swap between weapons in the field through abilities. And not just between two weapons, but as many as you'd like.
To do that, you'll need some validators and some Ability - Behaviors. Or, you'll need some Effect - Apply Behaviors and some Ability - Instant Effects (depending on if you want a cast time, etc...the former is easier if you do not care)
Aaanyways, I've rambled for a bit, but I hope this helps you. :)
Thank you for the good explanation. I'll check it out soon.
Edit: How do I make the behavior have an infinite duration? Right now, it's of the "attribute" type and I set the behavior - categories to permanent.
I just tried step 1 to start with, just to see if the banshee was able to shoot, but it can't.
The duration is infinite by default, if the duration field is set to "0." Also, sorry, I forgot to mention - you want it to be a "Buff"
For some weird reason doing it this way messes up my weapon. I'm trying to make the upgrade give my banshees the ability to shoot while moving. If I only give the banshee the second weapon(with turret) it works okay(it still doesn't turn against the target like the phoenix but that's not necessary) but if I add the behaviors and remove the weapon it doesn't work properly.
Basically, when I research the upgrade the UI around the weapon flashes quickly(no problem, just an observation) but the second weapon doesn't work properly. It doesn't attack targets if I don't tell it to. If I tell it to attack it goes very close to the unit before attacking and it also prints "Error" in red letters(This does not show up in the trigger debugging window though)
If I tell the banshee to attack a target and then move away, it seems to work so even if it goes close to shoot, I'm able to shoot at range 6(default)
I'm not entirely sure what to tell you; I use the method as above and it works perfectly. The weapon box shouldn't flash if you are just doing a behavior swap.
Also, if you assign the weapon to a turret, then yes, the banshee will not turn to face the enemy - it must be a standard weapon. I think part of what is going on here is that the weapons you are creating do not have default options - compare it to the regular banshee weapon (or hell, just copy it twice, then change the upgraded version to allow fire while moving).