• 🏆 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.
Level 11
Joined
Dec 21, 2008
Messages
766
I just wanna know if I finnly know how to make stuff MuI... and leakfreeeeee

  • Frost Status
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Frost Status
    • Actions
      • Set FS_Unit = (Triggering unit)
      • Set FS_Point = (Target point of ability being cast)
      • Set FS_Real[1] = 400.00
      • Set FS_Real[2] = 100.00
      • Set FS_Real[3] = (Real((Level of (Ability being cast) for FS_Unit)))
      • Set FS_Real[4] = (FS_Real[2] x FS_Real[3])
      • Set FS_Real[5] = (FS_Real[4] + FS_Real[1])
      • Set FS_Group = (Units within 250.00 of FS_Point)
      • Special Effect - Create a special effect at FS_Point using war3mapImported\Cyclon Explosion.mdx
      • Special Effect - Destroy (Last created special effect)
      • Unit Group - Pick every unit in FS_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of FS_Unit)) Equal to True
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Unit - Cause FS_Unit to damage (Picked unit), dealing FS_Real[5] damage of attack type Spells and damage type Cold
              • Special Effect - Create a special effect attached to the chest of (Picked unit) using war3mapImported\IceBolt.mdx
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
      • Custom script: call RemoveLocation(udg_FS_Point)
      • Custom script: call DestroyGroup(udg_FS_Group)
 
Here, optimized:
JASS:
function Trig_Frost_Status_Conditions takes nothing returns boolean
      return GetSpellAbilityId() == 'A001'
endfunction

function Trig_Frost_Status_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local real array r
local group g = CreateGroup()
local unit a
set r[1] = 400
set r[2] = 100.00
set r[3] = r[2] * GetUnitAbilityLevel (u, 'A001')
set r[4] =  r[3] + r[1]
call DestroyEffect (AddSpecialEffect("war3mapImported\\Cyclon Explosion.mdx", x, y))
call GroupEnumUnitsInRange (g, x, y, 250, null)
loop
      set a = FirstOfGroup (g)
      exitwhen a == null
      if IsUnitEnemy (a, GetOwningPlayer(u)) and GetWidgetLife (a) > 0.415 then
          call UnitDamageTarget (u, a, r[4], true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_COLD, WEAPON_TYPE_WHOKNOWS)
          call DestroyEffect (AddSpecialEffectTarget("war3mapImported\\IceBolt.mdx", a, "chest"))
      endif
endloop
set u = null
set a = null
set g = null
call DestroyGroup (g)
endfunction

//===========================================================================

function InitTrig_Frost_Status takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Trig_Frost_Status_Conditions ) )
call TriggerAddAction( t, function Trig_Frost_Status_Actions )
endfunction

Edit: LoL, why did you make it GUI now? It was Jass.. Anyway, it's MUI, yes.
 
Level 11
Joined
Dec 21, 2008
Messages
766
Here, optimized:
JASS:
function Trig_Frost_Status_Conditions takes nothing returns boolean
      return GetSpellAbilityId() == 'A001'
endfunction

function Trig_Frost_Status_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local real array r
local group g = CreateGroup()
local unit a
set r[1] = 400
set r[2] = 100.00
set r[3] = r[2] * GetUnitAbilityLevel (u, 'A001')
set r[4] =  r[3] + r[1]
call DestroyEffect (AddSpecialEffect("war3mapImported\\Cyclon Explosion.mdx", x, y))
call GroupEnumUnitsInRange (g, x, y, 250, null)
loop
      set a = FirstOfGroup (g)
      exitwhen a == null
      if IsUnitEnemy (a, GetOwningPlayer(u)) and GetWidgetLife (a) > 0.415 then
          call UnitDamageTarget (u, a, r[4], true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_COLD, WEAPON_TYPE_WHOKNOWS)
          call DestroyEffect (AddSpecialEffectTarget("war3mapImported\\IceBolt.mdx", a, "chest"))
      endif
endloop
set u = null
set a = null
set g = null
call DestroyGroup (g)
endfunction

//===========================================================================

function InitTrig_Frost_Status takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Trig_Frost_Status_Conditions ) )
call TriggerAddAction( t, function Trig_Frost_Status_Actions )
endfunction

Edit: LoL, why did you make it GUI now? It was Jass.. Anyway, it's MUI, yes.

It was years ago I posted triggers :p finnly found how to post triggers, sorry if I took some of your time.
 
I can read JASS. but I can understand GUI, so...
It would be:
A unit Starts the Effect of a Ability
Conditions:
Ability being cast = Frost Status(A001)
Actions:
Set FS_Unit = Triggering Unit
Set FS_Point = Target Point of Ability Being Cast
Set FS Real[1] = 400.00
Set FS_Real[2] = 100.00
Set FS_Real[3] = Real((Level of Ability Being Cast For FS_Unit))
Set FS_Real[4] = 100 * Real((Level of Ability Being Cast For FS_Unit))
Set FS_Real[5] = FS_Real[4] + 400
Set FS_Group = Units within 250 of FS_Point
Create <Special Effect> at FS_Point
Destroy Last Created Special Effect
Pick Every Unit In FS_Group Matching Owner of Matching Unit is an Enemy of Owner of FS_Unit = True and Matching Unit is Alive = True and Do:
Cause FS_Unit to damage Picked Unit, dealing FS_Real[5] with Attack type Cold
Create <Special Effect> attached to Picked Unit's "chest"
Destroy Last Created Special Effect

Well, if you could read the GUI(which is more jambled than the JASS!) as well as I could, no leaks and MUI. However, you waste unnecessary 1kb for the variables: FS_Unit and FS_Real[1 to 4].
Replace FS_Unit with 'GetTriggerUnit()/Triggering Unit
Replace FS_Real[5] with FS_Real[1] and then set FS_Real[1] to:
I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetTriggerUnit()) + 400.00/
Real((Level of Ability Being Cast For Triggering Unit) + 400
and delete the rest of the FS_Reals.
 
Status
Not open for further replies.
Top