- Joined
- May 16, 2012
- Messages
- 644
I'm trying to move from GUI to Jass, because lets be honest, GUI is easy and all, but it ties my hands, especially when i'm trying to make things MUI, and i started taking old GUI triggers that I've made and turned them into Jass, but instead of using Global variables i switch to local ones, so the whole thing becomes MUI (Right?). I've read some tutorials here on hive on how to do this and just want to be sure that its correct.
It's a realy simple code, it checks if the attacked unit have a specific item and do its think. So is it MUI? If not, Why, and what need to be changed to become MUI.
And why i need to put InitTrig_... before every trigger name? There's any way to make my trigger work without it, because recently I've had an error where, when saving my game the jasshelper gave me this weird error of "Memory Exhausted", and i think its related to the amount of triggers in my map.
It's a realy simple code, it checks if the attacked unit have a specific item and do its think. So is it MUI? If not, Why, and what need to be changed to become MUI.
JASS:
function Lucky_Shield_Conditions takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetAttackedUnitBJ(), 'I04M') == true ) ) then
return false
endif
return true
endfunction
function Lucky_Shield_Chance takes nothing returns boolean
if ( not ( GetRandomInt(1, 100) <= 10 ) ) then
return false
endif
return true
endfunction
function Lucky_Shield_Actions takes nothing returns nothing
local unit u
if ( Lucky_Shield_Chance() ) then
set u = GetAttackedUnitBJ()
call DestroyEffectBJ(AddSpecialEffectTargetUnitBJ( "chest", u, "war3mapImported\\WarpHolyCaster.mdx" ))
call SetUnitLifePercentBJ( u, ( GetUnitLifePercent(u) + 10.00 ) )
endif
set u = null
endfunction
//===========================================================================
function InitTrig_LS_1_JASS_TEST takes nothing returns nothing
local trigger t
set t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, Condition( function Lucky_Shield_Conditions ) )
call TriggerAddAction( t, function Lucky_Shield_Actions )
endfunction
And why i need to put InitTrig_... before every trigger name? There's any way to make my trigger work without it, because recently I've had an error where, when saving my game the jasshelper gave me this weird error of "Memory Exhausted", and i think its related to the amount of triggers in my map.
Last edited: