I have a system that works like this. Players make a "Child" unit that has a Timed Life. Once this expires, it turns into a grown adult. This adult has 1000 mana, and will die once he runs out of mana. Adults can change professions via an ability that replaces it with the desired profession.
For the aging process, I made a 6 level ability based off Brilliance Aura. Each level of the ability will regen (or should I say degen?) mana at a different rate. Once a Child unit becomes an adult, I want the adult unit to receive a random level of the aging process ability, and for it to carry on when he changes profession.
So I tested it out, and the trigger looks something like this:
As you can see, the created villager will have his "Aging Process" ability leveled by a random number from 0-6. It is indeed random, but the problem comes when I change profession. No matter what the Villager's "Aging Process" level was before, it will always revert back to the first level.
This is the profession changing trigger:
I only included one profession for less headache.
So the question is: what do I need to do so that the level of "Aging Process" remains the same throughout profession changes?
It's a bit confusing, so just say if you need clarification.
For the aging process, I made a 6 level ability based off Brilliance Aura. Each level of the ability will regen (or should I say degen?) mana at a different rate. Once a Child unit becomes an adult, I want the adult unit to receive a random level of the aging process ability, and for it to carry on when he changes profession.
So I tested it out, and the trigger looks something like this:
Trigger:
- ChildGrow
- Events
- Unit - A unit Dies
- Conditions
- (Killing unit) Equal to No unit
- Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Unit-type of (Dying unit)) Equal to Female Child
- Then - Actions
- Unit - Remove (Dying unit) from the game
- Unit - Create 1 Villager (Female) for (Owner of (Dying unit)) at (Position of (Dying unit)) facing Default building facing degrees
- For each (Integer A) from 0 to (Random integer number between 0 and 6), do (Actions)
- Loop - Actions
- Unit - Increase level of Aging Process for (Last created unit)
- Loop - Actions
- Else - Actions
- Do nothing
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Unit-type of (Dying unit)) Equal to Male Child
- Then - Actions
- Unit - Remove (Dying unit) from the game
- Unit - Create 1 Villager (Male) for (Owner of (Dying unit)) at (Position of (Dying unit)) facing Default building facing degrees
- For each (Integer A) from 0 to (Random integer number between 0 and 6), do (Actions)
- Loop - Actions
- Unit - Increase level of Aging Process for (Last created unit)
- Loop - Actions
- Else - Actions
- Do nothing
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Events
As you can see, the created villager will have his "Aging Process" ability leveled by a random number from 0-6. It is indeed random, but the problem comes when I change profession. No matter what the Villager's "Aging Process" level was before, it will always revert back to the first level.
This is the profession changing trigger:
Trigger:
- ChangeJob
- Events
- Unit - A unit Begins casting an ability
- Conditions
- Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Ability being cast) Equal to Become Archer
- Then - Actions
- Unit - Replace (Casting unit) with a Archer using The old unit's relative life and mana
- Selection - Add (Last replaced unit) to selection for (Owner of (Casting unit))
- Else - Actions
- Do nothing
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Events
I only included one profession for less headache.
So the question is: what do I need to do so that the level of "Aging Process" remains the same throughout profession changes?
It's a bit confusing, so just say if you need clarification.