• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Non-Linear Health per level trigger.

Status
Not open for further replies.
Level 4
Joined
Oct 23, 2016
Messages
85
Hello everyone!

I am currently making sort of a PvP RPG (can't really classify it) and I've run into a problem:

I need certain units to level up with the hero, so I gave them a "Level Progression" upgrade, which raises a damage and a health ability level for those units. The damage increase works perfectly but the health upgrade doesn't seem to work. Can anyone see why? I can't seem to find the error in my triggers. Is the ability buggy somehow? Is there maybe a workaround?

Note that the gained health and damage are NOT linear (+300 @ Lv2, +500 @ Lv3, +700, +900 etc.), making it impossible to just use a health upgrade.

PS: I know there's a lot of leak. I'll work on that as soon as I have the terrain done.
 

Attachments

  • Ashenvale RPG Lv10.w3x
    2.3 MB · Views: 87
Level 7
Joined
Mar 10, 2013
Messages
366
I don't know why you say it's not linear, look very linear too me (each level increases 200).

I can't see the map right now but I can take a look when I get home tomorrow.
 
Level 4
Joined
Oct 23, 2016
Messages
85
I don't know why you say it's not linear, look very linear too me (each level increases 200).

You got it wrong^^ That is the BONUS health not the OVERALL health. A Unit with 100 HP should have 400HP @ Lv2, 900HP @ Lv3, 1600HP @ Lv4, 2500, 3600, 4900, 6400, 8100, 10.000HP @ Lv10.

The increment of the bonus is linear but the health itself isn't.

Edit:
Well, yes this Item - Skill which gives a bonus to Life/Mana is bugged.
It only gives the bonus of LVL 1, but Removes the Bonus of the Current LVL if removed. [...]

So how should I best apporoach this problem? (I will have to do the same with mana if you say that's bugged aswell :/)
 
Level 23
Joined
Jan 1, 2009
Messages
1,610
Please post the trigger in which you apply the HP bonus and don't just attach the whole map for us to search through.

So how should I best apporoach this problem? (I will have to do the same with mana if you say that's bugged aswell :/)

Either create an ability for each bonus value that you need, or create them in certain intervals (e.g. power of twos) so you can add them together to get the value you want. This will involve some maths and triggers though.
 
Level 4
Joined
Oct 23, 2016
Messages
85
Please post the trigger in which you apply the HP bonus and don't just attach the whole map for us to search through.
Sorry about that. Not really sure how to post just a trigger. Just taking a picture?

Either create an ability for each bonus value that you need, or create them in certain intervals so you can add them together to get the value you want. This will involve some maths and triggers though.

Hmm. I had hoped there would be an easier solution since i'll have to make around 40 abilitys now :/ And there won't be a problem with a unit having 10 abilitys just for health (and another 10 for mana)?
 
Level 7
Joined
Mar 10, 2013
Messages
366
Sorry about that. Not really sure how to post just a trigger. Just taking a picture?



Hmm. I had hoped there would be an easier solution since i'll have to make around 40 abilitys now :/ And there won't be a problem with a unit having 10 abilitys just for health (and another 10 for mana)?
You could, like Frotty said, create the abilities dinamically using triggers (which is possible since the total health value is an arithmetic progression)
 
Level 4
Joined
Oct 23, 2016
Messages
85
You could, like Frotty said, create the abilities dinamically using triggers (which is possible since the total health value is an arithmetic progression)

How would that work? Not really sure what you mean.

Edit:
Another problem I have is that newly spawned units also have to have the upgrade, which makes triggers more complicated.

This is the Health Formula BTW:

(Lv of ability * Lv of ability) x 100
 
Last edited:
Dynamic Life Bonus works like this:
  1. You Create HP Bonus Skills
  2. Save them in an Skill-Array
  3. Save their Bonuses along as Numbers
  4. Now if you want to gain Life: Set some temp variable to the wanted Bonus, after Loop all your Life-Skill and check if the Temp-Bonus is bigger equal the Skill's Bonus: If so add the Skill and reduce the Bonus.
Generally this Skills's values are a number row: for example the 2^x -> 1,2,4,8,16,32,64.....
But in your Case you can use 100 * 2^x: 100, 200,400,800,1600,3200,6400.
I guess you won't need further ones. Cause your biggest Value is 10000 = 6400 + 3200 + 400.
But highest accesable value by this without further skills is 12700.

To the Trigger:
  • Setup Life Bonus
    • Events
      • Map initialization
    • Bedingungen
    • Aktionen
      • Set Life_Bonus_SKill[0] = HP-Bonus (6400)
      • Set Life_Bonus_SKill[1] = HP-Bonus (3200)
      • Set Life_Bonus_SKill[2] = HP-Bonus (1600)
      • Set Life_Bonus_SKill[3] = HP-Bonus(800)
      • Set Life_Bonus_SKill[4] = HP-Bonus (400)
      • Set Life_Bonus_SKill[5] = HP-Bonus (200)
      • Set Life_Bonus_SKill[6] = HP-Bonus (100)
      • Set Life_Bonus_Value[0] = 6400
      • Set Life_Bonus_Value[1] = 3200
      • Set Life_Bonus_Value[2] = 1600
      • Set Life_Bonus_Value[3] = 800
      • Set Life_Bonus_Value[4] = 400
      • Set Life_Bonus_Value[5] = 200
      • Set Life_Bonus_Value[6] = 100
  • Gain Bonus
    • Events
    • Bedingungen
    • Actions
      • Set Bonus_HP = 8000
      • Set Gainer = Unit
      • For each (Integer A) from 0 to 6, do (Actions)
        • Schleifen - Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Bonus_HP Greater Equal (>=) Life_Bonus_Value[(Integer A)]
            • Then - Actions
              • Unit - Add Life_Bonus_SKill[(Integer A)] to Gainer
              • Set Bonus_HP = (Bonus_HP - Life_Bonus_Value[(Integer A)])
            • Else - Actions
If you want exploit that Bug:
Give any Life bonus Skill a second LVL, the First grants no Life the Second the Negative of the wanted life.
after adding the Skill set its LVL to 2 and removed it so your unit will gain permanent additional Life this can be Repeated without changing skills.

I attached a demo Map which shows both methodes.
 

Attachments

  • Life Bonus.w3x
    18.9 KB · Views: 59
Level 11
Joined
May 16, 2016
Messages
730
Hey I remember you. I made Immolation for you.
PS: I know there's a lot of leak. I'll work on that as soon as I have the terrain done.
I removed the leak. Now it doesn't lagging.
Note that the gained health and damage are NOT linear (+300 @ Lv2, +500 @ Lv3, +700, +900 etc.), making it impossible to just use a health upgrade.
I added the additional folder named Boost Health/Mana System.
In the "System Initilize" trigger you can set boost while Demon Hunter increases level and all his women also gets boost of mana and health.
 

Attachments

  • Ashenvale RPG Lv10.w3x
    2.3 MB · Views: 62
Level 4
Joined
Oct 23, 2016
Messages
85
Hey I remember you. I made Immolation for you.

Back again to save the day, are you? :D

I added the additional folder named Boost Health/Mana System.

I apppreciate the work you put in, but I've alredy been working on the Unit replacement system and found that it has many advantages like being able to set damage dice and abilitys individually without having to use complicated (for me) triggers.

I removed the leak. Now it doesn't lagging.

Thanks a lot! I will still be able to use the triggers since i'll just import them into the current map.
 
Level 13
Joined
Oct 18, 2013
Messages
691
Linear or Nonlinear, I'm 100% the system would handle it fine if you set it up right. Were you able to get it solved yet?

p.s (Math Hint)

Even though the number grows exponentially, it is not gaining acceleration. Therefore, the rate of increase is linear. The increase of the increase is 200 each iteration. If you make it to Calculus you get to learn derivatives. Take the derivitive of 100x^2 and see how it makes sense when you consider that the derivative of anything is its velocity.
 
Level 4
Joined
Oct 23, 2016
Messages
85
Were you able to get it solved yet?

I have. I stuck to replacing the units with others that (should) have the stats that I want.

This is what it looks like right now. I'm currently working on Making Unit Items and getting the drop system to work (which is nasty, since i'm not sure how i'm going to balance the drops). There's also a whole lot of unfinished other stuff that I have to get back to. It's a mess

EDIT: Leveling units and respawn wasn't actually working because I changed some player settings. Fixed and reuploaded.
 

Attachments

  • Ashenvale RPG Lv10.w3x
    2.4 MB · Views: 59
Last edited:
Level 4
Joined
Oct 23, 2016
Messages
85
After further working on my map, mainly overhauling the scaling system for HP, Mana, DPS and Item stats (now scales 2^x) I have run into this same problem again. Replacing the units has some downsides after all (Like having to modify every single unit if I decide to change something. Also, can't get the selection to work right and units stop moving when they level...etc.)

So I looked over all of the replies again and tried out Fruit Forest's and Tasyen's methods. They work fine, but this is where I ran into problems: Some of my units (there are planned to be 2 melee, 2 ranged, 1 Special, 1 Caster and 1 healer for each race) have varying health values and I need them to double their base hp (without item bonuses) on every level-up, (ex. 75,150,300,600,... and 100,200,400,800) so they stay relative to each other. There's 7 different numbers I need to scale (75/100/125/150/200/250/300) so I am wondering how to best approach this. Do I have to make an array for every value? An ability that has 25 HP bonus and add and remove it multiple times, maybe? Since they are all multoples of 25?

It's taking me forever to figure this out and i'd rather get back to making the terrain and Items (which i'm better at then making triggers :D) so i'd really appreciate if someone can make this for me or show me the most efficient way of doing it.


PS: I've attached my map in case anybody wants to take a look at it, but beware: it's really messy in there. I work on a lot of things simultaneously.
 

Attachments

  • Ashenvale RPG Lv10.w3x
    2.3 MB · Views: 65
Level 11
Joined
May 16, 2016
Messages
730
So I looked over all of the replies again and tried out Fruit Forest's and Tasyen's methods. They work fine, but this is where I ran into problems: Some of my units (there are planned to be 2 melee, 2 ranged, 1 Special, 1 Caster and 1 healer for each race) have varying health values and I need them to double their base hp (without item bonuses) on every level-up, (ex. 75,150,300,600,... and 100,200,400,800) so they stay relative to each other. There's 7 different numbers I need to scale (75/100/125/150/200/250/300) so I am wondering how to best approach this. Do I have to make an array for every value? An ability that has 25 HP bonus and add and remove it multiple times, maybe? Since they are all multoples of 25?
I kinda don't understand what do you need exactly?
Do you need change boost from 300/500/700 to 75/150/300 or what? Too many words.

EDIT: Nevermind I implemented the system of multiple health boost.
The system works next way:
In the "System Initilize" you set all multipliers for each class (i didn't find any conditions to determine who will caster/healer)
In the "Level Up" while unit gets level up all allies get boost hp/mp depending on their dummy ability "Leveled Damage (xxx)" where xxx = TANK/DPS/BALANCED.
For example:
HPBOOST[1] = 2 means all allied with "Leveled Damage (TANK)" ability gets max health = max health x HPBOOST[1]
If you set HPBOOST[X] lesser than 1 then max health becomes to decrease (BOOST=0 Kills unit)
 

Attachments

  • Ashenvale RPG Lv10.w3x
    2.3 MB · Views: 86
Last edited:
Level 4
Joined
Oct 23, 2016
Messages
85
I kinda don't understand what do you need exactly?
Do you need change boost from 300/500/700 to 75/150/300 or what? Too many words.

-I switched the HP/MP scaling system for my Player owned units.

Now i need to scale 7 different numbers (75,100,125,150,200,250,300) to always double themselves for each levelup. (75->150->300..., 100->200->400...,...)

These numbers are the max health values of player units at lvl 1. (ex. Archer with 75HP, Sentry with 100HP, Orc Shaman with 100HP, Undead Monstrosity with 300HP,...)

i do this so you can't fight a lvl 10 creature with lvl 4 units.

Sorry, it was kind of unclear last time :D


-If you have spare time, it would be awesome if you could do the same for

Mana (60 at lvl 1 for both casters and healers of all races)
and
Damage ( 8-12, 16-24, 32-48, ...) Is there a way to change damage dice via triggers? if so, that would be cool!

Sorry for all the words :grin:
 
Level 11
Joined
May 16, 2016
Messages
730
Now i need to scale 7 different numbers (75,100,125,150,200,250,300) to always double themselves for each levelup. (75->150->300..., 100->200->400...,...)

These numbers are the max health values of player units at lvl 1. (ex. Archer with 75HP, Sentry with 100HP, Orc Shaman with 100HP, Undead Monstrosity with 300HP,...)
This is doesn't matter anymore. The system already doubles (hpboost is set as 2.00) no matter how many hp you have (max hp boost is 99999 i think it's enough)
Mana (60 at lvl 1 for both casters and healers of all races)
Also double mana? Do you have any dummmy ability so I can detect who is considered as healer and caster.
Damage ( 8-12, 16-24, 32-48, ...) Is there a way to change damage dice via triggers? if so, that would be cool!
In this case you have to create a list of all units will all basic damage.
 
Level 4
Joined
Oct 23, 2016
Messages
85
This is doesn't matter anymore. The system already doubles (hpboost is set as 2.00) no matter how many hp you have (max hp boost is 99999 i think it's enough)
Does that mean that a unit with 100HP and an item with +100 HP will lvl up and have 400 HP then?

Do you have any dummmy ability so I can detect who is considered as healer and caster.
I made a dummy ability "Caster" and gave it to my casters. I hope that's what you meant.

In this case you have to create a list of all units will all basic damage.
I alredy have that list. how do I put it into a trigger?

EDIT: Whoops, forgot to upload the map
 

Attachments

  • Ashenvale RPG Lv10.w3x
    2.3 MB · Views: 41
Level 11
Joined
May 16, 2016
Messages
730
Does that mean that a unit with 100HP and an item with +100 HP will lvl up and have 400 HP then?
You didn't provide enough information about your project and you system. You should add that tip that your units can use items. (in this case I'll rework the system)
I alredy have that list. how do I put it into a trigger?
I'll see that I can do.
 
Level 4
Joined
Oct 23, 2016
Messages
85
You didn't provide enough information about your project and you system. You should add that tip that your units can use items.
There's just a lot to cover :D
-Rarity system: Creeps and Items that drop can be Common, Uncommon, Rare, Epic or Legendary (WoW rarity colors..just the colors.)
Better rarity creeps will drop better loot. Better loot has better stats (HP/MP/DMG for Unit Items) and abilitys.

-Hero Slots: Heros can carry 5 types of item: Weapon, Armor, Trinket, Boots (these are "Hero Items") and Consumables.

-Units
have 1 slot for "Unit Items" and 1 for Consumables.

-Spells for Healers and Casters will scale with maximum mana.

-Objective: Kill the big boss in the middle (for now. I am thinking about more PvP options).

-...

I pretty much have the game concept finished. I just need to make the map now xD

This is the list of damage on hit for levels 1-10.
Lv1: 8-12
Lv2: 16-24
Lv3: 32-48
Lv4: 64-96
...

Tanks will have 2.00 Sttack speed, Balanced 1.50 Attack Speed, DPS 1.00 Attack Speed

I am open to suggestions on the damage system.

I'm not happy with all units having 8-12 no matter if Tank, Balanced or DPS but i want damage items to be efficient on dps so their attack speed must be higher.

I JUST FOUND OUT I WAS UPLOADING THE WRONG MAP, I HAVE ATTACHED THE NEWEST VERSION.
 

Attachments

  • Ashenvale RPG Lv10.w3x
    2.5 MB · Views: 49
Last edited:
Level 6
Joined
Nov 18, 2016
Messages
75
First create a new trigger=
event=a unit gains a level

Before of that create variables for value of max hp with integer A

Like this
set variable 1=1

Then create another variable for max hp
set max hp (variable_1)=100 × (another variable about you gaining max hp formula)

Set max hp formula = variable_1× (everything you want)

Now the trigger.
event=a unit a gains a level
condition=leveling unit equal to (your hero)
Actions=if all conditions are true=
Condition=level of leveling unit is greater than or equal to (everything you want)
And : variable_1=1
Set variable_1=variable_1 + (every thing you want)
Set max hp of leveling unit equal to max hp formula
do this for another levels.this was for level 1 of ability

In another levels increase value of variable_1

And finally make the trigger about gainig max hp when level increased off and create a trigger to when this ability learned turn on these triggers
 
Last edited by a moderator:
Level 11
Joined
May 16, 2016
Messages
730
Now the trigger.
event=a unit a gains a level
condition=leveling unit equal to (your hero)
Actions=if all conditions are true=
Condition=level of leveling unit is greater than or equal to (everything you want)
And : variable_1=1
Set variable_1=variable_1 + (every thing you want)
Set max hp of leveling unit equal to max hp formula
do this for another levels.this was for level 1 of ability
:D Where is the function of which increases max health in the trigger list?
 
Status
Not open for further replies.
Top