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

[Trigger] Help with MUI

Status
Not open for further replies.
Level 5
Joined
Sep 10, 2006
Messages
185
I tried to make a spell MUI again, and again no work.

=[

  • Lightning Rod
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Lightning Rod
    • Actions
      • -------- Locals --------
      • Custom script: local integer udg_LightningRodInt
      • Custom script: local unit udg_LightningRodUnit
      • Custom script: local effect LightningRodEffect
      • -------- --------
      • Set LightningRodInt = (Random integer number between 1 and 3)
      • Set LightingRodUnit = (Attacked unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LightningRodInt Equal to 1
        • Then - Actions
          • Unit - Pause LightingRodUnit
          • Special Effect - Create a special effect attached to the overhead of LightingRodUnit using Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
          • Set LightningRodEffect = (Last created special effect)
          • Wait 1.00 seconds
          • Unit - Unpause LightingRodUnit
          • Special Effect - Destroy LightningRodEffect
        • Else - Actions
      • Custom script: set udg_LightningRodUnit = null
Any obvious mistakes?
 
Level 5
Joined
Sep 10, 2006
Messages
185
Dreadnought[dA];720738 said:
lol well do u have more than 1 lightning rod firing at once? Then your special effects wont be destroyed properly because the global variable changes.

All that happens when the towers attack is abit of lag when I suspect the trigger is being run? but NOTHING else happens.

No pause, no fx, nada.
 
Level 5
Joined
Sep 10, 2006
Messages
185
I just want to see... I know this isnt a jass forum. But if you convert it to custom text and wraps it with jasstags, I can inverstigate and see why it doesn't work.

JASS:
function Trig_Lightning_Rod_Conditions takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetAttacker()) == 'uzg1' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Lightning_Rod_Func008C takes nothing returns boolean
    if ( not ( udg_LightningRodInt == 1 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Lightning_Rod_Actions takes nothing returns nothing
    // Locals
    local integer udg_LightningRodInt
    local unit udg_LightningRodUnit
    local effect LightningRodEffect
    //  
    set udg_LightningRodInt = GetRandomInt(1, 3)
    set udg_LightingRodUnit = GetAttackedUnitBJ()
    if ( Trig_Lightning_Rod_Func008C() ) then
        call PauseUnitBJ( true, udg_LightingRodUnit )
        call AddSpecialEffectTargetUnitBJ( "overhead", udg_LightingRodUnit, "Abilities\\Spells\\Human\\Thunderclap\\ThunderclapTarget.mdl" )
        set udg_LightningRodEffect = GetLastCreatedEffectBJ()
        call TriggerSleepAction( 1.00 )
        call PauseUnitBJ( false, udg_LightingRodUnit )
        call DestroyEffectBJ( udg_LightningRodEffect )
    else
    endif
    set udg_LightningRodUnit = null
endfunction

//===========================================================================
function InitTrig_Lightning_Rod takes nothing returns nothing
    set gg_trg_Lightning_Rod = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Lightning_Rod, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_Lightning_Rod, Condition( function Trig_Lightning_Rod_Conditions ) )
    call TriggerAddAction( gg_trg_Lightning_Rod, function Trig_Lightning_Rod_Actions )
endfunction
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Yes it was just like I expected... and Wyrmlord has pointed this out in his MUI for GUI tutorial

I must mention one problem with using locals in GUI. The problem is that they cannot be used everywhere. For instance, you should not refer to local variables in if/then/else blocks and "pick every ..." blocks. The reason behind this is that if/then/else sometimes creates additional functions (even if they really are unnecessary) for the condition amongst other things. The "pick ever ..." blocks will always create an additional function that is called for each picked object. All of this information I just told you is hidden from you in GUI, which is why I'm warning you.

When you do the if function, locals aren't passing through the condition. Instead that condition is referring to the global variable.

I believe that the chance of a unit shall overwrite a variable when not using waits is very small. Therefor it might not be at any harm if the integer is global. Thats the way you can solve it... (did just remove the local integer)

It should be triggered now...

  • Lightning Rod
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Lightning Rod
    • Actions
      • -------- Locals --------
      • Custom script: local unit udg_LightningRodUnit
      • Custom script: local effect LightningRodEffect
      • -------- --------
      • Set LightningRodInt = (Random integer number between 1 and 3)
      • Set LightingRodUnit = (Attacked unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LightningRodInt Equal to 1
        • Then - Actions
          • Unit - Pause LightingRodUnit
          • Special Effect - Create a special effect attached to the overhead of LightingRodUnit using Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
          • Set LightningRodEffect = (Last created special effect)
          • Wait 1.00 seconds
          • Unit - Unpause LightingRodUnit
          • Special Effect - Destroy LightningRodEffect
        • Else - Actions
      • Custom script: set udg_LightningRodUnit = null
 
Level 5
Joined
Sep 10, 2006
Messages
185
Sweet, works now! + rep. Got another question if you don't mind helpin tho :p
Supposed to spawn a dummy unit to cast acid bomb on the attacked unit, but all it does is spawn the dummy.

In GUI

  • Sewage
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) Equal to Ancient of Wonders (6)
          • (Owner of (Attacked unit)) Equal to Player 10 (Light Blue)
    • Actions
      • -------- Locals --------
      • Custom script: local unit udg_SewageDummy
      • Custom script: local unit udg_SewageTarget
      • Custom script: local location udg_SewagePosCast
      • -------- Set Variables --------
      • Set SewageTarget = (Attacked unit)
      • Set SewagePosCast = (Position of (Attacked unit))
      • Unit - Create 1 Toxic Sewage (Dummy) for (Owner of (Attacking unit)) at SewagePosCast facing (Facing of (Attacking unit)) degrees
      • Set SewageDummy = (Last created unit)
      • -------- Action --------
      • Wait 1.00 seconds
      • Unit - Order SewageDummy to Neutral Alchemist - Acid Bomb SewageTarget
      • -------- Leak Clean up --------
      • Custom script: call RemoveLocation(udg_SewagePosCast)
      • -------- Null locals --------
      • Custom script: set udg_SewagePosCast = null
      • Custom script: set udg_SewageDummy = null
      • Custom script: set udg_SewageTarget = null
in jass
JASS:
function Trig_Sewage_Func001C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetAttacker()) == 'eden' ) ) then
        return false
    endif
    if ( not ( GetOwningPlayer(GetAttackedUnitBJ()) == Player(9) ) ) then
        return false
    endif
    return true
endfunction

function Trig_Sewage_Conditions takes nothing returns boolean
    if ( not Trig_Sewage_Func001C() ) then
        return false
    endif
    return true
endfunction

function Trig_Sewage_Actions takes nothing returns nothing
    // Locals
    local unit udg_SewageDummy
    local unit udg_SewageTarget
    local location udg_SewagePosCast
    // Set Variables
    set udg_SewageTarget = GetAttackedUnitBJ()
    set udg_SewagePosCast = GetUnitLoc(GetAttackedUnitBJ())
    call CreateNUnitsAtLoc( 1, 'hkni', GetOwningPlayer(GetAttacker()), udg_SewagePosCast, GetUnitFacing(GetAttacker()) )
    set udg_SewageDummy = GetLastCreatedUnit()
    // Action
    call TriggerSleepAction( 1.00 )
    call IssueTargetOrderBJ( udg_SewageDummy, "acidbomb", udg_SewageTarget )
    // Leak Clean up
    call RemoveLocation(udg_SewagePosCast)
    // Null locals
    set udg_SewagePosCast = null
    set udg_SewageDummy = null
    set udg_SewageTarget = null
endfunction

//===========================================================================
function InitTrig_Sewage takes nothing returns nothing
    set gg_trg_Sewage = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Sewage, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_Sewage, Condition( function Trig_Sewage_Conditions ) )
    call TriggerAddAction( gg_trg_Sewage, function Trig_Sewage_Actions )
endfunction
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
I guess that has nothing to do with the triggering...

-> Is the ability already preset on the unit in the unit editor? otherwise you have to add it you know.
-> Is the mana cost of the ability 0?
-> Is the ability a unit ability?

Also, you have to kill the dummy. Before the dummy starts the cast, add
  • Unit - Add a 2 seconds expiration timer to SewageDummy
 
Level 5
Joined
Sep 10, 2006
Messages
185
I guess that has nothing to do with the triggering...

-> Is the ability already preset on the unit in the unit editor? otherwise you have to add it you know.
-> Is the mana cost of the ability 0?
-> Is the ability a unit ability?

Also, you have to kill the dummy. Before the dummy starts the cast, add
  • Unit - Add a 2 seconds expiration timer to SewageDummy

- Unit has the spell. Toxic Sludge, based off of Acid Bomb.
- Spell costs 0 mana, 0 second cooldown, and to make sure, the dummy has 900 initial / max mana.
- Hero ability = false, so yeah.

Aight, well I'm gonna log. If you see anything else that could be wrong, post and I'll check it out tomorrow.

Also, if you want any more info, lemme know tomorrow.

cya and ty for help so far.
 
Level 5
Joined
Sep 10, 2006
Messages
185
how about the range of the ability?

Ive seen that some abilities doesnt fire with units having momevent speed set to 0 and movement type to none. Try change it to 1 and Foot

OK, if I make it spawn Goblin Alchemists and then add the ability to them, it works.
o_O However, I don't want the YOUR HERO HAS FALLEN / left hero icon spam.
but it is NOT a hero spell.
=/
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
its should not be needed to spawn a hero for it. However you can setup that it shall hide messages and such, and disable hero interface icon. I think it was under the "stats" section: Hide death message, hide hero icon interface or something
 
Status
Not open for further replies.
Top