[Solved] MUIness

Status
Not open for further replies.
Level 3
Joined
Jun 16, 2016
Messages
50
Hello guys,

I just red tutorial about MPI and MUI.
And im not sure if im rigth but as i looked at someone EluneArrow spell (which seems to be MUI)
Making spell MUI means making every variable array count on every action and after 8190 (or how much is it) a then reseting it to 1?

Triggers of EluneArrow base :

  • shooting 9mm
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to |cffffd700SHOOT WITH PISTOL|r
    • Actions
      • Set EluneArrow_Counts = (EluneArrow_Counts + 1)
      • Set EluneArrow_Caster[EluneArrow_Counts] = (Casting unit)
      • Set EluneArrow_CasterLoc = (Position of EluneArrow_Caster[EluneArrow_Counts])
      • Set EluneArrow_TargetPoint = (Target point of ability being cast)
      • Set EluneArrow_Angle = (Angle from EluneArrow_CasterLoc to EluneArrow_TargetPoint)
      • Unit - Create 1 9mm for (Owner of EluneArrow_Caster[EluneArrow_Counts]) at EluneArrow_CasterLoc facing EluneArrow_Angle degrees
      • Unit - Set the custom value of (Last created unit) to EluneArrow_Counts
      • Unit Group - Add (Last created unit) to EluneArrow_StartGroup
      • Set EluneArrow_Distance[EluneArrow_Counts] = 2300.00
      • Set EluneArrow_DistanceTravel[EluneArrow_Counts] = 0.00
      • Set EluneArrow_StunDuration[EluneArrow_Counts] = 1
      • Set EluneArrow_DistanceCount[EluneArrow_Counts] = 0.00
      • Trigger - Turn on shooting 9mm loop <gen>
      • Custom script: call RemoveLocation (udg_EluneArrow_CasterLoc)
      • Custom script: call RemoveLocation (udg_EluneArrow_TargetPoint)
  • shooting 9mm loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in EluneArrow_StartGroup and do (Actions)
        • Loop - Actions
          • Set EluneArrow_CustomValue = (Custom value of (Picked unit))
          • Set EluneArrow_DummyLoc = (Position of (Picked unit))
          • Set EluneArrow_Movement = (EluneArrow_DummyLoc offset by 20.00 towards (Facing of (Picked unit)) degrees)
          • Unit - Move (Picked unit) instantly to EluneArrow_Movement
          • Set EluneArrow_DistanceTravel[EluneArrow_CustomValue] = (EluneArrow_DistanceTravel[EluneArrow_CustomValue] + 18.00)
          • Set EluneArrow_DistanceCount[EluneArrow_CustomValue] = (EluneArrow_DistanceCount[EluneArrow_CustomValue] + 18.00)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • EluneArrow_DistanceCount[EluneArrow_CustomValue] Greater than or equal to 225.00
            • Then - Actions
              • Set EluneArrow_StunDuration[EluneArrow_CustomValue] = (EluneArrow_StunDuration[EluneArrow_CustomValue] + 1)
              • Set EluneArrow_DistanceCount[EluneArrow_CustomValue] = 0.00
            • Else - Actions
          • Set EluneArrow_UnitGroup = (Units within 150.00 of EluneArrow_Movement matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of EluneArrow_Caster[EluneArrow_CustomValue])) Equal
          • Set EluneArrow_RandomUnit = (Random 1 units from EluneArrow_UnitGroup)
          • Unit Group - Pick every unit in EluneArrow_RandomUnit and do (Actions)
            • Loop - Actions
              • Set bleed_target = (Picked unit)
              • Unit - Cause EluneArrow_Caster[EluneArrow_CustomValue] to damage (Picked unit), dealing (90.00 x (Real((Level of |cffffd700SHOOT WITH PISTOL|r for EluneArrow_Caster[EluneArrow_CustomValue])))) damage of attack type Spells and damage type Normal
              • Unit - Create 1 Dummy for (Owner of EluneArrow_Caster[EluneArrow_CustomValue]) at EluneArrow_Movement facing Default building facing degrees
              • Unit - Add Elune Arrow Stun to (Last created unit)
              • Unit - Add Bleeding to (Last created unit)
              • Unit - Set level of Elune Arrow Stun for (Last created unit) to EluneArrow_StunDuration[EluneArrow_CustomValue]
              • Unit - Set level of Bleeding for (Last created unit) to EluneArrow_StunDuration[EluneArrow_CustomValue]
              • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Picked unit)
              • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
              • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • EluneArrow_DistanceTravel[EluneArrow_CustomValue] Greater than or equal to EluneArrow_Distance[EluneArrow_CustomValue]
                  • (Number of units in EluneArrow_UnitGroup) Greater than 0
            • Then - Actions
              • Unit - Kill (Picked unit)
              • Unit Group - Remove (Picked unit) from EluneArrow_StartGroup
            • Else - Actions
          • Custom script: call RemoveLocation (udg_EluneArrow_DummyLoc)
          • Custom script: call RemoveLocation (udg_EluneArrow_Movement)
          • Custom script: call DestroyGroup (udg_EluneArrow_UnitGroup)
          • Custom script: call DestroyGroup (udg_EluneArrow_RandomUnit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in EluneArrow_StartGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions

Sorry if used wrong subforum
 
Last edited:
First you to know, this is the correct forum. :)

But no, I haven't read your triggers, but your explanation is wrong of dynamic indexing.
There exist 2 processes: Indexing, Deindexing

Indexing is done when you initialisize the instance, for example:
  • Set Damage[MaxIndex] = 3
  • Set Player[MaxIndex] = Player 1
  • Set Unit[MaxIndex] = (Triggering Unit)
Deindexing is the process of freeing the created instance above. And that no "index gap" is created we move the last instance to our current position when we deindex. Example:

  • Set Damage[currentIndex] = Damage[MaxIndex]
  • Set Player[currentIndex] = Player[MaxIndex]
  • Set Unit[currentIndex] = Unit[MaxIndex]
currentIndex is the instance we want do deindex. The values from our currently last instance (MaxIndex) were moved now to position of currentIndex.

Number illustration:

- You index 4 instances, your list looks like: [1] [2] [3] [4]
- You deindex instance [2], now your list will look like: [1] [4] [3]

What happened is we replaced the [2]'s position with [4]'s.

Read this tutorial in detail for a good understanding. Visualize: Dynamic Indexing
 
Level 3
Joined
Jun 16, 2016
Messages
50
So for making spell MUI (MultiUnit/User intance) i need Deindexing right? i mean dynamic indexing?

EDIT : Well as i red a bit and tryin to understand it...

If i have spell which have to as example shoot or fire any item

even is unit uses spell

cond is spell casted qual to spell1

so i set some variables like

set spell_index = spell index + 1

set spell_caster = spell_caster[spell_index]

and other factors needed for this spell as it ...

So the mechanics and theory od MUIing is to set 1 caster to index1
and then next caster will get index2 so everyone is using same spell without trigger conflicts and some spell bugs. and after it raches the array limit it will get back to 1?
 
Last edited:
and after it raches the array limit it will get back to 1?
No, you don't jump back only when you reach the limit, but instead you jump each time when we deindex an instance. Then we jump with the last instance to our instance that is being deindexed.

Try to build the demo trigger from the linked tutorial. :) Steps are not too hard, but the processes indexing/deindexing can be pretty unfamilar in the begining.. so it's recommended to make some little examples by one's own. And then it will come. :)
 
Status
Not open for further replies.
Top