• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] Unit Killed Due To An Upgrade

Status
Not open for further replies.
Level 3
Joined
Nov 21, 2016
Messages
30
I'm Having a Problem i got a dinamic recipe sistem that saves what material you made the item from
now i'm trying to make the bonuses of the material go with the created item
the problem is i'm using upgrades to do so but after i'm done with the first item the second i buy another material it kills my hero
+85.png
-85.png
Buff.png
Debuff.png


i dunno if this happens with another tipe of bonuses haven't tested yet
 
Level 25
Joined
May 11, 2007
Messages
4,650
Ok, well it's kinda hard reading your triggers since they're images not showing the whole trigger.
How To Post Your Trigger

I'm not sure why you're converting the custom value of the item, which is an integer to a string and then back to an integer. Use proper mathematics instead of converting it to a string.

I'm very unsure if your "adding and removing" upgrades is going to work, what happens if a player picks up and drops the item 1000 times, then you're going to need 1000 levels of the upgrade.
Try playing around with adding and removing the Life Bonus ability instead, just note that you can't level it so you're going to need multiple versions of it if you want different amounts of health.

Life Bonus Leveling | The Helper
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
Try playing around with adding and removing the Life Bonus ability instead, just note that you can't level it so you're going to need multiple versions of it if you want different amounts of health.
Or one can exploit this mechanic to create a dynamic health modification system.

I am not sure if WC3 is designed for negative upgrades. Especially with health and if the unit has proportionately low base health it probably will result in strange things happening such as unit death.
 
Level 3
Joined
Nov 21, 2016
Messages
30
I'm not sure why you're converting the custom value of the item, which is an integer to a string and then back to an integer. Use proper mathematics instead of converting it to a string.

Try playing around with adding and removing the Life Bonus ability instead, just note that you can't level it so you're going to need multiple versions of it if you want different amounts of health.
the problem is that i'm trying to do a dynamic recipe system so every time a new item is picked up i'll need to recalculate the bonus
about the converted integer i had problems to do with math so i got mad and did this way x.x

and i realy didn't know how to post the trigger thank you for that :3
 
Level 12
Joined
May 22, 2015
Messages
1,051
I'd use the item health bonus exploit to modify the health dynamically. If you were against that, I'd at least go with manual of health and just repeatedly add them to modify the health how you want (definitely not as efficient, though).

You basically create an ability based on the "item health bonus" ability. Give it extra levels (let's say 2 for this example). When you increase the level of the ability, it doesn't actually do anything. However, when you remove the ability, it removes the amount that it should if it was the level you set it to. So, to add health permanently to a unit, you can do this:

Ability:
Level 1 health bonus: 0
Level 2 health bonus: -10

Then, in a trigger, if you add this ability to a unit, set the level of that ability to level 2, and then remove the ability, the unit will gain 10 health. You can do this as many times as you want. Make it a positive number if you want to remove health.

__________________________________________________________________

As for your dynamic recipe system, it sounds very complicated, and it could get very messy. I think you should try to use hashtables to keep track of the data since they allow the most freedom with this sort of thing. I used this tutorial when I was learning:
Hashtables and MUI
 
Level 3
Joined
Nov 21, 2016
Messages
30
I'd use the item health bonus exploit to modify the health dynamically. If you were against that, I'd at least go with manual of health and just repeatedly add them to modify the health how you want (definitely not as efficient, though).

You basically create an ability based on the "item health bonus" ability. Give it extra levels (let's say 2 for this example). When you increase the level of the ability, it doesn't actually do anything. However, when you remove the ability, it removes the amount that it should if it was the level you set it to. So, to add health permanently to a unit, you can do this:

Ability:
Level 1 health bonus: 0
Level 2 health bonus: -10

Then, in a trigger, if you add this ability to a unit, set the level of that ability to level 2, and then remove the ability, the unit will gain 10 health. You can do this as many times as you want. Make it a positive number if you want to remove health.

__________________________________________________________________

As for your dynamic recipe system, it sounds very complicated, and it could get very messy. I think you should try to use hashtables to keep track of the data since they allow the most freedom with this sort of thing. I used this tutorial when I was learning:
Hashtables and MUI
can i do this with damage mana and other bonuses ??
 
Status
Not open for further replies.
Top