- Joined
- Mar 16, 2008
- Messages
- 1,032
This trigger runs frequently and by multiple players. Seems to work but worried it's not efficient.
-
demon dies
-

Events
-


Unit - A unit owned by Player 7 (Green) Dies
-


Unit - A unit owned by Player 11 (Dark Green) Dies
-


Unit - A unit owned by Player 12 (Brown) Dies
-


Unit - A unit owned by Player 17 (Wheat) Dies
-


Unit - A unit owned by Player 18 (Peach) Dies
-


Unit - A unit owned by Player 19 (Mint) Dies
-


Unit - A unit owned by Player 21 (Coal) Dies
-


Unit - A unit owned by Player 22 (Snow) Dies
-


Unit - A unit owned by Player 23 (Emerald) Dies
-


Unit - A unit owned by Player 24 (Peanut) Dies
-
-

Conditions
-


(Level of Legion Unit Class (Icon) for (Dying unit)) Equal to 1
-
-

Actions
-


Set VariableSet demon_kill_PN = (Player number of (Owner of (Killing unit)))
-


-------- count death for player --------
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




is_playing[demon_kill_PN] Equal to True
-
-



Then - Actions
-




Set VariableSet demon_kills[demon_kill_PN] = (demon_kills[demon_kill_PN] + 1)
-
-



Else - Actions
-
-


-------- remove unit from group variable --------
-


Unit Group - Remove (Dying unit) from demon_grp.
-


Unit Group - Remove (Dying unit) from death_attk_demon_grp.
-


Unit Group - Remove (Dying unit) from demon_flyer.
-


-------- rolls a random number 1-100 --------
-


Set VariableSet loot_ran_num = (Random integer number between 1 and 100)
-


-------- sets point variable --------
-


Set VariableSet demon_death_pt = (Position of (Dying unit))
-


-------- checks roll output loot --------
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




loot_ran_num Less than 15
-




((Dying unit) is A structure) Equal to False
-
-



Then - Actions
-




Item - Create Mana Stone at demon_death_pt
-




Set VariableSet last_created_stone_mana = (Last created item)
-




-------- gives healing rune if difficulty to easy (1) or lower, also roll < 10 --------
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






loot_ran_num Less than 10
-






difficulty_setting Less than or equal to 2
-
-





Then - Actions
-






Item - Create Rune of Lesser Healing at demon_death_pt
-






Set VariableSet last_created_rune_hp = (Last created item)
-
-





Else - Actions
-
-




-------- uses/puts loot in inventory if hero --------
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






((Killing unit) is A Hero) Equal to True
-
-





Then - Actions
-






Hero - Give last_created_stone_mana to (Killing unit)
-






Hero - Give last_created_rune_hp to (Killing unit)
-






Set VariableSet last_created_stone_mana = No item
-






Set VariableSet last_created_rune_hp = No item
-
-





Else - Actions
-
-
-



Else - Actions
-




-------- check if teleporter --------
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






(Level of Teleporter Unit Class (Icon) for (Dying unit)) Equal to 1
-
-





Then - Actions
-






Set VariableSet teleporter_counter = (teleporter_counter - 1)
-
-





Else - Actions
-
-
-
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




loot_ran_num Greater than 85
-




((Dying unit) is A structure) Equal to False
-
-



Then - Actions
-




Item - Create Health Stone at demon_death_pt
-




Set VariableSet last_created_stone_hp = (Last created item)
-




-------- gives mana rune if difficulty to easy (1) or lower, also roll > 90 --------
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






loot_ran_num Greater than 90
-






difficulty_setting Less than or equal to 2
-
-





Then - Actions
-






Item - Create Rune of Mana at demon_death_pt
-






Set VariableSet last_created_rune_mana = (Last created item)
-
-





Else - Actions
-
-




-------- uses/puts loot in inventory if hero --------
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






((Killing unit) is A Hero) Equal to True
-
-





Then - Actions
-






Hero - Give last_created_stone_hp to (Killing unit)
-






Hero - Give last_created_rune_mana to (Killing unit)
-






Set VariableSet last_created_stone_hp = No item
-






Set VariableSet last_created_rune_mana = No item
-
-





Else - Actions
-
-
-



Else - Actions
-
-


-------- creates a demon loot if roll is a specific number at death point --------
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




loot_ran_num Equal to 50
-




((Dying unit) is A structure) Equal to False
-
-



Then - Actions
-




Item - Create Demonic Figurine at demon_death_pt
-
-



Else - Actions
-
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




loot_ran_num Equal to 49
-




((Dying unit) is A structure) Equal to False
-
-



Then - Actions
-




Item - Create Spiked Collar at demon_death_pt
-
-



Else - Actions
-
-


-------- remove / reset variable leaks --------
-


Custom script: call RemoveLocation(udg_demon_death_pt)
-
-
