- Joined
- Sep 22, 2012
- Messages
- 90
i have been triggering a somewhat similar spell of war2 death coil,
a projectile that hits 3 targets and heals the caster upon the damage dealt:
i tried to imitate the spell and somehow it works fine. the problem is that
when cast rapidly by multiple units my task_manager shows me
that war3.exe has consumed 400,000+ kilobytes.
here are my triggers:
(P.S. my said spell/trigger is mui)
I can't tell if its something caused by runtime stuff/ too many for loops
inside or maybe i am leaking some of it.
the loop
a projectile that hits 3 targets and heals the caster upon the damage dealt:
i tried to imitate the spell and somehow it works fine. the problem is that
when cast rapidly by multiple units my task_manager shows me
that war3.exe has consumed 400,000+ kilobytes.
here are my triggers:
(P.S. my said spell/trigger is mui)
I can't tell if its something caused by runtime stuff/ too many for loops
inside or maybe i am leaking some of it.
the loop
-
missileLOOP
-
Events
- Time - missile_rocket_TIMER expires
- Conditions
-
Actions
- -------- crosshair LOOP --------
-
For each (Integer missile_cross_ITER) from 1 to missile_cross_count, do (Actions)
-
Loop - Actions
- -------- find casting unit --------
- Set missile_cross_ITER_tempint = 0
-
For each (Integer missile_cross_ITER_findcaster) from 1 to A_ALLUNITS_count, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- missile_cross_caster[missile_cross_ITER] Equal to A_ALLUNITS_ID[missile_cross_ITER_findcaster]
-
Then - Actions
- Set missile_cross_ITER_tempint = missile_cross_ITER_findcaster
- Set missile_cross_ITER_findcaster = 999
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- -------- instance terminate --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- missile_cross_maxtargets[missile_cross_ITER] Greater than or equal to 3
- missile_cross_disp[missile_cross_ITER] Greater than or equal to 1200.00
- missile_cross_ITER_tempint Equal to 0
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
- Unit - Kill missile_cross_crosshairs[missile_cross_ITER]
- -------- CLEAR dt stack --------
-
For each (Integer missile_dt_verify) from 1 to missile_dt_count, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- missile_cross_spellid[missile_cross_ITER] Equal to missile_dt_spellID[missile_dt_verify]
-
Then - Actions
- -------- copy --------
- Set missile_dt_spellID[missile_dt_verify] = 0
- Set missile_dt_targets[missile_dt_verify] = 0
- -------- nulify --------
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- -------- copy --------
- Set missile_cross_crosshairs[missile_cross_ITER] = missile_cross_crosshairs[missile_cross_count]
- Set missile_cross_angle[missile_cross_ITER] = missile_cross_angle[missile_cross_count]
- Set missile_cross_disp[missile_cross_ITER] = missile_cross_disp[missile_cross_count]
- Set missile_cross_maxtargets[missile_cross_ITER] = missile_cross_maxtargets[missile_cross_count]
- Set missile_cross_spellid[missile_cross_ITER] = missile_cross_spellid[missile_cross_count]
- Set missile_cross_caster[missile_cross_ITER] = missile_cross_caster[missile_cross_count]
- Set missile_cross_owner[missile_cross_ITER] = missile_cross_owner[missile_cross_count]
- -------- nullify --------
- Set missile_cross_crosshairs[missile_cross_count] = No unit
- Set missile_cross_angle[missile_cross_count] = 0.00
- Set missile_cross_disp[missile_cross_count] = 0.00
- Set missile_cross_maxtargets[missile_cross_count] = 0
- Set missile_cross_owner[missile_cross_count] = 0
- Set missile_cross_caster[missile_cross_count] = 0
- Set missile_cross_spellid[missile_cross_count] = 0
- Set missile_cross_count = (missile_cross_count - 1)
- -------- update dt table --------
- Else - Actions
-
If - Conditions
- -------- do something with current instance --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- missile_cross_maxtargets[missile_cross_ITER] Greater than or equal to 3
- missile_cross_disp[missile_cross_ITER] Greater than or equal to 1200.00
- missile_cross_ITER_tempint Equal to 0
-
Conditions
-
Or - Any (Conditions) are true
- Then - Actions
-
Else - Actions
- -------- move_missile_crosshair --------
- Set missile_loc_a = (Position of missile_cross_crosshairs[missile_cross_ITER])
- Set missile_loc_b = (missile_loc_a offset by missile_config_k_speed towards missile_cross_angle[missile_cross_ITER] degrees)
- Unit - Move missile_cross_crosshairs[missile_cross_ITER] instantly to missile_loc_b
- Set missile_cross_disp[missile_cross_ITER] = (missile_cross_disp[missile_cross_ITER] + missile_config_k_speed)
- -------- pick_targets --------
-
For each (Integer missile_cross_ITER_findtargets) from 1 to A_ALLUNITS_count, do (Actions)
-
Loop - Actions
- Set missile_cross_ITER_tempreal = 0.00
- Set missile_loc_c = (Position of A_ALLUNITS_UNITS[missile_cross_ITER_findtargets])
- Set missile_cross_ITER_tempreal = (Distance between missile_loc_b and missile_loc_c)
- Custom script: call RemoveLocation(udg_missile_loc_c)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- missile_cross_owner[missile_cross_ITER] Not equal to A_ALLUNITS_OWNER[missile_cross_ITER_findtargets]
- missile_cross_ITER_tempreal Less than or equal to missile_config_k_col_radius
-
Then - Actions
- Set missile_dt_count = (missile_dt_count + 1)
- Set missile_cross_if_found = False
-
For each (Integer missile_dt_verify) from 1 to missile_dt_count, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- A_ALLUNITS_ID[missile_cross_ITER_findtargets] Equal to missile_dt_targets[missile_dt_verify]
- missile_cross_spellid[missile_cross_ITER] Equal to missile_dt_spellID[missile_dt_verify]
-
Then - Actions
- Set missile_cross_if_found = True
- Set missile_dt_verify = A_A_BREAKER
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- missile_cross_if_found Equal to True
-
Then - Actions
- -------- if target id already exists for current spell instance --------
- -------- cancel the data insert on datatable --------
- Set missile_dt_spellID[missile_dt_count] = 0
- Set missile_dt_targets[missile_dt_count] = 0
- Set missile_dt_count = (missile_dt_count - 1)
-
Else - Actions
- -------- update DT first --------
- Set missile_dt_targets[missile_dt_count] = A_ALLUNITS_ID[missile_cross_ITER_findtargets]
- Set missile_dt_spellID[missile_dt_count] = missile_cross_spellid[missile_cross_ITER]
- -------- CREATE HOMING MISSILES --------
- Set missile_loc_d = (missile_loc_b offset by 600.00 towards (missile_cross_angle[missile_cross_ITER] + 180.00) degrees)
- Set rockets_count = (rockets_count + 1)
- Unit - Create 1 C_req_missiles for (Player(missile_cross_owner[missile_cross_ITER])) at missile_loc_d facing missile_cross_angle[missile_cross_ITER] degrees
- Custom script: call RemoveLocation(udg_missile_loc_d)
- Set rockets_rocket_rocket[rockets_count] = (Last created unit)
- Unit - Add Crow Form to rockets_rocket_rocket[rockets_count]
- Animation - Change rockets_rocket_rocket[rockets_count] flying height to 50.00 at 1000000000.00
- Animation - Change rockets_rocket_rocket[rockets_count]'s animation speed to 150.00% of its original speed
- Unit - Turn collision for rockets_rocket_rocket[rockets_count] Off
- Unit - Move rockets_rocket_rocket[rockets_count] instantly to missile_loc_d
- Set rockets_rocket_target[rockets_count] = A_ALLUNITS_ID[missile_cross_ITER_findtargets]
- -------- update max targets --------
- Set missile_cross_maxtargets[missile_cross_ITER] = (missile_cross_maxtargets[missile_cross_ITER] + 1)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- missile_cross_maxtargets[missile_cross_ITER] Greater than or equal to 3
-
Then - Actions
- Set missile_cross_ITER_findtargets = A_A_BREAKER
- Else - Actions
-
If - Conditions
- Else - Actions
-
If - Conditions
-
Loop - Actions
- Set missile_cross_ITER_tempint = 0
- Custom script: call RemoveLocation(udg_missile_loc_b)
- Custom script: call RemoveLocation(udg_missile_loc_a)
-
If - Conditions
-
Loop - Actions
- -------- ROCKETS lock loop --------
-
For each (Integer rockets_ITER) from 1 to rockets_count, do (Actions)
-
Loop - Actions
- -------- find exact location of target on the map --------
- Set rockets_bool_found_targetindex = 0
-
For each (Integer rockets_init_find) from 1 to A_ALLUNITS_count, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- rockets_rocket_target[rockets_ITER] Equal to A_ALLUNITS_ID[rockets_init_find]
-
Then - Actions
- Set rockets_bool_found_targetindex = rockets_init_find
- Set rockets_init_find = A_A_BREAKER
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- -------- TERMINATING CONDITIONS FOR CURRENT INSTANCE --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- rockets_bool_found_targetindex Equal to 0
-
Then - Actions
- Set rockets_rocket_target[rockets_ITER] = 0
- Else - Actions
-
If - Conditions
- -------- rocket iterator --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- rockets_rocket_target[rockets_ITER] Equal to 0
-
Then - Actions
- Unit - Kill rockets_rocket_rocket[rockets_ITER]
- -------- copy --------
- Set rockets_rocket_rocket[rockets_ITER] = rockets_rocket_rocket[rockets_count]
- Set rockets_rocket_target[rockets_ITER] = rockets_rocket_target[rockets_count]
- -------- nullify --------
- Set rockets_rocket_target[rockets_count] = 0
- -------- reduce --------
- Set rockets_count = (rockets_count - 1)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- rockets_rocket_target[rockets_ITER] Equal to 0
- Then - Actions
-
Else - Actions
- Set missile_loc_a = (Position of rockets_rocket_rocket[rockets_ITER])
- Set missile_loc_b = (Position of A_ALLUNITS_UNITS[rockets_bool_found_targetindex])
- Set rockets_ITER_tempreal = 0.00
- Set rockets_ITER_tempreal = (Angle from missile_loc_a to missile_loc_b)
- Set missile_loc_c = (missile_loc_a offset by rockets_config_k_speed towards rockets_ITER_tempreal degrees)
- Unit - Move rockets_rocket_rocket[rockets_ITER] instantly to missile_loc_c, facing rockets_ITER_tempreal degrees
- Set rockets_ITER_tempreal = 0.00
- Set rockets_ITER_tempreal = (Distance between missile_loc_a and missile_loc_b)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- rockets_ITER_tempreal Less than rockets_config_k_colradius
-
Then - Actions
- Set rockets_rocket_target[rockets_ITER] = 0
- Else - Actions
-
If - Conditions
- Custom script: call RemoveLocation(udg_missile_loc_c)
- Custom script: call RemoveLocation(udg_missile_loc_b)
- Custom script: call RemoveLocation(udg_missile_loc_a)
-
If - Conditions
-
Loop - Actions
- -------- MISSILE/ROCKET loop terminator --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- missile_cross_count Equal to 0
- rockets_count Equal to 0
-
Then - Actions
- Set missile_dt_count = 0
- Set missile_INIT_spellid_create = 0
- Game - Display to (All players) the text: missile off
- Trigger - Turn off missileLOOP <gen>
- Else - Actions
-
If - Conditions
-
Events
-
missileCAST
-
Events
- Unit - A unit Finishes casting an ability
-
Conditions
- (Ability being cast) Equal to C_/req_missiles
-
Actions
- Set missile_init_caster = (Casting unit)
- Set missile_init_loc = (Position of missile_init_caster)
-
For each (Integer missile_find_caster) from 1 to A_ALLUNITS_count, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- missile_init_caster Equal to A_ALLUNITS_UNITS[missile_find_caster]
-
Then - Actions
- -------- create rare number fros crosshair --------
- Set missile_INIT_spellid_create = (missile_INIT_spellid_create + 1)
- -------- create crosshairs --------
- Unit - Create 1 C_req_missiles (CROSSHAIR) for (Player(A_ALLUNITS_OWNER[missile_find_caster])) at missile_init_loc facing Default building facing degrees
- Set missile_cross_count = (missile_cross_count + 1)
- Set missile_cross_crosshairs[missile_cross_count] = (Last created unit)
- Unit - Add Crow Form to missile_cross_crosshairs[missile_cross_count]
- Animation - Change missile_cross_crosshairs[missile_cross_count] flying height to 50.00 at 1000000000.00
- Animation - Change missile_cross_crosshairs[missile_cross_ITER_tempint]'s animation speed to 10.00% of its original speed
- Unit - Turn collision for missile_cross_crosshairs[missile_cross_count] Off
- Unit - Move missile_cross_crosshairs[missile_cross_count] instantly to missile_init_loc
- Set missile_cross_angle[missile_cross_count] = A_ALLUNITS_ANGLE[missile_find_caster]
- Set missile_cross_disp[missile_cross_count] = 0.00
- Set missile_cross_maxtargets[missile_cross_count] = 0
- Set missile_cross_spellid[missile_cross_count] = missile_INIT_spellid_create
- Set missile_cross_caster[missile_cross_count] = A_ALLUNITS_ID[missile_find_caster]
- Set missile_cross_owner[missile_cross_count] = A_ALLUNITS_OWNER[missile_find_caster]
- Set missile_find_caster = A_A_BREAKER
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- Custom script: call RemoveLocation(udg_missile_init_loc)
- Set missile_init_caster = No unit
- Trigger - Turn on missileLOOP <gen>
-
Events
-
SYSTEMUPDATERslow
-
Events
- Time - A_SYS_TIMER_slow expires
- Conditions
-
Actions
- -------- ------------------------------------------------------------- --------
- -------- clear all skill data tables --------
- -------- ------------------------------------------------------------- --------
- -------- ROCKETS ---->--------
-
For each (Integer missile_dt_verify) from 1 to missile_dt_count, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- missile_dt_spellID[missile_dt_verify] Equal to 0
-
Then - Actions
- -------- copy --------
- Set missile_dt_spellID[missile_dt_verify] = missile_dt_spellID[missile_dt_count]
- Set missile_dt_targets[missile_dt_verify] = missile_dt_targets[missile_dt_count]
- -------- nulify --------
- Set missile_dt_spellID[missile_dt_count] = 0
- Set missile_dt_targets[missile_dt_count] = 0
- -------- reduce index --------
- Set missile_dt_count = (missile_dt_count - 1)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- -------- QUAKE ---->--------
-
For each (Integer quake_dt_init_verify) from 1 to quake_dt_count, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- quake_dt_targets_spellid[quake_dt_init_verify] Equal to 0
-
Then - Actions
- Set quake_dt_targets_id[quake_dt_init_verify] = quake_dt_targets_id[quake_dt_count]
- Set quake_dt_targets_spellid[quake_dt_init_verify] = quake_dt_targets_spellid[quake_dt_count]
- Set quake_dt_targets_id[quake_dt_count] = 0
- Set quake_dt_targets_spellid[quake_dt_count] = 0
- Set quake_dt_count = (quake_dt_count - 1)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- -------- ------------------------------------------------------------- --------
- -------- end clear --------
- -------- ------------------------------------------------------------- --------
-
Events