So, I am creating an ability that works just like Frenzy in Homm3[1].
It works just fine, at least for now, except for one annoying bug. It freezes the game for 3-5 seconds upon first cast(And first cast only! Each cast after the first one works well.).
It doesn't matter if the skill is used at a specific unit or unit type.
There's a couple of tweaks I have to do yet, like adding the part that makes buff actually visible in buffs and to make it expire, but I'll do them later. After I fix this goddamn issue.
I'd be glad if I got help anytime soon :3
1 - For those who never played it: The spell converts armor value of the target into its attack value. Mostly useful.
Here are the triggers with adnotations.
It works just fine, at least for now, except for one annoying bug. It freezes the game for 3-5 seconds upon first cast(And first cast only! Each cast after the first one works well.).
It doesn't matter if the skill is used at a specific unit or unit type.
There's a couple of tweaks I have to do yet, like adding the part that makes buff actually visible in buffs and to make it expire, but I'll do them later. After I fix this goddamn issue.
I'd be glad if I got help anytime soon :3
1 - For those who never played it: The spell converts armor value of the target into its attack value. Mostly useful.
Here are the triggers with adnotations.
The initialization - Most probably nothing wrong here.
-
Init
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
-------- Frenzy 0 - Main skill --------
-
Set Frenzy[0] = Frenzy
-
-------- Frenzy 1 - Skill used to raise unit's hp when finding it's armor value. --------
-
Set Frenzy[1] = LifeBon (Greater)
-
-------- 2 - Reduction armor, each even level reduces armor by one. --------
-
-------- 3 - Damage increase, each level increases damage by 3. --------
-
-------- 10 - Spellbook for the two skills above. --------
-
Set Frenzy[2] = Armor Red
-
Set Frenzy[3] = Dmg Bonus
-
Set Frenzy[10] = SuperSpellBook
-
Player Group - Pick every player in (All players) and do (Actions)
-
Loop - Actions
-
Player - Disable Frenzy[10] for (Picked player)
-
-
-
-------- Initialize 50 armor values(Up to 25 armor) --------
-
-------- Didn't find any other way to convert damage reduction percent into armor. --------
-
Set ArmorConst[0] = 0.00
-
For each (Integer A) from 1 to 50, do (Actions)
-
Loop - Actions
-
Set ArmorConst[(Integer A)] = (((0.50 x (Real((Integer A)))) x 0.06) / (1.00 + (((Real((Integer A))) x 0.50) x 0.06)))
-
-
-
-
-
Start
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Frenzy[0]
-
-
Actions
-
Set TempUnit[0] = (Target unit of ability being cast)
-
Unit - Add Frenzy[1] to TempUnit[0]
-
-------- Here is the part that returns armor of the unit as TempReal[5]. --------
-
Set TempReal[0] = (Life of TempUnit[0])
-
Unit - Cause TempUnit[0] to damage TempUnit[0], dealing 1000.00 damage of attack type Chaos and damage type Normal
-
Set TempReal[1] = (Life of TempUnit[0])
-
Unit - Set life of TempUnit[0] to TempReal[0]
-
Unit - Remove Frenzy[1] from TempUnit[0]
-
Set TempReal[3] = ((TempReal[0] - TempReal[1]) x 1.00)
-
Set TempReal[4] = ((1000.00 - TempReal[3]) / 1000.00)
-
-------- Loop for finding up the armor value. Accuracy: 0,5 armor(Which doesn't matter at all when removing armor. The skill doesn't allow us to remove half of an armor point.). --------
-
For each (Integer A) from 0 to 50, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TempReal[4] Greater than ArmorConst[(Integer A)]
-
-
Then - Actions
-
Else - Actions
-
Set TempReal[5] = ((Real((Integer A))) / 2.00)
-
-------- Just a debug message. Game freezes BEFORE it appears. --------
-
Game - Display to (All players) the text: (String(TempReal[5]))
-
-------- Adds the spellbook and sets the buff strenght depending on amount of armor target has. --------
-
Unit - Add Frenzy[10] to TempUnit[0]
-
Unit - Set level of Frenzy[2] for TempUnit[0] to (Integer A)
-
Unit - Set level of Frenzy[3] for TempUnit[0] to (Integer A)
-
Set TempUnit[0] = No unit
-
Skip remaining actions
-
-
-
-
-
-------- Clearing up the variable in case I meet a unit with more than 25 armor. --------
-
Set TempUnit[0] = No unit
-
-