| 01-03-2004, 06:28 AM | #1 |
This trigger will show you how to create the custom spell Convert. It will allow the hero to convert a unit on a % chance basis on every successive hit. (2 trigger skill) Variables NEEDED: HeroConvertPlayer (Integer Array Size 12) HeroUnit (Unit Array Size 12) ConvertChanceNumberPart1 (Integer Array Size 12) ConvertChanceNumberPart2 (Integer Array Size 12) This trigger is required to update the level of the skill by variable. Code:
ConversionUpdate
Events
Unit - A unit owned by Player 1 (Red) Learns a skill
Unit - A unit owned by Player 2 (Blue) Learns a skill
Unit - A unit owned by Player 3 (Teal) Learns a skill
Unit - A unit owned by Player 4 (Purple) Learns a skill
Unit - A unit owned by Player 4 (Purple) Learns a skill
Unit - A unit owned by Player 5 (Yellow) Learns a skill
Unit - A unit owned by Player 6 (Orange) Learns a skill
Unit - A unit owned by Player 7 (Green) Learns a skill
Unit - A unit owned by Player 8 (Pink) Learns a skill
Unit - A unit owned by Player 9 (Gray) Learns a skill
Unit - A unit owned by Player 10 (Light Blue) Learns a skill
Unit - A unit owned by Player 11 (Dark Green) Learns a skill
Unit - A unit owned by Player 12 (Brown) Learns a skill
Conditions
(Learned Hero Skill) Equal to Conversion
Actions
Set HeroConvertPlayer[(Player number of (Owner of (Triggering unit)))] = (HeroConvertPlayer[(Player number of (Owner of (Triggering unit)))] + 1)Here's the big killer. Code:
ConversionTrigger
Events
Unit - A unit owned by Neutral Hostile (Or whatever player) Is attacked
Conditions - NONE
Actions
For each (Integer A) from 1 to 12, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Attacking unit)) Equal to Player[(Integer A)]
Then - Actions
For each (Integer B) from 1 to 30, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
HeroConvertPlayer[(Player number of (Owner of (Attacking unit)))] Equal to (Integer B)
(Attacking unit) Equal to HeroUnit[(Player number of (Owner of (Attacking unit)))]
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
HeroConvertPlayer[(Player number of (Owner of (Attacking unit)))] Greater than or equal to 1
HeroConvertPlayer[(Player number of (Owner of (Attacking unit)))] Less than or equal to 5
Then - Actions
Set ConvertChanceNumberPart1[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 20)
Set ConvertChanceNumberPart2[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 20)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
HeroConvertPlayer[(Player number of (Owner of (Attacking unit)))] Greater than or equal to 6
HeroConvertPlayer[(Player number of (Owner of (Attacking unit)))] Less than or equal to 10
Then - Actions
Set ConvertChanceNumberPart1[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 17)
Set ConvertChanceNumberPart2[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 17)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
HeroConvertPlayer[(Player number of (Owner of (Attacking unit)))] Greater than or equal to 11
HeroConvertPlayer[(Player number of (Owner of (Attacking unit)))] Less than or equal to 15
Then - Actions
Set ConvertChanceNumberPart1[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 14)
Set ConvertChanceNumberPart2[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 14)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
HeroConvertPlayer[(Player number of (Owner of (Attacking unit)))] Greater than or equal to 16
HeroConvertPlayer[(Player number of (Owner of (Attacking unit)))] Less than or equal to 20
Then - Actions
Set ConvertChanceNumberPart1[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 13)
Set ConvertChanceNumberPart2[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 13)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
HeroConvertPlayer[(Player number of (Owner of (Attacking unit)))] Greater than or equal to 21
HeroConvertPlayer[(Player number of (Owner of (Attacking unit)))] Less than or equal to 25
Then - Actions
Set ConvertChanceNumberPart1[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 11)
Set ConvertChanceNumberPart2[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 11)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
HeroConvertPlayer[(Player number of (Owner of (Attacking unit)))] Greater than or equal to 26
HeroConvertPlayer[(Player number of (Owner of (Attacking unit)))] Less than or equal to 30
Then - Actions
Set ConvertChanceNumberPart1[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 10)
Set ConvertChanceNumberPart2[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 10)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
ConvertChanceNumberPart1[(Player number of (Owner of (Attacking unit)))] Equal to ConvertChanceNumberPart2[(Player number of (Owner of (Attacking unit)))]
Then - Actions
Unit - Change ownership of (Attacked unit) to (Owner of (Attacking unit)) and Change color
Else - Actions
Else - Actions
Else - ActionsExplanation and Customization Ok, this big huge trigger first of all checks for many things. The amount of levels this particular convert spell has 30. So I made every 5 levels of the skill to increase in %. Of course you can change this to whatever you want at this sections Code:
HeroConvertPlayer[(Player number of (Owner of (Attacking unit)))] Greater than or equal to X
HeroConvertPlayer[(Player number of (Owner of (Attacking unit)))] Less than or equal to XNow the harder part and the limits of this skill. Code:
Set ConvertChanceNumberPart1[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 17) Code:
Set ConvertChanceNumberPart2[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 17) 1 to 1 = 100% 1 to 2 = 50% 1 to 3 = 33% 1 to 4 = 25% 1 to 5 = 20% 1 to 6 = 17% 1 to 7 = 14% 1 to 8 = 13% 1 to 9 = 11% 1 to 10 = 10% 1 to 11 = 9% 1 to 12 = 8% 1 to 13 = 8% 1 to 14 = 7% 1 to 15 = 7% 1 to 16 = 6% 1 to 17 = 6% 1 to 18 = 6% 1 to 19 = 5% 1 to 20 = 5% 1 to 25 = 4% 1 to 33 = 3% 1 to 50 = 2% 1 to 100 = 1% |
| 01-03-2004, 10:45 PM | #2 |
You know, you could REALLY simplify this by making it a single trigger with the following actions: Code:
Conversion
Events
Unit - A unit Is attacked
Conditions
(Level of Conversion for (Attacking unit)) Greater than 0
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 100) Less than or equal to (4 + ((4 + (Level of Conversion for (Attacking unit))) / 5))
Then - Actions
Unit - Change ownership of (Attacked unit) to (Owner of (Attacking unit)) and Change color
Else - Actions |
| 01-03-2004, 11:49 PM | #3 |
You ignored my post on the last one you posted about this. :( You could forget about the huge triggers and make an ability based off Slow Orb with Charm as the spell to be cast. Change the %s to your desire.. |
| 01-04-2004, 03:11 AM | #4 |
Hrmm, didn't think about that. But my way you don't have to enter the % data over and over (just the text that says what % you want), plus orb abilities mess with and sometimes overrule other abilities. |
| 01-04-2004, 06:58 AM | #5 |
True, true. I dont use orbs or Mask of Death etc in my map so I dont have to worry about that, so I forgot about that hehe. Edit: Forgot about this little shortcut... you can right click on the ability field and then select the fillin thing and fillin the values using a constant or using mult/division. It automatically fills in all levels after the level that you started at. |
| 02-10-2004, 03:39 AM | #6 |
I didn't use orbs because it doesn't show the ability icon. And, that way you told me doesn't work. |
| 02-10-2004, 05:54 AM | #7 |
Where did I post it again? I'll look at it and make it or something... I'm 99.999% sure it would work. |
| 02-11-2004, 11:52 PM | #8 | |
Quote:
Orbs don't show abilitiethe ability icon on the hero. That's why I didn't use it. |
