//
// Custom Script to do sfx, sfrx, and cleanup stuff
//
// Colored Text: |c00RRGGBBtext|r
//
// Variables Needed:
//
// location aa_sfx_target
// integer zz_sfx_cleanup_counter
// integer zz_sfx_repeater_counter
// trigger zz_sfx_repeater
// trigger zz_sfx_cleanup
// integer zz_SAFE_TO_CLEANUP_SIZE
//
// arrays:
// boolean zz_safe_to_cleanup
// boolean zz_sfx_active
// integer zz_delays
// integer zz_delays_counters
// integer zz_times
// integer zz_times_counters
// integer zz_patterns
// integer zz_distances
// integer zz_targets
// integer zz_paths
// effect zz_effects_to_cleanup
//
// Need a trigger to call zz_init_map on map initialisation
//
// Functions enabled:
//
// sfx( int pattern, int distance, string path)
// sfrx( int pattern, int distance, int times, int delay, string path)
// yesclean (int j)
// noclean (int j)
// canclean () returns boolean
// patterns:
// 0 - single shot
// 1 - 4 square
// 2 - 4 diagonal
// 3 - 1 random square
// 4 - 1 random circle
function noclean takes integer j returns nothing
set udg_zz_safe_to_cleanup[j] = false
endfunction
function yesclean takes integer j returns nothing
set udg_zz_safe_to_cleanup[j] = true
endfunction
function canclean takes nothing returns boolean
local boolean safe = true
local integer j = 0
loop
exitwhen j >= udg_zz_SAFE_TO_CLEANUP_SIZE
if ( udg_zz_safe_to_cleanup[j] == false ) then
set safe = false
endif
set j = j + 1
endloop
return safe
endfunction
function zz_sfx_at_loc takes integer pattern, integer distance, location mytarget, string sfxpath returns nothing
local integer ndistance = distance * -1
if( pattern == 0 ) then
set udg_zz_effects_to_cleanup[udg_zz_sfx_cleanup_counter] = AddSpecialEffectLocBJ( OffsetLocation(mytarget, 0, 0), sfxpath )
set udg_zz_sfx_cleanup_counter = udg_zz_sfx_cleanup_counter + 1
elseif( pattern == 1 ) then
set udg_zz_effects_to_cleanup[udg_zz_sfx_cleanup_counter] = AddSpecialEffectLocBJ( OffsetLocation(mytarget, distance, 0), sfxpath )
set udg_zz_sfx_cleanup_counter = udg_zz_sfx_cleanup_counter + 1
set udg_zz_effects_to_cleanup[udg_zz_sfx_cleanup_counter] = AddSpecialEffectLocBJ( OffsetLocation(mytarget, ndistance, 0), sfxpath )
set udg_zz_sfx_cleanup_counter = udg_zz_sfx_cleanup_counter + 1
set udg_zz_effects_to_cleanup[udg_zz_sfx_cleanup_counter] = AddSpecialEffectLocBJ( OffsetLocation(mytarget, 0, distance), sfxpath )
set udg_zz_sfx_cleanup_counter = udg_zz_sfx_cleanup_counter + 1
set udg_zz_effects_to_cleanup[udg_zz_sfx_cleanup_counter] = AddSpecialEffectLocBJ( OffsetLocation(mytarget, 0, ndistance), sfxpath )
set udg_zz_sfx_cleanup_counter = udg_zz_sfx_cleanup_counter + 1
elseif( pattern == 2 ) then
set udg_zz_effects_to_cleanup[udg_zz_sfx_cleanup_counter] = AddSpecialEffectLocBJ( OffsetLocation(mytarget, distance, distance), sfxpath )
set udg_zz_sfx_cleanup_counter = udg_zz_sfx_cleanup_counter + 1
set udg_zz_effects_to_cleanup[udg_zz_sfx_cleanup_counter] = AddSpecialEffectLocBJ( OffsetLocation(mytarget, ndistance, distance), sfxpath )
set udg_zz_sfx_cleanup_counter = udg_zz_sfx_cleanup_counter + 1
set udg_zz_effects_to_cleanup[udg_zz_sfx_cleanup_counter] = AddSpecialEffectLocBJ( OffsetLocation(mytarget, distance, ndistance), sfxpath )
set udg_zz_sfx_cleanup_counter = udg_zz_sfx_cleanup_counter + 1
set udg_zz_effects_to_cleanup[udg_zz_sfx_cleanup_counter] = AddSpecialEffectLocBJ( OffsetLocation(mytarget, ndistance, ndistance), sfxpath )
set udg_zz_sfx_cleanup_counter = udg_zz_sfx_cleanup_counter + 1
elseif( pattern == 3 ) then
set udg_zz_effects_to_cleanup[udg_zz_sfx_cleanup_counter] = AddSpecialEffectLocBJ( OffsetLocation(mytarget, GetRandomReal(ndistance, distance), GetRandomReal(ndistance, distance)), sfxpath )
set udg_zz_sfx_cleanup_counter = ( udg_zz_sfx_cleanup_counter )
elseif( pattern == 4 ) then
set udg_zz_effects_to_cleanup[udg_zz_sfx_cleanup_counter] = AddSpecialEffectLocBJ( PolarProjectionBJ( mytarget, distance, GetRandomReal(0, 360) ), sfxpath )
set udg_zz_sfx_cleanup_counter = ( udg_zz_sfx_cleanup_counter )
endif
endfunction
function sfxr takes integer pattern, integer distance, integer times, integer delay, string sfxpath returns nothing
set udg_zz_sfx_active[udg_zz_sfx_repeater_counter] = true
set udg_zz_patterns[udg_zz_sfx_repeater_counter] = pattern
set udg_zz_distances[udg_zz_sfx_repeater_counter] = distance
set udg_zz_times[udg_zz_sfx_repeater_counter] = times
set udg_zz_times_counters[udg_zz_sfx_repeater_counter] = 0
set udg_zz_delays_counters[udg_zz_sfx_repeater_counter] = delay - 1
set udg_zz_delays[udg_zz_sfx_repeater_counter] = delay
set udg_zz_paths[udg_zz_sfx_repeater_counter] = sfxpath
set udg_zz_targets[udg_zz_sfx_repeater_counter] = udg_aa_sfx_target
set udg_zz_sfx_repeater_counter = udg_zz_sfx_repeater_counter + 1
endfunction
function sfx takes integer pattern, integer distance, string sfxpath returns nothing
call zz_sfx_at_loc( pattern, distance, udg_aa_sfx_target, sfxpath )
endfunction
function zz_sfx_repeater_actions takes nothing returns nothing
local integer j = 0
loop
exitwhen j >= udg_zz_sfx_repeater_counter
if ( udg_zz_sfx_active[j] == true ) then
set udg_zz_delays_counters[j] = udg_zz_delays_counters[j] + 1
if ( udg_zz_delays_counters[j] >= udg_zz_delays[j]) then
call zz_sfx_at_loc ( udg_zz_patterns[j], udg_zz_distances[j], udg_zz_targets[j], udg_zz_paths[j])
set udg_zz_delays_counters[j] = 0
set udg_zz_times_counters[j] = udg_zz_times_counters[j] + 1
endif
endif
if ( udg_zz_times_counters[j] >= udg_zz_times[j]) then
set udg_zz_sfx_active[j] = false
endif
set j = j + 1
endloop
endfunction
function zz_init_sfx_repeater takes nothing returns nothing
set udg_j = 0
set udg_zz_sfx_repeater = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( udg_zz_sfx_repeater, 0.20 )
call TriggerAddAction( udg_zz_sfx_repeater, function zz_sfx_repeater_actions )
loop
exitwhen (udg_j >= udg_zz_SAFE_TO_CLEANUP_SIZE)
set udg_zz_safe_to_cleanup[udg_j] = true
set udg_j = udg_j + 1
endloop
endfunction
function zz_sfx_cleanup_actions takes nothing returns nothing
local integer j = 0
if ( canclean() ) then
loop
exitwhen j >= udg_zz_sfx_cleanup_counter
call DestroyEffectBJ( udg_zz_effects_to_cleanup[j] )
set j = j + 1
endloop
set udg_zz_sfx_cleanup_counter = 0
endif
endfunction
function zz_init_sfx_cleanup takes nothing returns nothing
set udg_zz_sfx_cleanup = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( udg_zz_sfx_cleanup, 4.00 )
call TriggerAddAction( udg_zz_sfx_cleanup, function zz_sfx_cleanup_actions )
endfunction
function zz_init_map takes nothing returns nothing
set udg_zz_SAFE_TO_CLEANUP_SIZE = 21
call zz_init_sfx_repeater()
call zz_init_sfx_cleanup()
endfunction
Name | Type | is_array | initial_value |
aa_sfx_target | location | No | |
am1group | group | No | |
am2group | group | No | |
am2hero | unit | No | |
ang | real | No | |
balance_controller | player | No | |
bandit_lord | unit | No | |
bandits_beaten | boolean | No | |
banditsxp | group | No | |
barb_name | string | No | Scorch |
barbarian | unit | No | |
bb_a | integer | No | |
bb_jump_ability | abilcode | No | |
bb_jump_double | unit | No | |
books_found | integer | No | |
cyclonewand | group | No | |
day | boolean | No | true |
death | integer | No | 50 |
debug | integer | No | |
difficulty | integer | No | 2 |
difficulty_selection_allowed | boolean | No | |
easy_life_boost | real | No | 150.00 |
ec_angle_adjust | real | No | |
ec_angles | real | Yes | |
ec_counter | integer | No | |
ec_loops | integer | No | |
ec_maxcount | integer | No | |
ec_pantime | real | No | |
ec_points | location | Yes | |
ec_startangle | real | No | |
ec_waittime | real | No | |
ec_zboost | real | No | |
final_baddies | group | No | |
fire_mage | unit | No | |
fire_mage_name | string | No | Arius The Flame |
fire_mage_target_unit | unit | No | |
firetrap_dmg | real | No | |
fn_abil | abilcode | No | |
ghost_sis | unit | No | |
gold_coin_group | group | No | |
grave1group | group | No | |
grave2group | group | No | |
grave2wait | real | No | 120.00 |
grave_rain | weathereffect | No | |
handicap | real | No | |
have_axe | boolean | No | |
hero_revive_group | group | No | |
hero_sel_after_spell | boolean | Yes | true |
hero_selec_vis | fogmodifier | Yes | |
heroes | group | No | |
heroes_array | unit | Yes | |
heros_selected | real | No | |
ice_mage | unit | No | |
ice_mage_local_target_2 | location | No | |
ice_mage_local_target_point | location | No | |
ice_mage_name | string | No | Mira Iceweaver |
ice_mage_target_unit | unit | No | |
id_claritypot | group | No | |
id_manascroll | group | No | |
intro_voting | boolean | Yes | |
j | integer | No | |
lightningwand | group | No | |
mayor | unit | No | |
MountainGiantChampion | unit | No | UnitNull |
ninja | unit | No | |
ninja_name | string | No | Eldin Nightshade |
num_heroes_picked | integer | Yes | |
num_heroes_picked_max | integer | Yes | 1 |
ogrexpgroup | group | No | |
old_cam | camerasetup | Yes | |
ORC_SPAWN_WAIT | real | No | 0.25 |
p | player | No | |
pirate | unit | No | |
players | force | No | |
r | rect | No | |
roarscroll | group | No | |
roots | boolean | No | |
rumble_quest | quest | No | |
runegroup | group | No | |
runehero | unit | No | |
SGwait | real | No | 4.50 |
skip_intro | boolean | No | |
SPAWN_WAIT_TIME | real | No | 0.50 |
spell_levels | integer | Yes | |
spider_fangs | boolean | No | |
spiderxpgroup | group | No | |
stand_mana_drain_ani | unit | No | |
starting_gold | integer | No | 875 |
talktome | effect | Yes | |
temploc | location | No | |
timer | integer | No | |
trollxpgroup | group | No | |
unselect_group | group | No | |
ut | unitcode | No | |
uu_intro_ances_1 | unit | No | |
uu_intro_ances_2 | unit | No | |
valley_open | boolean | No | |
vv_doom_target | unit | No | |
vv_fbfs_ability | abilcode | No | |
vv_fbfsbeingcast | boolean | No | |
vv_flamepulsebeingcast | boolean | No | |
vv_fp_dmg | real | No | |
warstomp_closest_hero | unit | No | |
warstomp_dist | real | No | |
warstomp_next_dist | real | No | |
weeds | boolean | No | |
witch_quest_active | boolean | No | |
witch_quest_done | boolean | No | |
witchmonsters | unit | Yes | |
ww_bwe_unit | unitcode | No | |
ww_freeze_dude | unit | No | |
ww_freeze_target | unit | No | |
ww_mfn_range | real | No | 500.00 |
ww_mfn_targets | group | No | |
ww_mfn_weather | weathereffect | No | |
xpchecker | boolean | Yes | |
yy_helper_caster_player | player | No | |
yy_helper_casters | group | No | |
zz_delays | integer | Yes | |
zz_delays_counters | integer | Yes | |
zz_distances | integer | Yes | |
zz_effects_to_cleanup | effect | Yes | |
zz_paths | string | Yes | |
zz_patterns | integer | Yes | |
zz_safe_to_cleanup | boolean | Yes | true |
zz_SAFE_TO_CLEANUP_SIZE | integer | No | |
zz_sfx_active | boolean | Yes | |
zz_sfx_cleanup | trigger | No | |
zz_sfx_cleanup_counter | integer | No | 0 |
zz_sfx_repeater | trigger | No | |
zz_sfx_repeater_counter | integer | No | |
zz_targets | location | Yes | |
zz_times | integer | Yes | |
zz_times_counters | integer | Yes |
function setzchild takes nothing returns nothing
call SetCameraFieldForPlayer( GetEnumPlayer(), CAMERA_FIELD_ZOFFSET, ( GetLocationZ (udg_temploc) + udg_ec_zboost ), 0 )
endfunction
function Trig_set_z_Actions takes nothing returns nothing
set udg_temploc = GetCameraEyePositionLoc()
//set udg_temploc = GetCameraTargetPositionLoc()
call ForForce( udg_players, function setzchild )
call RemoveLocation(udg_temploc)
set udg_temploc = null
endfunction
//===========================================================================
function InitTrig_set_z takes nothing returns nothing
set gg_trg_set_z = CreateTrigger( )
call TriggerAddAction( gg_trg_set_z, function Trig_set_z_Actions )
endfunction
function Trig_setup_end_Actions takes nothing returns nothing
local integer i = 0
local integer numpoints = 60
local real jump = ( 360.00 / I2R(numpoints) )
local real dist = 5000
local real angle
local real tmp
set udg_ec_counter = 0
set udg_ec_maxcount = 60
set udg_ec_pantime = .65
set udg_ec_waittime = .4
set udg_ec_zboost = 350
set udg_ec_loops = 1
loop
exitwhen i >= numpoints
set tmp = I2R(i) * jump + udg_ec_angle_adjust + udg_ec_startangle
if tmp >= 360 then
set tmp = tmp - 360
endif
if tmp >= 360 then
set tmp = tmp - 360
endif
set udg_ec_angles[i] = tmp
set tmp = udg_ec_startangle + I2R(i) * jump
if tmp >= 360 then
set tmp = tmp - 360
endif
if tmp >= 360 then
set tmp = tmp - 360
endif
set tmp = tmp * bj_DEGTORAD
set udg_ec_points[i] = Location(dist * Cos(tmp) , dist * Sin(tmp) )
set i = i + 1
endloop
call TriggerRegisterTimerEventPeriodic( gg_trg_set_z, 0.03 )
endfunction
//===========================================================================
function InitTrig_setup_end takes nothing returns nothing
set gg_trg_setup_end = CreateTrigger( )
call TriggerAddAction( gg_trg_setup_end, function Trig_setup_end_Actions )
endfunction
function Trig_death_number_cleanup_Func001Func001Func001C takes nothing returns boolean
if ( not ( GetUnitUserData(GetEnumUnit()) == udg_death ) ) then
return false
endif
return true
endfunction
function Trig_death_number_cleanup_Func001Func001A takes nothing returns nothing
if ( Trig_death_number_cleanup_Func001Func001Func001C() ) then
call RemoveUnit( GetEnumUnit() )
else
endif
endfunction
function Trig_death_number_cleanup_Actions takes nothing returns nothing
if ( canclean() ) then
call ForGroupBJ( GetUnitsInRectOfPlayer(GetPlayableMapRect(), udg_yy_helper_caster_player), function Trig_death_number_cleanup_Func001Func001A )
else
endif
endfunction
//===========================================================================
function InitTrig_death_number_cleanup takes nothing returns nothing
set gg_trg_death_number_cleanup = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_death_number_cleanup, 7.07 )
call TriggerAddAction( gg_trg_death_number_cleanup, function Trig_death_number_cleanup_Actions )
endfunction
function Trig_shade_cleanup_2_helper takes nothing returns nothing
call KillUnit( GetEnumUnit() )
call RemoveUnit( GetEnumUnit() )
endfunction
function Trig_shade_cleanup_2_Actions takes nothing returns nothing
if ( canclean() ) then
call ForGroupBJ( GetUnitsOfTypeIdAll('u000'), function Trig_shade_cleanup_2_helper )
endif
endfunction
//===========================================================================
function InitTrig_shade_cleanup takes nothing returns nothing
set gg_trg_shade_cleanup = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_shade_cleanup, 10.07 )
call TriggerAddAction( gg_trg_shade_cleanup, function Trig_shade_cleanup_2_Actions )
endfunction
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
call UnitAddAbilityBJ( 'Aabs', GetTriggerUnit() )
call UnitRemoveAbilityBJ( 'AHbh', GetTriggerUnit() )
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
function Trig_stomp_levs_Conditions takes nothing returns boolean
if ( not ( GetLearnedSkillBJ() == 'A00Q' ) ) then
return false
endif
return true
endfunction
function Trig_stomp_levs_Func002C takes nothing returns boolean
if ( not ( udg_spell_levels[3] == 1 ) ) then
return false
endif
return true
endfunction
function Trig_stomp_levs_Func003C takes nothing returns boolean
if ( not ( udg_spell_levels[3] == 2 ) ) then
return false
endif
return true
endfunction
function Trig_stomp_levs_Func004C takes nothing returns boolean
if ( not ( udg_spell_levels[3] == 3 ) ) then
return false
endif
return true
endfunction
function Trig_stomp_levs_Actions takes nothing returns nothing
set udg_spell_levels[3] = ( udg_spell_levels[3] + 1 )
if ( Trig_stomp_levs_Func002C() ) then
set udg_bb_jump_ability = 'A00O'
else
endif
if ( Trig_stomp_levs_Func003C() ) then
set udg_bb_jump_ability = 'A00N'
else
endif
if ( Trig_stomp_levs_Func004C() ) then
set udg_bb_jump_ability = 'A00P'
else
endif
endfunction
//===========================================================================
function InitTrig_stomp_levs takes nothing returns nothing
set gg_trg_stomp_levs = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_stomp_levs, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_stomp_levs, Condition( function Trig_stomp_levs_Conditions ) )
call TriggerAddAction( gg_trg_stomp_levs, function Trig_stomp_levs_Actions )
endfunction
function qqTrig_Untitled_Trigger_001_Conditions takes nothing returns boolean
if ( not ( GetLearnedSkillBJ() == 'A00M' ) ) then
return false
endif
return true
endfunction
function qqTrig_Untitled_Trigger_001_Actions takes nothing returns nothing
set udg_spell_levels[2] = udg_spell_levels[2] + 1
if ( udg_spell_levels[2] == 1 ) then
set udg_vv_fp_dmg = 135
endif
if ( udg_spell_levels[2] == 2 ) then
set udg_vv_fp_dmg = 245
endif
if ( udg_spell_levels[2] == 3 ) then
set udg_vv_fp_dmg = 400
endif
endfunction
//===========================================================================
function InitTrig_fp_levs takes nothing returns nothing
set gg_trg_fp_levs = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_fp_levs, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_fp_levs, Condition( function qqTrig_Untitled_Trigger_001_Conditions ) )
call TriggerAddAction( gg_trg_fp_levs, function qqTrig_Untitled_Trigger_001_Actions )
endfunction
function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean
if ( not ( GetLearnedSkillBJ() == 'A000' ) ) then
return false
endif
return true
endfunction
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
set udg_spell_levels[0] = udg_spell_levels[0] + 1
if ( udg_spell_levels[0] == 1 ) then
set udg_vv_fbfs_ability = 'A002'
endif
if ( udg_spell_levels[0] == 2 ) then
set udg_vv_fbfs_ability = 'A003'
endif
if ( udg_spell_levels[0] == 3 ) then
set udg_vv_fbfs_ability = 'A001'
endif
endfunction
//===========================================================================
function InitTrig_fbfs_levs takes nothing returns nothing
set gg_trg_fbfs_levs = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_fbfs_levs, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_fbfs_levs, Condition( function Trig_Untitled_Trigger_001_Conditions ) )
call TriggerAddAction( gg_trg_fbfs_levs, function Trig_Untitled_Trigger_001_Actions )
endfunction
function Trig_Mass_Frost_Nova_Level_up_Conditions takes nothing returns boolean
if ( not ( GetLearnedSkillBJ() == 'A007' ) ) then
return false
endif
return true
endfunction
function Trig_Mass_Frost_Nova_Level_up_Actions takes nothing returns nothing
set udg_spell_levels[1] = udg_spell_levels[1] + 1
if ( udg_spell_levels[1] == 1 ) then
set udg_ww_mfn_range = 150
endif
if ( udg_spell_levels[1] == 2 ) then
set udg_ww_mfn_range = 190
endif
if ( udg_spell_levels[1] == 3 ) then
set udg_ww_mfn_range = 225
endif
endfunction
//===========================================================================
function InitTrig_mfn_levs takes nothing returns nothing
set gg_trg_mfn_levs = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_mfn_levs, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_mfn_levs, Condition( function Trig_Mass_Frost_Nova_Level_up_Conditions ) )
call TriggerAddAction( gg_trg_mfn_levs, function Trig_Mass_Frost_Nova_Level_up_Actions )
endfunction
function qqTrig_Mass_Frost_Nova_Level_up_Conditions takes nothing returns boolean
if ( not ( GetLearnedSkillBJ() == 'A004' ) ) then
return false
endif
return true
endfunction
function qqTrig_Mass_Frost_Nova_Level_up_Actions takes nothing returns nothing
set udg_spell_levels[4] = udg_spell_levels[2] + 1
if ( udg_spell_levels[4] == 1 ) then
set udg_ww_bwe_unit = 'h003'
endif
if ( udg_spell_levels[4] == 2 ) then
set udg_ww_bwe_unit = 'h004'
endif
if ( udg_spell_levels[4] == 3 ) then
set udg_ww_bwe_unit = 'h005'
endif
endfunction
//===========================================================================
function InitTrig_bwe_levs takes nothing returns nothing
set gg_trg_bwe_levs = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_bwe_levs, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_bwe_levs, Condition( function qqTrig_Mass_Frost_Nova_Level_up_Conditions ) )
call TriggerAddAction( gg_trg_bwe_levs, function qqTrig_Mass_Frost_Nova_Level_up_Actions )
endfunction