• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Is this MUI?

Status
Not open for further replies.
Hey there! I need some help here in checking if this Blink I made is MUI.
It's supposed to make you invisible and slow after you cast it.
You need a 0.05 second wait (Or something like that) because if you do it immediately, you will interrupt the Blink and you will just cast the Wind Walk right there on the spot; and not Blink to the target area.

  • Blink 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Ability being cast) Equal to Blink (1, 1 Position)) or ((Ability being cast) Equal to Blink (1, 2 Position))
    • Actions
      • Set BlinkCaster = (Casting unit)
      • Set BlinkInteger = (BlinkInteger + 1)
      • Set BlinkAbility[BlinkInteger] = (Ability being cast)
      • Unit - Set the custom value of BlinkCaster to BlinkInteger
      • Unit Group - Add BlinkCaster to BlinkGroup
      • Hashtable - Save 0.05 as (Key RemainingTime) of (Key (Casting unit)) in Hashtable
      • Set BlinkIsOn = True
  • Blink 2
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in BlinkGroup and do (Actions)
        • Loop - Actions
          • Set BlinkRemainingTime = (Load (Key RemainingTime) of (Key (Picked unit)) from Hashtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • BlinkRemainingTime Greater than 0.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • BlinkAbility[(Custom value of (Picked unit))] Equal to Blink (1, 1 Position)
                • Then - Actions
                  • Unit - Add Blink Invisibility to (Picked unit)
                  • Unit - Set level of Blink Invisibility for (Picked unit) to (Level of Blink (1, 1 Position) for (Picked unit))
                  • Unit - Order (Picked unit) to Orc Blademaster - Wind Walk
                  • Unit - Remove Blink Invisibility from (Picked unit)
                  • Hashtable - Save (BlinkRemainingTime - 0.05) as (Key RemainingTime) of (Key (Picked unit)) in Hashtable
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • BlinkAbility[(Custom value of (Picked unit))] Equal to Blink (1, 2 Position)
                    • Then - Actions
                      • Unit - Add Blink Invisibility to (Picked unit)
                      • Unit - Set level of Blink Invisibility for (Picked unit) to (Level of Blink (1, 2 Position) for (Picked unit))
                      • Unit - Order (Picked unit) to Orc Blademaster - Wind Walk
                      • Unit - Remove Blink Invisibility from (Picked unit)
                      • Hashtable - Save (BlinkRemainingTime - 0.05) as (Key RemainingTime) of (Key (Picked unit)) in Hashtable
                    • Else - Actions
            • Else - Actions
              • Unit Group - Remove (Picked unit) from BlinkGroup
              • Set BlinkIsOn = False
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
why dont you use random integer between 1, 2 and save it to hashtable instead of "Set BlinkInteger = (BlinkInteger + 1)" and custom values?...HT is more reliable than custom values...
also you can save the level in the casting time, not during the loop...
I think this is MUI but I dont see the purpose of this >>> Set BlinkIsOn = True
 
Level 4
Joined
Jun 23, 2011
Messages
70
If you want to check for MUI, make about 20 of the units and trigger them to cast this repeatedly on a random location. If you need help writing that, I'll post an example.

You should learn vJass. The things you're doing here can be done so much more efficient.
Yes, but not everyone can understand vJass, or is willing to take the time to learn (some people don't spend enough time writing triggers to justify the time required spent learning the language, so it's actually more efficient for them to write in GUI).
 
Why don't you just create a dummy unit to cast Invisibility on the caster? Makes life easier.

Edit:
- You could also give it a Berserk ability with negative movespeed bonus.
- Give Berserk to caster when it finishes blinking.
- Order caster to use Berserk.
- When caster casts Berserk, remove the ability from the caster.
- Then, create dummy to cast Invisibility.
- Add expiration timer to dummy unit.

End of story.
 
Using Berserk and Invisibility would've made the trigger even more complicated, you see?
If I just used Wind Walk, I could've just given the unit a negative movespeed bonus and no backstab damage.
And that's what I did.

If I made it instant, then the effects would take place before the caster even blinks.
Try it yourself, that's why I had to make a short wait.
 
Level 13
Joined
Mar 16, 2008
Messages
941
You can do nearly everything with GUI what can be done with vJass and not even much more complicated. Most times the only "problem" is the freaking amount of arrays you have to click through. The only limitations are missing functions that don't exist in GUI but none of them are important. For sure people that use GUI and like it defend their "language".
The script is okay imo with 2 problems:
1) Dont use the custom value for a single spell.
2) 0.01 is way to fast. Something between 0.02 and 0.04 is enough and more performant. Why are you using -0.05 with a 0.01 timer?
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
But vJASS is much easier than GUI coz you can edit it in a third party program such as notepad and a-like...the timer itself in JASS is the waiting time coz the spell wont fire before the timer expires...
Anyway, there is an ability called 'Ghost', try to use it instead of invisibility or windwalk, and there is an item ability called item speed bonus, use it to complicate things even more, it's a good excercise...
 
Using Berserk and Invisibility would've made the trigger even more complicated, you see?
If I just used Wind Walk, I could've just given the unit a negative movespeed bonus and no backstab damage.
And that's what I did.

If I made it instant, then the effects would take place before the caster even blinks.
Try it yourself, that's why I had to make a short wait.

Well, I wouldn't insist that my ideas are better. There are pros and cons (you've said it).

The reason why I would rather use Berserk + Invisibility is because I have very little confident in the MUI capability when Wait is involved.

I would rather play safe and make the trigger a little longer than to have the mechanics messed up. That's of course unless I'm better at triggering. =)
 
Maybe I should reduce the wait to 0.01 seconds.
And, if I use yurneric's solution, how do I make it so that only one buff appears on a unit?

On second thought, maybe my suggestion wasn't that good. I recalled having a similar problem like this before.

Try:
- Unit Finishes casting an ability
- Ability equals to Blink
- Make caster invulnerable (to prevent disruption from casting wind walk)
- Add Wind Walk (with negative movespeed bonus) to caster
- Enable Wind Walk for player (owner of caster)
- Order caster to cast Wind Walk
- Make caster vulnerable
- Second trigger: when a unit casts Wind Walk
- Disable Wind Walk for player

Edit:
*Note that disabling a skill doesn't remove its effects, it simply prevents the player from using it (by removing the skill button).
 
I made a short script for you:

JASS:
library Blink initializer Init

    globals
    
        private constant integer BLINK_CASTER_01        = 'A000' //Theese are your "Blink (1, 1 position) And (1, 2 position) respectively. Change them to whatever ID's your own spells have.
        private constant integer BLINK_CASTER_02        = 'A001'
        private constant integer BLINK_INVISIBILITY     = 'A002' //ID for "Blink invisibility".
        private constant real    INTERVAL               = 0.05 //the interval you want for the timer here
    
    endglobals
    
    struct BlinkUnit
        unit u
        integer id
    endstruct
    
    private function onExpire takes nothing returns nothing
        local BlinkUnit U = LoadInteger(udg_Hashtable, 0, GetHandleId(GetExpiredTimer()) ) //Returns the saved bundle once timer has expired
        call UnitAddAbility(U.u, BLINK_INVISIBILITY)
        call SetUnitAbilityLevel(U.u, BLINK_INVISIBILITY, GetUnitAbilityLevel(U.u, U.id))
        call IssueImmediateOrderById( U.u, OrderId("windwalk") )
        call UnitRemoveAbility(U.u, BLINK_INVISIBILITY)

        call U.destroy()
        call RemoveSavedInteger(udg_Hashtable, 0, GetHandleId(GetExpiredTimer()) )
        call DestroyTimer(GetExpiredTimer())
    endfunction
    
    private function action takes nothing returns nothing
        local timer t = CreateTimer()
        local BlinkUnit U = BlinkUnit.create() //BlinkUnit is like a bundle, containing the two variables seen above. Structs like theese allow us to attach more then aone data type to a single handle.
        set U.u = GetTriggerUnit()
        set U.id = GetSpellAbilityId()
        call SaveInteger(udg_Hashtable, 0, GetHandleId(t), U) //This attaches the struct to the timer
        call TimerStart(t, INTERVAL, false, function onExpire)
    endfunction
    
    private function condition takes nothing returns boolean
        if (GetSpellAbilityId() == BLINK_CASTER_01 or GetSpellAbilityId() == BLINK_CASTER_02) then
            return true
        endif
        return false
    endfunction
    
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()   //This creates the trigger upon initialization
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
        call TriggerAddCondition(t, function condition)
        call TriggerAddAction(t, function action)
    endfunction
    
    
endlibrary

Just create a trigger and go Edit>Convert to custom script, then replace the text with this code. This will fire everytime a unit casts either of your two blink spells, and that will start a timer that ends in 0.05 seconds, and when it does, it will add "blink invisibility" to the casting unit, set it's level to that of the casting spell, and order it to cast "windwalk" after which it removes the "blink invisible" spell and cleans up the code.

Replace the ability ID's in hte top with the ID's of your spells - you can find them by bitting "ctrl + D" in the object editor.

If you don't use this code, then at least consider using a timer instead of a loop that fires every 0.01 second, wether the spell is being cast or not! :O
 
Status
Not open for further replies.
Top