How to make this spell MUI

Bankde

Member
Reaction score
20
Sorry but I'm still confused in making spell MUI and I need some help. Last week someone had told me to sum up the hastable and I sum up it but it isn't perfect and can be easily cause imbalance in game.

Trigger:
  • Skill Rejuvenation
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Rejuvenation
    • Actions
      • Set Spell_Reju_Temp_Real = (Load 1 of (Key (Target unit of ability being cast)) from Spell_Reju_Hastable)
      • Set Spell_Reju_Temp_Real = (Spell_Reju_Temp_Real + ((Real((Intelligence of (Casting unit) (Include bonuses)))) / 10.00))
      • Hashtable - Save Handle Of(Target unit of ability being cast) as 0 of (Key (Target unit of ability being cast)) in Spell_Reju_Hastable
      • Hashtable - Save Spell_Reju_Temp_Real as 1 of (Key (Target unit of ability being cast)) in Spell_Reju_Hastable
      • Hashtable - Save 5.00 as 2 of (Key (Target unit of ability being cast)) in Spell_Reju_Hastable
      • Set Spell_Reju_Check = (Spell_Reju_Check + 1)
      • Trigger - Turn on Skill Rejuvenation Effect <gen>
      • Unit Group - Add (Target unit of ability being cast) to Spell_Reju_Group
      • Special Effect - Create a special effect attached to the overhead of (Target unit of ability being cast) using Objects\Spawnmodels\NightElf\EntBirthTarget\EntBirthTarget.mdl
      • Special Effect - Destroy (Last created special effect)


Trigger:
  • Skill Rejuvenation Effect
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Spell_Reju_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 2 of (Key (Picked unit)) from Spell_Reju_Hastable) Greater than 0.00
              • ((Picked unit) is dead) Equal to False
            • Then - Actions
              • Unit - Set life of (Load 0 of (Key (Picked unit)) in Spell_Reju_Hastable) to ((Life of (Load 0 of (Key (Picked unit)) in Spell_Reju_Hastable)) + (Load 1 of (Key (Picked unit)) from Spell_Reju_Hastable))
              • Hashtable - Save ((Load 2 of (Key (Picked unit)) from Spell_Reju_Hastable) - 0.10) as 2 of (Key (Picked unit)) in Spell_Reju_Hastable
            • Else - Actions
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Spell_Reju_Hastable
              • Set Spell_Reju_Check = (Spell_Reju_Check - 1)
              • Unit Group - Remove (Picked unit) from Spell_Reju_Group
      • If (Spell_Reju_Check Equal to 0) then do (Trigger - Turn off (This trigger)) else do (Do nothing)


But there is a problem about the duration and I don't know how to fix it. The problem can be shown easily as diagram below.

untitled.GIF

If you use at 1st seconds and someone use at 4th seconds. The first effect will not stop at 5s of the game but will stop at 9s. I have test it when I use this ability 10 times with the hero with 10int. From calculation it should heal the target for 500hp. But if I use the spell as the diagram, it comes out as healing target 2000hp !!!!:eek:

Can anyone help me changing this trigger pls? +rep
It would be great if it work as same as seperating one.
PS: Why I have to set (Key(target unit of ability being cast)) instead of (Key(casting unit)) ??
 

Moridin

Snow Leopard
Reaction score
144
Alright. Finally read it. Couple of things:

1) What's Spell_Reju_Check for?

2) Is the cooldown of your reju spell greater than or equal to 5 seconds?

If you answered Yes to question 2 then:

A) Try centering the hashtable around the casting unit instead of the target unit. What you've done is used the target unit of ability in all the second keys. Try making it the triggering unit instead and add the triggering/casting unit to the unit group.

If you don't get what I mean, I'm pretty sure I could edit your code to fix it. Note that it will bug up if the cooldown is less than 5 seconds.
 

Bankde

Member
Reaction score
20
Alright. Finally read it. Couple of things:

1) What's Spell_Reju_Check for?

2) Is the cooldown of your reju spell greater than or equal to 5 seconds?

If you answered Yes to question 2 then:

A) Try centering the hashtable around the casting unit instead of the target unit. What you've done is used the target unit of ability in all the second keys. Try making it the triggering unit instead and add the triggering/casting unit to the unit group.

If you don't get what I mean, I'm pretty sure I could edit your code to fix it. Note that it will bug up if the cooldown is less than 5 seconds.

1.I use Spell Reju Check to check if there isn't unit effected by this spell so that I could turn off the second trigger to reduce lag.
2.There will be 10 people in my game which if they use at the same time or in 5 period of the first effect will surely cause bug. That what I need to fix it. Thank
 

Moridin

Snow Leopard
Reaction score
144
I'm not talking about the number of people. That doesn't matter.

What does matter is, can ONE unit have the same ability effect going on TWICE at the same time? Cause that makes MUI a lot more complicated.

Basically, the spell lasts for 5 seconds. Can the same unit, after casting it once, cast it again before those 5 seconds are up. That's the answer I need.
 

Bankde

Member
Reaction score
20
Sorry but I also having spell like Refresher Orb which will refresh cooldown of skill,too. so I need to fix it.
 

Bankde

Member
Reaction score
20
Bump: I have ideas to create dummy unit every times when I use this skill and then set (Key of dummy) so it will never replace old information but is that good idea or is there any idea is better than this ?
 

Bankde

Member
Reaction score
20
Short but clear!!! Thank so much !!!!!!!!!!!!!!!!!!
+rep to both hgkjfhfdsj and moridin
 

Moridin

Snow Leopard
Reaction score
144
A dummy key would work I guess. But I would suggest keying it to the triggering / casting unit and having an "integer stack".

Essentially, have the hashtable have an integer stored into it whenever the ability is cast. The first time, it's stored as 1. Every time the ability is cast again, it increases by 1. Every time one spell ends, it decreases by one. If you base the rest of the data on the triggering unit + integer key then it should create a different set of data for each seperate cast, allowing pretty much perfect MUI.

Edit: hgkjfhfdsj's solution also works :).
 

Bankde

Member
Reaction score
20
I'm also confused about index. I will explain my ideas:

Let the 1st times I use this spell = A, 2nd times = B, 3rd times = C and 4th times = D.

Use "A", index will be 0+1=1
Use "B" during the "A" effect, index will be 1+1=2
Use "C" during the "A" and "B" effect, index will be 2+1=3
"A" Finish its effect - index will be 3-1=2
Use "D" during the "B" and "C" effect, (INDEX IS NOW = 2 which is as same as "B")doesn't it will replace the "B" information ?

(I understand that when using Index, no one will use (Key of (Casting Unit)))
 

hgkjfhfdsj

Active Member
Reaction score
55
which index/method are you referring to?
assuming index is 'i' (using stacks)

Use A > i = 1
Use B > i = 2
Use C > i = 3
when A finishes , C is moved to its position > i = 2
so its like
i...1.....2.....3
....C.....B.......

Use D > i = 3
i...1.....2.....3
....C.....B......D
 

tommerbob

Minecraft. :D
Reaction score
110
All you need to do is set the variables, save the variables in hashtable, and load them in periodic:

Trigger:
  • Set HealDuration = 5.00
    • Set HealAmount = (Total amount/50, whatever that is)
    • Hashtable - Save HealDuration as 0 of Key (Target unit of ability being cast) in Hashtable
    • Hashtable - Save HealAmount as 1 of Key (Target unit of ability being cast) in Hashtable
    • Unit Group - Add (target unit of ability being cast) to HealTargets
    • Set HealGroupCount = HealGroupCount + 1


Then in the periodic trigger:

Trigger:
  • Unit Group - Pick every unit in HealTargets and Do (actions)
    • Loop - Actions
      • Set HealDuration = (Load 0 of Key (Picked unit) from Hashtable)
      • Hashtable - Save (HealDuration - 0.10) as 0 of Key (Picked unit) in Hashtable
      • Set HealAmount = (Load 1 of Key (Picked unit) from Hashtable)
      • Unit - Set Life of (picked unit) to (life of (Picked unit) + HealAmount)
      • If/Then/Else Multiple Functions
        • If (conditions)
          • HealDuration Equal to or Less than 0.00
        • Then (actions)
          • Remove (picked unit) from HealTargets
          • Set HealGroupCount = HealGroupCount - 1
          • Hashtable - Clear all child hashtables...blah blah
          • If/Then/Else
            • If (conditions)
              • HealGroupCount Less Than or Equal to 0
            • Then Do (actions)
              • Trigger - Turn off (this trigger)


Shouldn't that work? It's basically your original triggers, but with some change in how you structure it.
 

Bankde

Member
Reaction score
20
I need your help again. I'm not sure where is this comes from or do I have to set anything about this.

Trigger:
  • For each (Integer LoopIndex) from 1 to i, do (Actions)

What variable is "Integer LoopIndex"?

I have set everything exactly what you said but there is something wrong because the spell seems not to work at all. Can someone help me check this spell please ?

Trigger:
  • Skill Rejuvenation
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Rejuvenation
    • Actions
      • Set Spell_Reju_Index = (Spell_Reju_Index + 1)
      • Set Spell_Reju_Unit[Spell_Reju_Index] = (Target unit of ability being cast)
      • Set Spell_Reju_HealAmount[Spell_Reju_Index] = ((Real((Intelligence of (Casting unit) (Include bonuses)))) / 10.00)
      • Set Spell_Reju_Duration[Spell_Reju_Index] = 5.00
      • Special Effect - Create a special effect attached to the overhead of (Target unit of ability being cast) using Objects\Spawnmodels\NightElf\EntBirthTarget\EntBirthTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • If (Spell_Reju_Index Equal to 1) then do (Countdown Timer - Start Spell_Reju_Timer as a Repeating timer that will expire in 0.10 seconds) else do (Do nothing)


Trigger:
  • Skill Rejuvenation Effect
    • Events
      • Time - Spell_Reju_Timer expires
    • Conditions
    • Actions
      • For each (Integer Spell_Reju_LoopIndex) from 1 to Spell_Reju_Index, do (Actions)
        • Loop - Actions
          • Unit - Set life of Spell_Reju_Unit[Spell_Reju_LoopIndex] to ((Life of Spell_Reju_Unit[Spell_Reju_LoopIndex]) + Spell_Reju_HealAmount[Spell_Reju_LoopIndex])
          • Set Spell_Reju_Duration[Spell_Reju_LoopIndex] = (Spell_Reju_Duration[Spell_Reju_LoopIndex] - 0.10)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Spell_Reju_Duration[Spell_Reju_LoopIndex] Less than or equal to 0.00
            • Then - Actions
              • Set Spell_Reju_HealAmount[Spell_Reju_LoopIndex] = Spell_Reju_HealAmount[Spell_Reju_Index]
              • Set Spell_Reju_Duration[Spell_Reju_LoopIndex] = Spell_Reju_Duration[Spell_Reju_Index]
              • Set Spell_Reju_Index = (Spell_Reju_Index - 1)
              • Set Spell_Reju_LoopIndex = (Spell_Reju_LoopIndex - 1)
            • Else - Actions
      • If (Spell_Reju_Index Equal to 0) then do (Countdown Timer - Pause Spell_Reju_Timer) else do (Do nothing)


I'm not sure that I have set something wrong or misplace something.
Here the variable :
Spell_Reju_Index : Integer
Spell_Reju_Unit : Unit
Spell_Reju_HealAmount : Real
Spell_Reju_Duration : Real
Spell_Reju_LoopIndex : Integer

Thank so much
 

Ayanami

칼리
Reaction score
288
Wait, why did you decide not to use Hashtables? Hashtables are the most effective way to make things MUI.
 

Ayanami

칼리
Reaction score
288
Hmm, I could rewrite the code for you and then you can sort out the difference. Only problem is, my World Editor's GUI hashtable is bugged, so I'll have to write it out in custom scripts (JASS).
 

Moridin

Snow Leopard
Reaction score
144
Currently he is using hashtables, and it is multi-unit instanceable, but it doesn't allow the same unit multiple instances of the ability.

He has a refresher orb kind of item though, so while you can do it using hashtables, it's a bit more complicated because you need to track how many times it's occurring for the same unit as well.
 

Ayanami

칼리
Reaction score
288
Is it because he used the handle for Target Unit of ability being cast? In that case, he could create a dummy unit and add it to the unit group, instead of referring to the target.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top