- Joined
- Dec 4, 2019
- Messages
- 7
So the basic idea is that i want HERO UNITS to be able to "upgrade" their class into a more advanced form, i.e. a militia unit into a footman. I used the base units and turned them into hero units, and wrote a script that stores their str/agi/int, sets level to 1, replaces the unit, then restores those stats to the new level 1 unit.
The idea is that choosing to level a unit up with its "base" form before upgrading to a higher class will result in a unit with more total stats (since they're retained at level 1), compared to a unit that upgraded at level 1. Each upgrade also has more hero skills to pick from, making them stronger and more versatile.
Here's the thing.. SOMETIMES it works perfectly. Gives me a new advanced unit, level 1, copied stats. More often, however, it seems to just replace the unit with an identical level 1 copy of the same unit with zero stats (default is zero for these units), but that knows one of its hero skills already.
There are far more units than listed here (a total of 4 base evolvable units, warrior/mage/priest/archer) but i cut most of them out to make it more readable here. Each unit type has an identical script.
Any suggestions? Feel free to mock my insanity or give me a "why don't you just..." instead. Since hero units dont have an "upgrades to" option in the editor like buildings do, i had to resort to this.
Thanks in advance!
The idea is that choosing to level a unit up with its "base" form before upgrading to a higher class will result in a unit with more total stats (since they're retained at level 1), compared to a unit that upgraded at level 1. Each upgrade also has more hero skills to pick from, making them stronger and more versatile.
Here's the thing.. SOMETIMES it works perfectly. Gives me a new advanced unit, level 1, copied stats. More often, however, it seems to just replace the unit with an identical level 1 copy of the same unit with zero stats (default is zero for these units), but that knows one of its hero skills already.
There are far more units than listed here (a total of 4 base evolvable units, warrior/mage/priest/archer) but i cut most of them out to make it more readable here. Each unit type has an identical script.
-
UpgradeSkillCast
-
Events
-
Unit - A unit Finishes casting an ability
-
-
Conditions
-
(Ability being cast) Equal to Upgrade
-
-
Actions
-
Set UpgradingUnit = (Casting unit)
-
Set UpgradingHeroBaseStr = (Strength of UpgradingUnit (Exclude bonuses))
-
Set UpgradingHeroBaseInt = (Intelligence of UpgradingUnit (Exclude bonuses))
-
Set UpgradingHeroBaseAgi = (Agility of UpgradingUnit (Exclude bonuses))
-
Hero - Set UpgradingUnit Hero-level to 1, Hide level-up graphics
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Unit-type of (Casting unit)) Equal to Militia
-
-
Then - Actions
-
Unit - Replace UpgradingUnit with a Footman using The new unit's max life and mana
-
Set UpgradingUnit = (Last replaced unit)
-
Game - Display to (All players) the text: Footman
-
-
Else - Actions
-
Do nothing
-
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Unit-type of (Casting unit)) Equal to Footman
-
-
Then - Actions
-
Unit - Replace UpgradingUnit with a Captain using The new unit's max life and mana
-
Set UpgradingUnit = (Last replaced unit)
-
Game - Display to (All players) the text: Captain
-
-
Else - Actions
-
Do nothing
-
-
-
Hero - Modify Strength of UpgradingUnit: Set to UpgradingHeroBaseStr
-
Hero - Modify Agility of UpgradingUnit: Set to UpgradingHeroBaseAgi
-
Hero - Modify Intelligence of UpgradingUnit: Set to UpgradingHeroBaseInt
-
-
Any suggestions? Feel free to mock my insanity or give me a "why don't you just..." instead. Since hero units dont have an "upgrades to" option in the editor like buildings do, i had to resort to this.
Thanks in advance!