• 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.

[Solved] Compatibility and 1.31 natives

Status
Not open for further replies.
Level 14
Joined
Jan 10, 2023
Messages
248
Hello all, I had asked some related questions and got a lot of good answer's from @Uncle, and I would continue to message you Uncle, but I feel like maybe I shouldn't blow up your inbox just because you're nice lol (just saying that so you understand why I'm asking this now, Uncle).

My question is two-fold:
  1. Am I right to shun most Blz natives because they won't be compatible in older versions?
  2. Do we have an up-to-date thread that gives instruction on compatibility requirements for systems?
To give a bit of context, I am trying to cancel a channel-based ability's channel. A system I am working on uses 'Disables Other Abilities' and a very high follow through time, because the ability can vary in duration and I don't want other abilities to be usable while it is going, but naturally Pausing the unit would have some issues with buffs/effects, and I would rather avoid it because it seems like it's a step too far to pause the unit anyway, mostly because I want the unit to feel like it is still interacting with other units while the ability is firing, and pausing the unit makes it too different from a standard ability for my liking (and I want it to feel natural).

What I did works fine to stop the ability once it has finished it's effect, even if I give an obnoxiously high follow through time like 100.00.
This is what I am doing to end the ability's effect:
JASS:
            call PauseUnit( u, true )
            call UnitRemoveAbility( u, abilcode )
            call PauseUnit( u, false )
            if UnitAddAbility( u, abilcode ) then
                call SetUnitAbilityLevel( u, abilcode, abilLevel )
            endif
I'm guessing there are other ways to do this, and maybe the order of actions here doesn't matter, but the idea was:
  1. Pause the unit.
  2. Remove the Ability so that when I unpause the order is given but the unit doesn't have the ability.
  3. Unpause the unit, it tries it's previous order, but doesn't have the ability.
  4. It get's it's ability back and gets it's level set (I know I didn't have to use an if/then, I just like that practice, but maybe it's not a good idea/ maybe it's slower than just not checking if the added ability was successful)
Yes, these input variables are correctly set, I know that is no always easy to just take someone's word for, but I merely showed this snippet to reference what I am doing, and didn't want to muddy the water with a bunch of code.
I was super excited when this worked, I'm not surprised if this is old news, but it worked great for ending the effect, but it does not help to end the channeling.
It does work to cancel/stop casting and seemingly every spell event except channel.

I could simply reimburse the unit's mana, but I grew attached to this concept working at the channeling step in hopes to prevent the mana from being spent in the first place, and also to allow for a Map Editor to set a channeling-time if they so choose.

I know there are other options, but I am concerned that I don't know what are good practices for compatibility, and a lot of the threads I find when I search ended back in 2016 and sometimes (such as with @IcemanBo's suspendunit system) everything looks like it would work great, and then I get to the bottom of the thread and there was some bug that ended the whole effort.

Anyway, in particular I am curious if compatibility is a requirement, a nice thing to do, or simply a matter of preference, because I am sure I can find many ways of getting it done if I assume we are all using the most up-to-date wc3, but my intention is just to make systems to enable makers to make cool stuff and I like to think we would all use the current version, and I don't really want to study ancient wc3 history to do that, but I guess if it's the only way I will...

I know this topic is kind of two-in-one, but to make it simple what I am asking:
  1. The two questions at the top.
  2. The snippet I shared (is it a decent way to end a follow through)
  3. The following question about the best way to stop-short a channel-based spell's channeling.
 
I embrace 1.31 natives. They enable so many cool things that are impossible on prior versions. I primarily use 1.31, but have a latest release too.
I think that the "requirements" is hard, as many systems for release works for 1.31 but are usually saved with a later version. I don't think such a list exists.

Wouldn't a stop order work to stop the follow though time? The unit is standing still, so should be fine to issue an order. Might mess with queued orders of course, but honestly, I wouldn't care.
I believe that there is a different between canceling casting and canceling channel, but I'm not sure.
Does your snipplet cancel cannels such as blizzard or starfall?
 
Level 24
Joined
Jun 26, 2020
Messages
1,928
Fun fact, if you cast Silence on a unit when is channeling even if the "Disables Other Abilities" option is enabled, it stops the casting, so you could create a dummy silence that has 1. atea of effect and 0.01 duration and remove the effects and order a dummy caster to cast silence in it.
I know that its not very elegant and maybe a it would affect to any flying unit that overlaps the target and it prevents you from making the target magic inmune, but I just wanted to say it.
 
Level 14
Joined
Jan 10, 2023
Messages
248
@HerlySQR
A part of me really wants to use the silence ability, I am going to see what I can do with it at some point, for now I might just see how I feel about canceling it at cast, or just letting it go to finish effect and then end it there since both will require a mana reimbursement and the ability removal/add works fine at all times except for channel so really the mana thing is the only problem I'm having.
I also found this which is way over my head as far as what is being done in that code, but it seems to support everything you say.

The only reason I have left to hold off that I can think of is that I am jealous of that 0.01 seconds... lol
Seriously though, if I can avoid that I would like to, but it would be a very small price to pay if I wanted something more compatible. Then I could use something that takes advantage of the new natives for my more capable version.

As far as the dummy and the flying points go, I wonder:
  1. Could you avoid using a dummy if you set the abilities 'targets allowed' field to only target self, and then just give the ability to silence ability to the casting unit? And on that note I wonder how the game would handle a silence being silenced mid-silence... or maybe it's no big deal and only fun to say... I don't know much about this really
  2. Couldn't we just avoid the flyer by the same method? just set the targets to ground for the silence ability you use


@ThompZon
I tested a few different snippets and also checked out blizzard and starfall.
I didn't have any luck with those two, but I did read this and it had me thinking the same thing. I'm surprised no other abilities had the effect I was looking for. I just didn't want to bother with the overhead of a pause-system and thought I had found a neat way to deal with it.

However, it wasn't all bad news. I learned a bit:
JASS:
// This doesn't work
call PauseUnit( unit, true )
call IssueImmediateOrderById( unit, 851972 )
call PauseUnit( unit, false )

// This doesn't work
call IssueImmediateOrderById( unit, 851972 )

// This doesn't work
call PauseUnit( unit, true )
call PauseUnit( unit, false )
call IssueImmediateOrderById( unit, 851972 )

// This seems to be all that matters:
// (but it still doesn't seem to work at channel event)
call UnitRemoveAbility( unit, abilcode )
call UnitAddAbility( unit, abilcode )
call SetUnitAbilityLevel( unit, abilcode, abilLevel )

// But I decided to shape it like this:
if UnitRemoveAbility( unit, abilcode ) then
    if UnitAddAbility( unit, abilcode ) then
        call SetUnitAbilityLevel( unit, abilcode, abilLevel )
    endif
endif

// Or what do you think of:
if UnitRemoveAbility( unit, abilcode ) and UnitAddAbility( unit, abilcode ) then
    call SetUnitAbilityLevel( unit, abilcode, abilLevel )
endif
So the PauseUnit call was totally unnecessary... oops lol


It would work just fine if I cancel it at cast, I just have to give the mana back and I can just have the ability have a default cooldown of 0.00 because the trigger handles all of that anyway. Plus, if I am going to use the Blz natives (which I agree with you on that they are worth using) I have to for the cooldown to work like I want it to anyway. I wanted it to have the functionality to increase/ decrease depending on a few factors, and that can only come with the 1.31 natives as far as I'm aware.

Thank you both for you're suggestions! I'm going to mark this solved and this actually worked out great for me because I realized my code was doing extra stuff that I didn't need to and I haven't tested it yet but since I'm not giving any orders and I'm not moving I think the order queue might even survive it all.
 
Last edited:
Level 24
Joined
Jun 26, 2020
Messages
1,928
@Tristronic If you are worring about the unit having the debuff for 0.01 seconds, while I was testing the debuff didn't appear in the status bar, the effects appear but you can remove them, thinking well, Soul Burn could be better since also silence and is single target, but the buff actually appears in the status bar, just saying.
 
Last edited:
Status
Not open for further replies.
Top