- Joined
- Sep 22, 2012
- Messages
- 90
I'm wondering about muis, I've tried to make my own custom buff and indexer in which stacks armor on my custom damage system (newbie system), damageapply=(damage - armor).
I've also tried to create my custom indexer and unit ID creator which uses an array of booleans and integers.
here are my trigger:
and here's my own custom buff :|
would this type of indexing be safe? are these triggers leakless?
please let me know :|
I've also tried to create my custom indexer and unit ID creator which uses an array of booleans and integers.
here are my trigger:
-
unitmaindies
-
Events
-
Unit - A unit Dies
-
-
Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
(Unit-type of (Dying unit)) Equal to Adept
-
(Unit-type of (Dying unit)) Equal to Enforcer
-
(Unit-type of (Dying unit)) Equal to Chemist
-
(Unit-type of (Dying unit)) Equal to Archer
-
-
-
-
Actions
-
Set A_ALLUNITS_tempunit = (Dying unit)
-
Set unit_has_main[(Player number of (Owner of A_ALLUNITS_tempunit))] = False
-
-------- find the data for the dying unit --------
-
For each (Integer A_recon_finder) 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
-
A_ALLUNITS_tempunit Equal to A_ALLUNITS_UNITS[A_recon_finder]
-
-
Then - Actions
-
Set A_recon_found_index = A_recon_finder
-
Set A_recon_finder = 101
-
-
Else - Actions
-
-
-
-
-------- > return back the id on the register --------
-
Set A_A_valid_IDS[A_ALLUNITS_ID[A_recon_found_index]] = False
-
-------- BRING / CARRY --------
-
Set A_ALLUNITS_UNITS[A_recon_found_index] = A_ALLUNITS_UNITS[A_ALLUNITS_count]
-
Set A_ALLUNITS_ARMOR[A_recon_found_index] = A_ALLUNITS_ARMOR[A_ALLUNITS_count]
-
Set A_ALLUNITS_SPEED[A_recon_found_index] = A_ALLUNITS_SPEED[A_ALLUNITS_count]
-
Set A_ALLUNITS_ID[A_recon_found_index] = A_ALLUNITS_ID[A_ALLUNITS_count]
-
Set A_ALLUNITS_count = (A_ALLUNITS_count - 1)
-
Set A_recon_found_index = 0
-
-
-
respawn
-
Events
-
Unit - A unit Dies
-
-
Conditions
-
(Unit-type of (Dying unit)) Equal to |Cffff0000Defeated
-
-
Actions
-
Set AAA_player_temp = (Player number of (Owner of (Dying unit)))
-
Set res_loc = (Random point in sanctuary <gen>)
-
Unit - Create 1 db_unit_pool[unit_class[AAA_player_temp]] for (Player(AAA_player_temp)) at res_loc facing 270.00 degrees
-
Unit - Move vector_cam_unit[AAA_player_temp] instantly to res_loc
-
Selection - Select (Last created unit) for (Owner of (Dying unit))
-
Set unit_main[AAA_player_temp] = (Last created unit)
-
Set unit_has_main[AAA_player_temp] = True
-
-------- add data --------
-
Set A_ALLUNITS_count = (A_ALLUNITS_count + 1)
-
Set A_ALLUNITS_UNITS[A_ALLUNITS_count] = unit_main[AAA_player_temp]
-
Set A_ALLUNITS_ARMOR[A_ALLUNITS_count] = db_unit_armor[unit_class[AAA_player_temp]]
-
Set A_ALLUNITS_SPEED[A_ALLUNITS_count] = db_unit_speeds[unit_class[AAA_player_temp]]
-
-------- find and assign a valid id to created unit --------
-
For each (Integer A_A_ID_finder) from 1 to 100, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
A_A_valid_IDS[A_A_ID_finder] Equal to False
-
-
Then - Actions
-
Set A_A_found_ID = A_A_ID_finder
-
-------- give the id to someone --------
-
Set A_ALLUNITS_ID[A_ALLUNITS_count] = A_A_found_ID
-
-------- turn on the id on our tally --------
-
Set A_A_valid_IDS[A_A_found_ID] = True
-
-------- exitloop --------
-
Set A_A_ID_finder = 101
-
-
Else - Actions
-
-
-
-
-------- clear --------
-
Custom script: call RemoveLocation(udg_res_loc)
-
Set AAA_player_temp = 0
-
-
-
armorINIT
-
Events
-
Unit - A unit Finishes casting an ability
-
-
Conditions
-
(Ability being cast) Equal to /req_armor
-
-
Actions
-
Set bad_armor_caster = (Casting unit)
-
Unit - Cause bad_armor_caster to damage bad_armor_caster, dealing 10.00 damage of attack type Normal and damage type Universal
-
Set bad_armor_caster_loc = (Position of bad_armor_caster)
-
-------- create new instance --------
-
Set bad_armor_counter = (bad_armor_counter + 1)
-
-------- find id of caster --------
-
For each (Integer bad_armor_init_cycle) 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
-
bad_armor_caster Equal to A_ALLUNITS_UNITS[bad_armor_init_cycle]
-
-
Then - Actions
-
Set bad_armor_found = bad_armor_init_cycle
-
-------- exit loop --------
-
Set bad_armor_init_cycle = (A_ALLUNITS_count + 1)
-
-
Else - Actions
-
-
-
-
-------- finally add the armor to our caster --------
-
Set bad_armor_target_id[bad_armor_counter] = A_ALLUNITS_ID[bad_armor_found]
-
Set bad_armor_each_duration[bad_armor_counter] = 0.00
-
Set bad_armor_each_flag[bad_armor_counter] = True
-
For each (Integer bad_armor_particle_cycle) from 0 to 2, do (Actions)
-
Loop - Actions
-
Set bad_armor_caster_TEMP_angle = ((Real(bad_armor_particle_cycle)) x 120.00)
-
Set bad_armor_caster_cycle_loc = (bad_armor_caster_loc offset by 80.00 towards bad_armor_caster_TEMP_angle degrees)
-
Unit - Create 1 _req_sheilds for (Owner of bad_armor_caster) at bad_armor_caster_cycle_loc facing bad_armor_caster_TEMP_angle degrees
-
Unit - Add Crow Form to (Last created unit)
-
Animation - Change (Last created unit) flying height to 20.00 at 1000000000.00
-
Unit - Turn collision for (Last created unit) Off
-
Set bad_armor_particles[((bad_armor_counter x 3) + bad_armor_particle_cycle)] = (Last created unit)
-
Custom script: call RemoveLocation(udg_bad_armor_caster_cycle_loc)
-
Set bad_armor_caster_TEMP_angle = 0.00
-
-
-
Set bad_armor_found = 0
-
Custom script: call RemoveLocation(udg_bad_armor_caster_loc)
-
Custom script: set udg_bad_armor_caster = null
-
Trigger - Turn on armorLOOP <gen>
-
Trigger - Run armorLOOP <gen> (ignoring conditions)
-
-
-
armorLOOP
-
Events
-
Time - bad_armor_TIMER expires
-
-
Conditions
-
Actions
-
Countdown Timer - Start bad_armor_TIMER as a Repeating timer that will expire in 0.03 seconds
-
-------- loop through instances --------
-
For each (Integer bad_armor_looper) from 1 to bad_armor_counter, do (Actions)
-
Loop - Actions
-
Set bad_armor_ALLOW = False
-
-------- find caster id --------
-
For each (Integer bad_armor_LOCAL_finder) 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
-
bad_armor_target_id[bad_armor_looper] Equal to A_ALLUNITS_ID[bad_armor_LOCAL_finder]
-
-
Then - Actions
-
Set bad_armor_found = bad_armor_LOCAL_finder
-
Set bad_armor_ALLOW = True
-
Set bad_armor_LOCAL_finder = 101
-
-
Else - Actions
-
-
-
-
-------- if the id is not found then that unit is DEAD on our ALLUNITS_db --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
bad_armor_ALLOW Equal to True
-
bad_armor_each_duration[bad_armor_looper] Less than or equal to bad_armor_k_duration
-
-
Then - Actions
-
-------- update the duration of instance --------
-
Set bad_armor_each_duration[bad_armor_looper] = (bad_armor_each_duration[bad_armor_looper] + 0.03)
-
-------- flag the instance boolean AND change the armor to max!!! --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
bad_armor_each_flag[bad_armor_looper] Equal to True
-
-
Then - Actions
-
Set A_ALLUNITS_ARMOR[bad_armor_found] = (A_ALLUNITS_ARMOR[bad_armor_found] + 3.00)
-
Set bad_armor_each_flag[bad_armor_looper] = False
-
-
Else - Actions
-
-
-------- move/draw the particles --------
-
Set bad_armor_looper_from_loc = (Position of A_ALLUNITS_UNITS[bad_armor_found])
-
For each (Integer bad_armor_paticle_looper) from 0 to 2, do (Actions)
-
Loop - Actions
-
Set bad_armor_LOCAL_particle = bad_armor_particles[((bad_armor_looper x 3) + bad_armor_paticle_looper)]
-
Set bad_armor_LOCAL_angle = (Facing of bad_armor_LOCAL_particle)
-
Set bad_armor_LOCAL_angle = (bad_armor_LOCAL_angle + 90.00)
-
Set bad_armor_looper_to_loc = (bad_armor_looper_from_loc offset by 3.00 towards bad_armor_LOCAL_angle degrees)
-
Unit - Move bad_armor_LOCAL_particle instantly to bad_armor_looper_to_loc, facing bad_armor_LOCAL_angle degrees
-
Custom script: call RemoveLocation(udg_bad_armor_looper_to_loc)
-
Set bad_armor_LOCAL_angle = 0.00
-
Custom script: set udg_bad_armor_LOCAL_particle = null
-
-
-
Custom script: call RemoveLocation(udg_bad_armor_looper_from_loc)
-
-
Else - Actions
-
-------- carry/ reduce array --------
-
Unit - Kill bad_armor_particles[((bad_armor_looper x 3) + 0)]
-
Unit - Kill bad_armor_particles[((bad_armor_looper x 3) + 1)]
-
Unit - Kill bad_armor_particles[((bad_armor_looper x 3) + 2)]
-
Set A_ALLUNITS_ARMOR[bad_armor_found] = (A_ALLUNITS_ARMOR[bad_armor_found] - 3.00)
-
Set bad_armor_particles[((bad_armor_looper x 3) + 0)] = bad_armor_particles[((bad_armor_counter x 3) + 0)]
-
Set bad_armor_particles[((bad_armor_looper x 3) + 1)] = bad_armor_particles[((bad_armor_counter x 3) + 1)]
-
Set bad_armor_particles[((bad_armor_looper x 3) + 2)] = bad_armor_particles[((bad_armor_counter x 3) + 2)]
-
Set bad_armor_each_duration[bad_armor_looper] = bad_armor_each_duration[bad_armor_counter]
-
Set bad_armor_each_flag[bad_armor_looper] = bad_armor_each_flag[bad_armor_counter]
-
Set bad_armor_target_id[bad_armor_looper] = bad_armor_target_id[bad_armor_counter]
-
Set bad_armor_counter = (bad_armor_counter - 1)
-
-
-
Set bad_armor_found = 0
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
bad_armor_counter Less than or equal to 0
-
-
Then - Actions
-
Game - Display to (All players) the text: armor off
-
Trigger - Turn off armorLOOP <gen>
-
-
Else - Actions
-
-
-
-
-
please let me know :|
Last edited: