MUI Question

sentrywiz

New Member
Reaction score
25
I have made a spell that I fear won't work in multiplayer circumstances. In other words, I'm not sure its gonna be MUI. I am in the process of learning JASS but I still can't make spells like these yet.

So these are the triggs, take a look and tell me if this will work MUI, aka with multiple players activating the same thing, and if its not tell me a way to fix it (GUI preferably for now)


Trigger:
  • Life Sphere
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Triggering unit) has an item of type Life Sphere) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 100.00) Less than or equal to 20.00
        • Then - Actions
          • Countdown Timer - Start LifeCountdown as a One-shot timer that will expire in 3.00 seconds
          • Set LifeCountdown = (Last started timer)
          • Trigger - Turn off (This trigger)
          • Game - Display to (All players) for 1.00 seconds the text: Healing for 6%
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + ((Max life of (Triggering unit)) x 0.06))
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
          • Special Effect - Destroy (Last created special effect)
          • Floating Text - Create floating text that reads (String(((Max life of (Triggering unit)) x 0.06))) above (Triggering unit) with Z offset 0.00, using font size 13.00, color (33.00%, 99.00%, 22.00%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
        • Else - Actions



Trigger:
  • Life Sphere Timer
    • Events
      • Time - LifeCountdown expires
    • Conditions
    • Actions
      • Trigger - Turn on Life Sphere <gen>




Spell has 20% chance to heal 6% of the caster's max health on spell cast. Also, spell has 3 second cooldown. This is where the cheese gets sticky and if one timer turns the trigger off, will it apply just for the player who activated it or all players?
 

Dinowc

don't expect anything, prepare for everything
Reaction score
223
nope, this isn't MUI

you can however, instead of using that timer, give the casting unit some buff that lasts 3 seconds

when he casts the spell check if he has the buff
 

sentrywiz

New Member
Reaction score
25
nope, this isn't MUI

you can however, instead of using that timer, give the casting unit some buff that lasts 3 seconds

when he casts the spell check if he has the buff

Aha, good call. And a condition to check that he doesn't have the buff. Crazy enough to work XD

EDIT:

Too bad you can't just give buffs. Now I have to make more dummy units. Oh agony agony agony
 

Necrach

You can change this now in User CP.
Reaction score
62
Using a timer countdown can never be MUI, and turning off triggers even less. But if each player never have more than a single unit that can use this spell, then you could add arrays for each player in the countdown variable, starting a timer with the same array number as the player using the spell!

You still cannot turn off the trigger, but you could instead check if the timer has expired (and you won't have to use some duration thing on the unit, like a costum value counting down or a buff placed by a dummy unit)
 

sentrywiz

New Member
Reaction score
25
Trigger:
  • Life Sphere
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Triggering unit) has an item of type Life Sphere) Equal to True
      • ((Owner of (Triggering unit)) is in LifeSphereGroup) Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 100.00) Less than or equal to 100.00
        • Then - Actions
          • Set LifeSphereGroup = (All players)
          • Player Group - Add (Owner of (Triggering unit)) to LifeSphereGroup
          • Countdown Timer - Start LifeSphereTimer as a One-shot timer that will expire in 3.00 seconds
          • Set LifeSphereTimer = (Last started timer)
          • Game - Display to (All players) for 1.00 seconds the text: Creating Dummy
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + ((Max life of (Triggering unit)) x 0.06))
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
          • Special Effect - Destroy (Last created special effect)
          • Floating Text - Create floating text that reads (String(((Max life of (Triggering unit)) x 0.06))) above (Triggering unit) with Z offset 0.00, using font size 13.00, color (33.00%, 99.00%, 22.00%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
        • Else - Actions




Trigger:
  • Life Sphere Cooldown
    • Events
      • Time - LifeSphereTimer expires
    • Conditions
    • Actions
      • Player Group - Pick every player in LifeSphereGroup and do (Actions)
        • Loop - Actions
          • Player Group - Remove (Picked player) from LifeSphereGroup




Better?

I followed both ideas but I liked Necrach logic more, although I made it not with arrays but with a player group. Is this MUI now?

Trigger should add players inside a LifeSphereGroup when it casts the ability and when timer expires after 3 secs it will remove all players from it. But now I am not sure how to remove a specific player, aka owner of triggering unit.
 

Dinowc

don't expect anything, prepare for everything
Reaction score
223
if you accept it to be MPI then you could put the casting unit in a group and make another trigger:

Trigger:
  • trigger1
    • events
      • every 1.00 seconds of game time
    • conditions
    • actions
      • unit group - pick every unit in TempGroup and do actions
        • set value = [Player number of owner of picked unit]
        • set count[value] = count[value] + 1
        • if count[value] greater than or equal to 3 then
          • unit group - remove picked unit from TempGroup


in the first trigger check if the caster is in the group and set the count to 0
 

sentrywiz

New Member
Reaction score
25
Trigger:
  • * Player Group - Pick every player in LifeSphereGroup and do (Actions)
    • o Loop - Actions
      • + Player Group - Remove (Picked player) from LifeSphereGroup



How would you make this trigger to only remove owner of casting unit? Because I don't like the trigger with every 1 second checking. That works, but if you can somehow use that logic within this trigger with player group, it would be great
 

Necrach

You can change this now in User CP.
Reaction score
62
Look, a single countdown timer can never run at the same time as itself, eg if you start it again it will restart or just retain.

But if you really don't want to use periodic events, you have to use arrays in at least one variable to make the skill usable for several players at the same time. The solution I present to you now is usable multiplayer, but not if a player can have several units casting this ability.

Add
Trigger:
  • Countdown Timer - Start TimerWithArrays[(Player number of (Owner of (Casting unit)))] as a One-shot timer that will expire in 3.00 seconds

in the first trigger (might want to eliminate leaks)

then make one of that second trigger for EACH player with the event
Trigger:
  • Time - timer[x] expires


you could make a single trigger with several events for all players, like
Trigger:
  • Events
    • Time - timer[1] expires
    • Time - timer[2] expires
    • Time - timer[3] expires
    • Time - timer[4] expires
    • Time - timer[5] expires
    • etc

but that would be A LOT MORE COMPLICATED because there is no way to detect which player's countdown timer that activated the event, eg. you must use other variables and maybe a dummy unit with buffs (as you said you didn't want to use)



Another option for you might be a buff placer (dummy unit) and then just WAIT FOR CONDITION instead of using a periodic event. However, I never like using those Wait actions :/
 

sentrywiz

New Member
Reaction score
25
Yea that is why JASS is better with spells of this type. Not that its hard to make in GUI, but simpler in JASS with more control over what you wanna do.


Tried with shit loads of array in timer, players and just confused myself and the system. I think its simpler to just use buff to check. This is how trigger looks now:


Trigger:
  • Life Sphere
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Triggering unit) has an item of type Life Sphere) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 100.00) Less than or equal to 20.00
          • ((Triggering unit) has buff Recently Healed ) Equal to False
        • Then - Actions
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + ((Max life of (Triggering unit)) x 0.06))
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
          • Special Effect - Destroy (Last created special effect)
          • Floating Text - Create floating text that reads (String(((Max life of (Triggering unit)) x 0.06))) above (Triggering unit) with Z offset 0.00, using font size 10.00, color (33.00%, 99.00%, 22.00%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
          • Unit - Create 1 Dummy Unit for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Recently Healed to (Last created unit)
          • Unit - Order (Last created unit) to Human Sorceress - Slow (Triggering unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) has buff Recently Healed ) Equal to True
            • Then - Actions
              • Floating Text - Create floating text that reads Failed to heal above (Triggering unit) with Z offset 0.00, using font size 10.00, color (33.00%, 99.00%, 22.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
            • Else - Actions
 

Necrach

You can change this now in User CP.
Reaction score
62
The way you are doing it now should work! And I really think its the best way :)

Another nice way of doing these things is adding a dummy unit, setting both the dummy unit's and the caster's costum value to the Player number of the owner. Add the caster to a group.

Then add an expiration timer (3 sec) to the dummy unit. Then make a trigger that when the dummy unit expires, remove the unit with equal costum value from the unit group (resetting costum value to 0). This can only be done if costum values are not used in any other triggers :p
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top