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

[Spell] New to MUI

Status
Not open for further replies.
Level 1
Joined
Sep 3, 2012
Messages
3
I mainly do this as a fun thing, but am currently working on a map to play with my friends.
The issue I currently have is getting triggers to work in MUI.

The current trigger I have is

  • Role Model
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Role Model (Prince W)
    • Actions
      • Unit - Set level of Benefit Fraud for (Triggering unit) to ((Level of Role Model (Prince W) for (Triggering unit)) + 1)
      • Wait 10.00 seconds
      • Unit - Set level of Benefit Fraud for (Triggering unit) to 1
I've tried the Timed MUI trigger tutorial but am at a loss as to what to do.

The second ability is the heroes passive, which when the active ability is activated is increased to the rank of the triggering ability.

Any advice would be greatly appreciated, keeping in mind that I'm new too MUI :)
 
Level 1
Joined
Sep 3, 2012
Messages
3
From my knowledge if a second unit casts the same spell during the duration of the first units then the wait timer will be set to full for both units.


But I'm new to this so maybe it doesn't, haha.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
It would (from a reasonable perspective) make the second caster reset the level to 1 when the first duration ended and again to 1 when the second duration ended.
However, that is not the case with triggering unit.
I do recommend you to use "Wait X seconds of gametime" though, just because it is 200% more accurate than what you have now.
(It is still not accurate at all but that doesnt matter.)
 
Level 23
Joined
Feb 6, 2014
Messages
2,466
I do recommend you to use "Wait X seconds of gametime" though, just because it is 200% more accurate than what you have now.

Wait wut, I thought Wait in game-time leak a timer handle reference .

@PimpMayor That's already MUI but inaccurate by about +- 0.2 second. Only problem you have there is everytime you cast it (by the same unit), it doesn't reset the timer. So at t=0 unit1 cast it, lvl= 2, then at t= 6, unit1 cast it, lvl = 3 , then at t = 10, unit1 lvl= 1 again. Then at= 12 unit1 cast it, lvl = 2, at t = 16 unit1 lvl = 1 again. At t=22 lvl=1 again.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Wait wut, I thought Wait in game-time leak a timer handle reference.
Go to the header of your map and place this script in it:
JASS:
    function WaitGameTime takes real duration returns nothing
        local timer t
        local real  timeRemaining
        
        if duration > 0 then
            set t = CreateTimer()
            call TimerStart(t, duration, false, null)
            loop
                set timeRemaining = TimerGetRemaining(t)
                exitwhen timeRemaining <= 0
                
                if timeRemaining > bj_POLLED_WAIT_SKIP_THRESHOLD then
                    call TriggerSleepAction(0.1 * timeRemaining)
                else
                    call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
                endif
            endloop
            call DestroyTimer(t)
            set t = null
        endif
    endfunction

Then instead of using your wait, you use "Custom script: call WaitGameTime(10)"
The actual leak is very small and wont be created that much... he wouldnt notice a damn thing of it.
But if you really want a perfect function (not looking at timers), then here it is.
(This is still a bad thing in Multiplayer games... normal waits too. You have to use timers to do it if you want to go multiplayer.)

@PimpMayor That's already MUI but inaccurate by about +- 0.2 second. Only problem you have there is everytime you cast it (by the same unit), it doesn't reset the timer. So at t=0 unit1 cast it, lvl= 2, then at t= 6, unit1 cast it, lvl = 3 , then at t = 10, unit1 lvl= 1 again. Then at= 12 unit1 cast it, lvl = 2, at t = 16 unit1 lvl = 1 again. At t=22 lvl=1 again.
That is more inaccurate by about +-(0. to 0.5) seconds on Real Time game speed... this wil be like 10* difference in game speed and real time speed on top of that as the normal wait uses the real time clock.
You wont have the timer reset problem if your cooldown is bigger or equal to 10.
 
Status
Not open for further replies.
Top