When I copy the JASS triggers from other map with an ability and I want to save the map, editor turns the JASS trigger off with the massage of several errors. Do I have to use we unlimited or sth to save the map? How to cope with it?
The ability is working in the old map. I've tested it and I can save the map that it is from. I don't know what is wrong and I've copied all things from the ability map (there was only one ability and it was easy to find changed things). The code isn't mine but I post it here
function Conditii2 takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A002' ) ) then return false endif if ( not ( UnitHasBuffBJ(GetSpellTargetUnit(), 'B000') == true ) ) then return false endif return true endfunction
function Cond takes nothing returns boolean if ( not ( UnitHasBuffBJ(GetTriggerUnit(), 'B000') == true ) ) then return false endif return true endfunction
function Trig_Defensive_Matrix_Conditions takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A002' ) ) then return false endif return true endfunction
function DMG takes nothing returns nothing
local unit targ local integer life local integer equation set targ = GetTriggerUnit() set life = GetLinkedInteger(targ, "life") if life-GetEventDamage()>=0 then call SetUnitLifeBJ( targ, ( GetUnitStateSwap(UNIT_STATE_LIFE, targ) + GetEventDamage() ) ) else call SetUnitLifeBJ( targ, ( GetUnitStateSwap(UNIT_STATE_LIFE, targ) + life ) ) endif set equation = life-R2I(GetEventDamage()) call StoreInt(targ, equation, "life") set targ = null endfunction
function Stop takes nothing returns nothing call IssueImmediateOrderBJ( GetTriggerUnit(), "stop" ) call SetUnitAnimation( GetTriggerUnit(), "stand" ) call DisplayTextToPlayer(GetOwningPlayer(GetTriggerUnit()), 0.00, 0.00, "Unit is already into a Defensive Matrix. ") endfunction
function Trig_Defensive_Matrix_Actions takes nothing returns nothing
local unit targ local trigger t local integer i local integer level local unit cast
set cast = GetTriggerUnit() set t = CreateTrigger() set targ = GetSpellTargetUnit() set level = GetUnitAbilityLevelSwapped('A002', cast) set i = 100+(level*200)
call TriggerRegisterUnitEvent(t, targ, EVENT_UNIT_DAMAGED) call TriggerAddCondition(t, Condition(function Cond)) call TriggerAddAction(t, function DMG) call StoreInt(targ, i, "life") call StoreInt(targ, level, "level") call TriggerSleepAction(0.10) loop exitwhen ( (UnitHasBuffBJ(targ, 'B000') == false) or (i <=0) ) call TriggerSleepAction(0.10) set i = GetLinkedInteger(targ, "life") endloop
call UnitRemoveBuffBJ( 'B000', targ )
call DestroyTrigger(t) set t = null set targ = null
endfunction
//=========================================================================== function InitTrig_Defensive_Matrix takes nothing returns nothing local trigger u set gg_trg_Defensive_Matrix = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Defensive_Matrix, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Defensive_Matrix, Condition( function Trig_Defensive_Matrix_Conditions ) ) call TriggerAddAction( gg_trg_Defensive_Matrix, function Trig_Defensive_Matrix_Actions )
set u = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(u, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition(u, Condition(function Conditii2) ) call TriggerAddAction (u, function Stop)
endfunction
and errors in compilation looks like that
//*************************************************************************** //* //* Global Variables //* //***************************************************************************
// Generated rect gg_rct_Sanctuary_enter = null rect gg_rct_Sanctuary_near_Vorador = null rect gg_rct_Sanctuary_Vorador = null rect gg_rct_Port_start = null rect gg_rct_Port_destination = null rect gg_rct_Game1_vampire_base = null rect gg_rct_Game1_human_base = null rect gg_rct_Game1_revive_vampire = null rect gg_rct_Game1_revive_human = null rect gg_rct_Game1_area = null rect gg_rct_Game1_Kain = null rect gg_rct_Game1_end_Kain = null rect gg_rct_Game1_end_Vorador = null rect gg_rct_Game1_end = null rect gg_rct_Sarafan_keep_start = null rect gg_rct_Sarafan_keep_start_2 = null rect gg_rct_Sarafan_keep_start_3 = null rect gg_rct_Sarafan_keep_switch1 = null rect gg_rct_Sarafan_keep_switch2 = null rect gg_rct_Sarafan_keep_switch3 = null rect gg_rct_Sarafan_keep_switch41 = null rect gg_rct_Sarafan_keep_switch42 = null rect gg_rct_Sarafan_keep_before_boss = null rect gg_rct_Sarafan_keep_bats_area = null rect gg_rct_Sarafan_keep_bats = null rect gg_rct_Philars_bat_emter = null rect gg_rct_Ariel = null rect gg_rct_Philars_thinking = null camerasetup gg_cam_Port_start = null camerasetup gg_cam_Port_end = null camerasetup gg_cam_Sanctuary_enter = null camerasetup gg_cam_Sanctuary_Vorador = null camerasetup gg_cam_Sanctuary_from_Vorador = null camerasetup gg_cam_Game1_vampire_base = null camerasetup gg_cam_Game1_human_base = null camerasetup gg_cam_Game1_palladin = null camerasetup gg_cam_Sarafan_keep1 = null camerasetup gg_cam_Sarafan_keep2 = null sound gg_snd_EnsnareMissile = null trigger gg_trg_Defensive_Matrix = null trigger gg_trg_Level_Track_Copy = null trigger gg_trg_ReprisalDetect_Copy = null trigger gg_trg_ReprisalDOIT_Copy = null trigger gg_trg_Swift_Attack = null trigger gg_trg_Swift_Attack02 = null trigger gg_trg_End_Swift_Attack = null trigger gg_trg_Kains_life_drop_stop = null trigger gg_trg_Kains_life_drop_start = null trigger gg_trg_Doors_invicible = null trigger gg_trg_Port = null trigger gg_trg_Sanctuary = null trigger gg_trg_Game_1_Intro = null trigger gg_trg_Game_1_Units = null trigger gg_trg_Game_1_Attack = null trigger gg_trg_Game_1_Kain = null trigger gg_trg_Game_1_Palladin_Hero = null trigger gg_trg_Game_1_Palladin_Hero_levels = null trigger gg_trg_Game_1_Palladin_Hero_levels_stop = null trigger gg_trg_Game_1_Victory = null trigger gg_trg_Game_1_Defeat = null trigger gg_trg_Sarafan_Keep_entrance = null unit gg_unit_u000_0016 = null unit gg_unit_u001_0017 = null unit gg_unit_u000_0018 = null unit gg_unit_hbar_0021 = null unit gg_unit_hbar_0022 = null unit gg_unit_hars_0023 = null unit gg_unit_hkee_0027 = null unit gg_unit_hcas_0028 = null unit gg_unit_O001_0029 = null unit gg_unit_u001_0082 = null unit gg_unit_H003_0042 = null unit gg_unit_u004_0043 = null unit gg_unit_O000_0044 = null destructable gg_dest_DTg5_0013 = null destructable gg_dest_DTg5_0014 = null destructable gg_dest_LTg3_0018 = null destructable gg_dest_LTg1_0023 = null destructable gg_dest_ZTd6_4192 = null destructable gg_dest_LTg3_0534 = null destructable gg_dest_ZTd5_4178 = null destructable gg_dest_ZTd8_4173 = null destructable gg_dest_ZTd8_4172 = null destructable gg_dest_LTg1_4171 = null destructable gg_dest_LTg3_4060 = null endglobals
function InitGlobals takes nothing returns nothing local integer i = 0 set udg_GameA = false set udg_userHeroB = false set udg_GameFinishA = false set udg_Ping2 = false set udg_GameAA = false set udg_GameDoneA = false set udg_Kainlife = false set udg_Damage = 0 set udg_AnotherTime = 0 endfunction
function Conditii2 takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A002' ) ) then return false endif if ( not ( UnitHasBuffBJ(GetSpellTargetUnit(), 'B000') == true ) ) then return false endif return true endfunction
function Cond takes nothing returns boolean if ( not ( UnitHasBuffBJ(GetTriggerUnit(), 'B000') == true ) ) then return false endif return true endfunction
function Trig_Defensive_Matrix_Conditions takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A002' ) ) then return false endif return true endfunction
function DMG takes nothing returns nothing
local unit targ local integer life local integer equation set targ = GetTriggerUnit() set life = GetLinkedInteger(targ, "life") if life-GetEventDamage()>=0 then call SetUnitLifeBJ( targ, ( GetUnitStateSwap(UNIT_STATE_LIFE, targ) + GetEventDamage() ) ) else call SetUnitLifeBJ( targ, ( GetUnitStateSwap(UNIT_STATE_LIFE, targ) + life ) ) endif set equation = life-R2I(GetEventDamage()) call StoreInt(targ, equation, "life") set targ = null endfunction
function Stop takes nothing returns nothing call IssueImmediateOrderBJ( GetTriggerUnit(), "stop" ) call SetUnitAnimation( GetTriggerUnit(), "stand" ) call DisplayTextToPlayer(GetOwningPlayer(GetTriggerUnit()), 0.00, 0.00, "Unit is already into a Defensive Matrix. ") endfunction
function Trig_Defensive_Matrix_Actions takes nothing returns nothing
local unit targ local trigger t local integer i local integer level local unit cast
set cast = GetTriggerUnit() set t = CreateTrigger() set targ = GetSpellTargetUnit() set level = GetUnitAbilityLevelSwapped('A002', cast) set i = 100+(level*200)
call TriggerRegisterUnitEvent(t, targ, EVENT_UNIT_DAMAGED) call TriggerAddCondition(t, Condition(function Cond)) call TriggerAddAction(t, function DMG) call StoreInt(targ, i, "life") call StoreInt(targ, level, "level") call TriggerSleepAction(0.10) loop exitwhen ( (UnitHasBuffBJ(targ, 'B000') == false) or (i <=0) ) call TriggerSleepAction(0.10) set i = GetLinkedInteger(targ, "life") endloop
call UnitRemoveBuffBJ( 'B000', targ )
call DestroyTrigger(t) set t = null set targ = null
endfunction
//=========================================================================== function InitTrig_Defensive_Matrix takes nothing returns nothing local trigger u set gg_trg_Defensive_Matrix = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Defensive_Matrix, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Defensive_Matrix, Condition( function Trig_Defensive_Matrix_Conditions ) ) call TriggerAddAction( gg_trg_Defensive_Matrix, function Trig_Defensive_Matrix_Actions )
set u = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(u, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition(u, Condition(function Conditii2) ) call TriggerAddAction (u, function Stop)
Aww... You are using my spell? I'm pleased. Ok, the problem is quite obvious... The function doesn't exist. Look to the spells section and search for the stickied import tutorial. You will notice that in some cases, you have to copy the stuff from the header of the map. For more info, check the import tutorial. There is a single screenshot I took of what you are interested.