- Joined
- Jul 15, 2018
- Messages
- 111
Hello, I am working on a map that involves mining. The mining system has been integrated into a damage detected system that is also used for other professions. It is written so that when a unit holds the pickaxe item, and attacks a ore rock, they will create resources. I have gotten the system to work for heroes, however I can't get an equivalent version of the ' Hero - Give (Last created item) to dmgDetectDamagingUnit ' to work. How do i rewrite these parts of code to create items and give them to non hero units also?
-
[B]Actions
-
Set dmgDetectDamagedUnit = (Triggering unit)
-
Set dmgDetectDamagingUnit = (Damage source)
-
Set dmgDetectDamagedPosition = (Position of dmgDetectDamagedUnit)
-
Set dmgDetectDamage = (Damage taken)
-
Set dmgDetectDamagedUT = (Unit-type of dmgDetectDamagedUnit)[/B]
-
-------- Skinning Trigger --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(dmgDetectDamagingUnit has an item of type Skinning Knife) Equal to True
-
aab Equal to False
-
Or - Any (Conditions) are true
-
Conditions
-
dmgDetectDamagedUT Equal to Chicken
-
dmgDetectDamagedUT Equal to Pig
-
dmgDetectDamagedUT Equal to Sheep
-
dmgDetectDamagedUT Equal to Cow
-
-
-
-
Then - Actions
-
Set aab = True
-
Unit - Cause dmgDetectDamagingUnit to damage dmgDetectDamagedUnit, dealing 70.00 damage of attack type Hero and damage type Normal
-
Set aab = False
-
-
Else - Actions
-
-
-------- Hunting Trigger --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(dmgDetectDamagingUnit has an item of type Hunting Sword) Equal to True
-
aab Equal to False
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
dmgDetectDamagedUT Equal to Deer
-
dmgDetectDamagedUT Equal to Rabbit
-
dmgDetectDamagedUT Equal to Raccoon
-
dmgDetectDamagedUT Equal to Bear (Level 1)
-
dmgDetectDamagedUT Equal to Mammoth
-
dmgDetectDamagedUT Equal to Frost Bear
-
dmgDetectDamagedUT Equal to Quilbeast (Level 1)
-
dmgDetectDamagedUT Equal to Frost Wolf
-
dmgDetectDamagedUT Equal to Giant Wolf
-
dmgDetectDamagedUT Equal to Dire Wolf
-
-
-
-
Then - Actions
-
Unit - Set dmgDetectDamagedUnit movement speed to ((Default movement speed of dmgDetectDamagedUnit) x 0.80)
-
Set aab = True
-
Unit - Cause dmgDetectDamagingUnit to damage dmgDetectDamagedUnit, dealing 50.00 damage of attack type Normal and damage type Normal
-
Set aab = False
-
-
Else - Actions
-
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(dmgDetectDamagingUnit has an item of type Improved Hunting Sword) Equal to True
-
aab Equal to False
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
dmgDetectDamagedUT Equal to Deer
-
dmgDetectDamagedUT Equal to Rabbit
-
dmgDetectDamagedUT Equal to Raccoon
-
dmgDetectDamagedUT Equal to Bear (Level 1)
-
dmgDetectDamagedUT Equal to Mammoth
-
dmgDetectDamagedUT Equal to Frost Bear
-
dmgDetectDamagedUT Equal to Quilbeast (Level 1)
-
dmgDetectDamagedUT Equal to Frost Wolf
-
dmgDetectDamagedUT Equal to Giant Wolf
-
dmgDetectDamagedUT Equal to Dire Wolf
-
-
-
-
Then - Actions
-
Unit - Set dmgDetectDamagedUnit movement speed to ((Default movement speed of dmgDetectDamagedUnit) x 0.80)
-
Set aab = True
-
Unit - Cause dmgDetectDamagingUnit to damage dmgDetectDamagedUnit, dealing 100.00 damage of attack type Normal and damage type Normal
-
Set aab = False
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
[B] -------- Mining Triggers --------
-
-------- ------------------------------------------------------- --------
-
-------- Iron Vein --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
And - All (Conditions) are true
-
Conditions
-
dmgDetectDamagedUT Equal to Iron Vein
-
(dmgDetectDamagingUnit has an item of type Pickaxe) Equal to True
-
-
-
-
Then - Actions
-
Set realRand1 = (Random real number between 0.00 and 100.00)
-
Unit - Set life of dmgDetectDamagedUnit to 100.00%
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(dmgDetectDamagingUnit is A Hero) Equal to True
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
realRand1 Greater than or equal to 66.66
-
-
Then - Actions
-
Item - Create Iron Ore at dmgDetectDamagedPosition
-
Hero - Give (Last created item) to dmgDetectDamagingUnit
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
realRand1 Greater than or equal to 83.33
-
-
Then - Actions
-
Item - Create Iron Ore at dmgDetectDamagedPosition
-
Hero - Give (Last created item) to dmgDetectDamagingUnit
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-------- ------------------------------------------------------- --------
-
-------- Silver Vein --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
And - All (Conditions) are true
-
Conditions
-
(Unit-type of dmgDetectDamagedUnit) Equal to Silver Vein
-
(dmgDetectDamagingUnit has an item of type Pickaxe) Equal to True
-
-
-
-
Then - Actions
-
Set realRand1 = (Random real number between 0.00 and 100.00)
-
Unit - Set life of dmgDetectDamagedUnit to 100.00%
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(dmgDetectDamagingUnit is A Hero) Equal to True
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
realRand1 Greater than or equal to 81.82
-
-
Then - Actions
-
Item - Create Silver ore at dmgDetectDamagedPosition
-
Hero - Give (Last created item) to dmgDetectDamagingUnit
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
realRand1 Greater than or equal to 90.90
-
-
Then - Actions
-
Item - Create Silver ore at dmgDetectDamagedPosition
-
Hero - Give (Last created item) to dmgDetectDamagingUnit
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-------- ------------------------------------------------------- --------
-
-------- Gold Vein --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
And - All (Conditions) are true
-
Conditions
-
(Unit-type of dmgDetectDamagedUnit) Equal to Gold Vein
-
(dmgDetectDamagingUnit has an item of type Pickaxe) Equal to True
-
-
-
-
Then - Actions
-
Set realRand1 = (Random real number between 0.00 and 100.00)
-
Unit - Set life of dmgDetectDamagedUnit to 100.00%
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(dmgDetectDamagingUnit is A Hero) Equal to True
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
realRand1 Greater than or equal to 88.24
-
-
Then - Actions
-
Item - Create Gold ore at dmgDetectDamagedPosition
-
Hero - Give (Last created item) to dmgDetectDamagingUnit
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
realRand1 Greater than or equal to 94.12
-
-
Then - Actions
-
Item - Create Gold ore at dmgDetectDamagedPosition
-
Hero - Give (Last created item) to dmgDetectDamagingUnit
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-------- ------------------------------------------------------- --------
-
-------- Stone Vein --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
And - All (Conditions) are true
-
Conditions
-
(Unit-type of dmgDetectDamagedUnit) Equal to Stone
-
(dmgDetectDamagingUnit has an item of type Pickaxe) Equal to True
-
-
-
-
Then - Actions
-
Set realRand1 = (Random real number between 0.00 and 100.00)
-
Unit - Set life of dmgDetectDamagedUnit to 100.00%
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(dmgDetectDamagingUnit is A Hero) Equal to True
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
realRand1 Greater than or equal to 50.00
-
-
Then - Actions
-
Item - Create Stone at dmgDetectDamagedPosition
-
Hero - Give (Last created item) to dmgDetectDamagingUnit
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
realRand1 Greater than or equal to 75.00
-
-
Then - Actions
-
Item - Create Stone at dmgDetectDamagedPosition
-
Hero - Give (Last created item) to dmgDetectDamagingUnit
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-------- ------------------------------------------------------- --------
-
-------- Copper Vein --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
And - All (Conditions) are true
-
Conditions
-
(Unit-type of dmgDetectDamagedUnit) Equal to Copper Vein
-
(dmgDetectDamagingUnit has an item of type Pickaxe) Equal to True
-
-
-
-
Then - Actions
-
Set realRand1 = (Random real number between 0.00 and 100.00)
-
Unit - Set life of dmgDetectDamagedUnit to 100.00%
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(dmgDetectDamagingUnit is A Hero) Equal to True
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
realRand1 Greater than or equal to 75.00
-
-
Then - Actions
-
Item - Create Copper ore at dmgDetectDamagedPosition
-
Hero - Give (Last created item) to dmgDetectDamagingUnit
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
realRand1 Greater than or equal to 87.50
-
-
Then - Actions
-
Item - Create Copper ore at dmgDetectDamagedPosition
-
Hero - Give (Last created item) to dmgDetectDamagingUnit
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
Else - Actions[/B]
-
-
-------- ------------------------------------------------------- --------
-
-------- Rank system --------
-
-------- ------------------------------------------------------- --------
-
Set rankAttacker = (Damage source)
-
Set rankAttacked = (Triggering unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(rankAttacker has buff Unit Training ) Equal to True
-
(Point-value of rankAttacker) Greater than or equal to 30
-
-
Then - Actions
-
-------- Unit variations --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Unit-type of rankAttacked) Equal to Dummy
-
-
Then - Actions
-
Unit - Set the custom value of rankAttacker to ((Custom value of rankAttacker) + 1)
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Owner of rankAttacked) is an enemy of (Owner of rankAttacker)) Equal to True
-
-
Then - Actions
-
Unit - Set the custom value of rankAttacker to ((Custom value of rankAttacker) + 10)
-
-
Else - Actions
-
-
-
-
-------- Rank up Main --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Custom value of rankAttacker) Greater than or equal to 3450
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(rankAttacker has buff Rank 10 -|c00FFFF00Elite|r- ) Equal to False
-
-
Then - Actions
-
Unit - Remove Rank 9 from rankAttacker
-
Unit - Add Rank 10 to rankAttacker
-
-
Else - Actions
-
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Custom value of rankAttacker) Greater than or equal to 2650
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(rankAttacker has buff Rank 9 -|c00FFFF00Master|r- ) Equal to False
-
-
Then - Actions
-
Unit - Remove Rank 8 from rankAttacker
-
Unit - Add Rank 9 to rankAttacker
-
-
Else - Actions
-
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Custom value of rankAttacker) Greater than or equal to 2050
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(rankAttacker has buff Rank 8 -|c00FFFF00Specialist|r- ) Equal to False
-
-
Then - Actions
-
Unit - Remove Rank 7 from rankAttacker
-
Unit - Add Rank 8 to rankAttacker
-
-
Else - Actions
-
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Custom value of rankAttacker) Greater than or equal to 1450
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(rankAttacker has buff Rank 7 -|c00FFFF00Veteran|r- ) Equal to False
-
-
Then - Actions
-
Unit - Remove Rank 6 from rankAttacker
-
Unit - Add Rank 7 to rankAttacker
-
-
Else - Actions
-
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Custom value of rankAttacker) Greater than or equal to 1050
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(rankAttacker has buff Rank 6 -|c00FFFF00Duelist|r- ) Equal to False
-
-
Then - Actions
-
Unit - Remove Rank 5 from rankAttacker
-
Unit - Add Rank 6 to rankAttacker
-
-
Else - Actions
-
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Custom value of rankAttacker) Greater than or equal to 650
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(rankAttacker has buff Rank 5 -|c00FFFF00Fighter|r- ) Equal to False
-
-
Then - Actions
-
Unit - Remove Rank 4 from rankAttacker
-
Unit - Add Rank 5 to rankAttacker
-
-
Else - Actions
-
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Custom value of rankAttacker) Greater than or equal to 450
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(rankAttacker has buff Rank 4 -|c00FFFF00Brawler|r- ) Equal to False
-
-
Then - Actions
-
Unit - Remove Rank 3 from rankAttacker
-
Unit - Add Rank 4 to rankAttacker
-
-
Else - Actions
-
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Custom value of rankAttacker) Greater than or equal to 250
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(rankAttacker has buff Rank 3 -|c00FFFF00Aspirant|r- ) Equal to False
-
-
Then - Actions
-
Unit - Remove Rank 2 from rankAttacker
-
Unit - Add Rank 3 to rankAttacker
-
-
Else - Actions
-
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Custom value of rankAttacker) Greater than or equal to 150
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(rankAttacker has buff Rank 2 -|c00FFFF00Novice|r- ) Equal to False
-
-
Then - Actions
-
Unit - Remove Rank 1 from rankAttacker
-
Unit - Add Rank 2 to rankAttacker
-
-
Else - Actions
-
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Custom value of rankAttacker) Greater than or equal to 50
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(rankAttacker has buff Rank 1 -|c00FFFF00Recuit|r- ) Equal to False
-
-
Then - Actions
-
Unit - Add Rank 1 to rankAttacker
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Else - Actions
-
-
-------- ------------------------------------------------------- --------
-
-------- Hero progression system --------
-
-------- ------------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Unit-type of dmgDetectDamagingUnit) Equal to Villager) or ((Unit-type of dmgDetectDamagingUnit) Equal to Villager)
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(dmgDetectDamagedUnit belongs to an enemy of (Owner of dmgDetectDamagingUnit)) Equal to True
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
classinteger[(Player number of (Owner of dmgDetectDamagingUnit))] Equal to 3
-
-
Then - Actions
-
Set heroStrProgression[(Player number of (Owner of dmgDetectDamagingUnit))] = (heroStrProgression[(Player number of (Owner of dmgDetectDamagingUnit))] + 20)
-
-
Else - Actions
-
Set heroStrProgression[(Player number of (Owner of dmgDetectDamagingUnit))] = (heroStrProgression[(Player number of (Owner of dmgDetectDamagingUnit))] + 10)
-
-
-
-
Else - Actions
-
Set heroStrProgression[(Player number of (Owner of dmgDetectDamagingUnit))] = (heroStrProgression[(Player number of (Owner of dmgDetectDamagingUnit))] + 2)
-
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
heroStrProgression[(Player number of (Owner of dmgDetectDamagingUnit))] Greater than or equal to (Integer((Power((Real((Strength of dmgDetectDamagingUnit (Exclude bonuses)))), 1.50))))
-
-
Then - Actions
-
Hero - Modify Strength of dmgDetectDamagingUnit: Add 1
-
Set heroStrProgression[(Player number of (Owner of dmgDetectDamagingUnit))] = 0
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-------- ------------------------------------------------------- --------
-
-------- Assassin Passive Damage --------
-
-------- ------------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
aab Equal to False
-
(Level of Combat Training for dmgDetectDamagingUnit) Equal to 1
-
classinteger[(Player number of (Owner of dmgDetectDamagingUnit))] Equal to 1
-
dmgDetectDamagingUnit Not equal to dmgDetectDamagedUnit
-
-
Then - Actions
-
Set aab = True
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Max life of dmgDetectDamagedUnit) Less than or equal to 3500.00
-
-
Then - Actions
-
Unit - Cause dmgDetectDamagingUnit to damage dmgDetectDamagedUnit, dealing ((Max life of dmgDetectDamagedUnit) x 0.10) damage of attack type Chaos and damage type Unknown
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Max life of dmgDetectDamagedUnit) Less than or equal to 10000.00
-
-
Then - Actions
-
Unit - Cause dmgDetectDamagingUnit to damage dmgDetectDamagedUnit, dealing ((Max life of dmgDetectDamagedUnit) x 0.05) damage of attack type Chaos and damage type Unknown
-
-
Else - Actions
-
Unit - Cause dmgDetectDamagingUnit to damage dmgDetectDamagedUnit, dealing ((Max life of dmgDetectDamagedUnit) x 0.03) damage of attack type Chaos and damage type Unknown
-
-
-
-
-
Set aab = False
-
-
Else - Actions
-
-
-------- ------------------------------------------------------- --------
-
-------- Routing system --------
-
-------- ------------------------------------------------------- --------
-
-------- Leak Removal --------
-
Custom script: call RemoveLocation (udg_dmgDetectDamagedPosition)
-
-
-
Add detectable damage heros runtime
-
Events
-
Unit - A unit enters (Playable map area)
-
-
Conditions
-
Actions
-
Trigger - Add to Damage Detected <gen> the event (Unit - (Entering unit) Takes damage)
-
-
Last edited: