For my mod, I'm trying to add a button for each of my six custom weapons to my unit's (Infantry) command card. The unit will have only one weapon available at a time, and I aim to set it up to allow the user to manually equip a weapon by pressing a button on the unit's command card. I would prefer to accomplish this without having to use any sort of inventory system.
After the weapons and their effects were all created, I added a behavior to enable the current weapon, disable all other weapons, and disable all other weapon behaviors. This didn't come close to accomplishing my goal. Instead, each time I clicked an "Equip X" button, the button disappeared, and the unit's status area on the HUD changed. It hid the weapon info, moved most other info, and added the current behavior name to a visible list that wasn't there before. And it didn't appear to disable other weapon behaviors, as each time I selected another weapon, it just added on to this strange list. And worst of all, it appeared that the unit had all weapons available at all times, prioritizing them based on attack range.
I'm still a n00b to the editor, so I don't know if my approach to adding this functionality was even remotely correct. Does you know how I might implement this weapon system? Any help is appreciated.
Well, if any help is appreciated...
You could make a dummy ability/button for the weapon switch. Then use triggers to remove weapon A and add weapon B whenever the button is pressed.
That will definitely do! It will be inconvenient to add the triggers to each map that uses this mod, but it's better than omitting the feature completely. I hope to implement it into the mod, but at the moment it doesn't look like there's a way to do so.
Ummm...
"the button disappeared, and the unit's status area on the HUD changed."
What type is your behavior? This sounds like an attribute to me, but it could also be that im supposed to be asleep at the moment... In any case, make sure your behaviors are of the type "buff" and have an infinite duration.
You can also try only adding weapons to the behaviors, and having no weapon in the "Combat - weapons +" field at your unit, and using validators and the likes to remove behaviors every time you switch weapon.
hope i helped and wasnt just babbling nonsense... off to sleep...
Have you looked at the raynor weapon switch behaviours for inspiration? Yes the raynor from the secret mission in the campaign was originally meant to switch weapons and parts of the system is still hidden in the data editor.
Rollback Post to RevisionRollBack
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
TheAlmaity suggested what I believe to be the best solution. I too had a problem with disabling a weapon that was already on the unit (i.e in the "combat" portion of the unit). Thus, I made a behavior for each weapon which enables a certain weapon when the behavior is equipped (Behaviors - Weapon tab).
Now, to disable the previous behavior (after you have pressed the button to equip a certain weapon), I am not entirely sure. Validators may work, but it will be interesting because your behaviors should never time out, and which validator would take precedent over the other may be tricky.
A quick thought was to have each of your buttons be an ability that activated a unique "Set" Effect. Under each Set effect, have 2 unique "Apply Behavior" Effects. One will be a dummy behavior that times out after 1 second. The other will be the actual apply behavior that activates your weapon. The dummy behavior would be to use in Validators. Say you had 3 different weapons. Well, you would have 3 different dummy behaviors and 3 different validators. Weapon 1 Behavior would have the validator that if Dummy Behavior 2 or Dummy Behavior 3 was on the unit, you would remove Weapon 1 Behavior. Weapon 2 Behavior would have the validator that if Dummy Behavior 1 or Dummy Behavior 3 was on the unit, you would remove Weapon 2 Behavior. And so on. This could be a more difficult way of doing it.
You might be able to make a validator that said "If effect Apply Behavior is cast at unit, return true" and use something like that. I'm not great with validators, but they are fairly simple to figure out if you know what you want.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
For my mod, I'm trying to add a button for each of my six custom weapons to my unit's (Infantry) command card. The unit will have only one weapon available at a time, and I aim to set it up to allow the user to manually equip a weapon by pressing a button on the unit's command card. I would prefer to accomplish this without having to use any sort of inventory system.
After the weapons and their effects were all created, I added a behavior to enable the current weapon, disable all other weapons, and disable all other weapon behaviors. This didn't come close to accomplishing my goal. Instead, each time I clicked an "Equip X" button, the button disappeared, and the unit's status area on the HUD changed. It hid the weapon info, moved most other info, and added the current behavior name to a visible list that wasn't there before. And it didn't appear to disable other weapon behaviors, as each time I selected another weapon, it just added on to this strange list. And worst of all, it appeared that the unit had all weapons available at all times, prioritizing them based on attack range.
I'm still a n00b to the editor, so I don't know if my approach to adding this functionality was even remotely correct. Does you know how I might implement this weapon system? Any help is appreciated.
Well, if any help is appreciated... You could make a dummy ability/button for the weapon switch. Then use triggers to remove weapon A and add weapon B whenever the button is pressed.
That will definitely do! It will be inconvenient to add the triggers to each map that uses this mod, but it's better than omitting the feature completely. I hope to implement it into the mod, but at the moment it doesn't look like there's a way to do so.
Ummm...
"the button disappeared, and the unit's status area on the HUD changed."
What type is your behavior? This sounds like an attribute to me, but it could also be that im supposed to be asleep at the moment... In any case, make sure your behaviors are of the type "buff" and have an infinite duration.
You can also try only adding weapons to the behaviors, and having no weapon in the "Combat - weapons +" field at your unit, and using validators and the likes to remove behaviors every time you switch weapon.
hope i helped and wasnt just babbling nonsense... off to sleep...
Have you looked at the raynor weapon switch behaviours for inspiration? Yes the raynor from the secret mission in the campaign was originally meant to switch weapons and parts of the system is still hidden in the data editor.
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
TheAlmaity suggested what I believe to be the best solution. I too had a problem with disabling a weapon that was already on the unit (i.e in the "combat" portion of the unit). Thus, I made a behavior for each weapon which enables a certain weapon when the behavior is equipped (Behaviors - Weapon tab).
Now, to disable the previous behavior (after you have pressed the button to equip a certain weapon), I am not entirely sure. Validators may work, but it will be interesting because your behaviors should never time out, and which validator would take precedent over the other may be tricky.
A quick thought was to have each of your buttons be an ability that activated a unique "Set" Effect. Under each Set effect, have 2 unique "Apply Behavior" Effects. One will be a dummy behavior that times out after 1 second. The other will be the actual apply behavior that activates your weapon. The dummy behavior would be to use in Validators. Say you had 3 different weapons. Well, you would have 3 different dummy behaviors and 3 different validators. Weapon 1 Behavior would have the validator that if Dummy Behavior 2 or Dummy Behavior 3 was on the unit, you would remove Weapon 1 Behavior. Weapon 2 Behavior would have the validator that if Dummy Behavior 1 or Dummy Behavior 3 was on the unit, you would remove Weapon 2 Behavior. And so on. This could be a more difficult way of doing it.
You might be able to make a validator that said "If effect Apply Behavior is cast at unit, return true" and use something like that. I'm not great with validators, but they are fairly simple to figure out if you know what you want.