MUI spell help

manofsteel

New Member
Reaction score
36
I have a spell that increase spell damage over 12 seconds(udg_SpellDamage), but I wonder how I can make this MUI(cause I guess it isen't).

Here is the code:
JASS:
function Trig_SpellPower_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A01W'
endfunction

function Trig_SpellPower_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real r = ( 5.00 + ( I2R(GetUnitAbilityLevelSwapped('A01W', u)) * 15.00 ) ) )
set udg_SpellDamage[GetConvertedPlayerId(GetOwningPlayer(u))] = ( udg_SpellDamage[GetConvertedPlayerId(GetOwningPlayer(u))] + r
call PolledWait( 12.00 )
set udg_SpellDamage[GetConvertedPlayerId(GetOwningPlayer(u))] = ( udg_SpellDamage[GetConvertedPlayerId(GetOwningPlayer(u))] - r
set u = null
endfunction

//===========================================================================
function InitTrig_SpellPower takes nothing returns nothing
    set gg_trg_SpellPower = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_SpellPower, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_SpellPower, Condition( function Trig_SpellPower_Conditions ) )
    call TriggerAddAction( gg_trg_SpellPower, function Trig_SpellPower_Actions )
endfunction
 

Draphoelix

It's not the wintercold that's killing me
Reaction score
132
I don't use JASS but I could give you a suggestion and you just convert it to JASS.

Use a timer instead of call
JASS:
PolledWait( 12.00 )
. When the timer expires after 12 seconds, then make the other actions.
 

Draphoelix

It's not the wintercold that's killing me
Reaction score
132
Are there no function for timers in JASS? And is thoose Set Spell Damage globals, since you are using udg_?
 

manofsteel

New Member
Reaction score
36
I don't know(since I'm not good with JASS) and secondly yes, it's a globla var.

EDIT> or I've seen something like call sleep.... something somewhere.
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
AdamGriffith, i am learning JASS like manofsteel and i was looking at tutorials and none of them really says how to make MUI stuff

what does JASS have and GUI doesnt that allows it to do MUI?
 

Naga'sShadow

Ultra Cool Member
Reaction score
49
Its not MUI, possible MPI but not MUI. As its altering a global variable udg_spelldamage. This trigger doesn't appear to do anything but increase that variable for other triggers but that would effect all units owned by that player. Honestly there is no easy option but your easiest would be true spell damage amplification. To do that you'd need a damage detection system of some sort. Then when spell damage is detected you would check to see if the damaged unit has the proper buff and if so deal an additional amount of spell damage to the target equal to the percentage spell damage increase.
 

Flare

Stops copies me!
Reaction score
662
AdamGriffith, i am learning JASS like manofsteel and i was looking at tutorials and none of them really says how to make MUI stuff

what does JASS have and GUI doesnt that allows it to do MUI?
JASS has easy access to local variables, which make it easier for making simpler triggers MUI - you can make locals in GUI, but you need to add lines of JASS (i.e. Custom Script) to declare them, and you need to call the functions through JASS, rather than the GUI Actions, to utilize them effectively.

If custom value isn't already in use in your map, you can index units i.e. at Map Init, group all units in the Playable Map Area, and if GetUnitUserData (GetEnumUnit ()) == 0 (assuming you're doing the check in the ForGroup callback), then increment a global integer variable by 1 and
JASS:
call SetUnitUserData (GetEnumUnit (), udg_CustomValue)

Then, when a unit enters the map (I can't remember the event :p), do something like
JASS:
function TriggerActions takes nothing returns nothing
  local unit u = GetTriggerUnit ()
  if GetUnitUserData (u) == 0 then
    set udg_CustomValue = udg_CustomValue + 1
    call SetUnitUserData (u, udg_CustomValue)
  endif
  set u = null
endfunction


Then, just use GetUnitUserData (u) as the array index in the trigger you posted. It should make your trigger fully MUI (can't really think of anything that would prevent it)

(I'll try and post some pseudo-code for the Map Init part later, I don't have access to a function list at the moment so it'd probably be all mixed up :p)
 

XeNiM666

I lurk for pizza
Reaction score
138
try localizing your udg_SpellDamage:
JASS:
local array real SpellDamage

so its:
JASS:
function Trig_SpellPower_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real r = ( 5.00 + ( I2R(GetUnitAbilityLevelSwapped('A01W', u)) * 15.00 ) ) )
local array real SpellDamage
set SpellDamage[GetConvertedPlayerId(GetOwningPlayer(u))] = ( SpellDamage[GetConvertedPlayerId(GetOwningPlayer(u))] + r
call PolledWait( 12.00 )
set SpellDamage[GetConvertedPlayerId(GetOwningPlayer(u))] = ( SpellDamage[GetConvertedPlayerId(GetOwningPlayer(u))] - r
set u = null
endfunction
 
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