| 10-18-2009, 01:04 AM | #1 |
Greetings. A set of units on the map needs to have variable life maximums. I'm looking for suggestions. Here's what I need to end up with. The units' life max will start around 50. As the map progresses, new units will start with more life, periodically. So after 5 minutes, they will have 75 max life. After 10 minutes, say, they'll have 100 life, and so on. However, as the result of an event, all the new units' life maximums will drop to their original level of 50 and start the progression over. This could happen any number of times. I can't use upgrades because they can't be unlearnt. I can't use a multi-level Item Life Bonus ability, as far as I can tell, because that ability can't have its level adjusted, at least not via triggers (so it will always have whatever the level 1 bonus is). I can't add more Item Life Bonus abilities because they don't appear to stack. What I'm coming down to is making an array of separate Item Life Bonus abilities with one level each, and adding the appropriate one using a trigger when the unit is created. This is pretty crude, so I'm looking for another route. Any suggestions? Thanks. |
| 10-18-2009, 01:12 AM | #2 |
How about giving them a large HP value and no regen? Then you can use triggers to set their remaining life at the moment they're spawned. You'll need (at least) two triggers: one to adjust the value of the "life" variable integer according to elapsed game time, and a separate one that spawns them whenever it's supposed to and then immediately sets the life of the newly spawned unit to the current value of the variable. |
| 10-18-2009, 01:19 AM | #3 |
That's good, but unclean. It's kinda unpolished to have damaged units for no obvious reason, and it makes the life bar much harder for the player to read accurately, since a unit might have some 2000 max life possible (just as a guess) but only 50 life at the moment. Also, any healing on those units will cause them to exceed their fake maximum. In the end, I don't think it's justifiable to use actual life instead of max life. |
| 10-18-2009, 03:13 AM | #4 |
Why not use those UnitMaxState systems around? |
| 10-18-2009, 06:10 AM | #5 |
Do I need to adopt an entire system? Do you know what the important elements might be in changing a unit's max life, that's used in one of those systems? |
| 10-18-2009, 06:32 AM | #6 |
http://www.wc3c.net/showthread.php?t=107451 I know. Because I wrote it. :) I think the documentation for that script should have all the information you need. If not, please do ask. Also, it's a CnP thing to use UnitMaxState... It also operates, basically, as fast as is possible for values down to a granularity of 1. It's also a single function call to change a unit's max state. But it's your choice if you wanna recode it specifically for your purposes. |
| 10-18-2009, 06:32 AM | #7 |
Rather than pretend knowing about it, I'd link you to relevant info: http://www.wc3c.net/showthread.php?t=80491 http://www.hiveworkshop.com/forums/j...axstate-65622/ http://www.wc3c.net/showthread.php?t=107795 http://www.wc3c.net/showthread.php?t=107451 edit: fuckyou ef |
| 10-18-2009, 09:45 PM | #8 |
Super, thanks guys! I'll dig in. EDIT: FYI, so the treat at the heart of all this is that the Item Life Bonus ability is bugged. At levels above 1, it doesn't add the life the way it's supposed to. But if it's removed, it does successfully subtract the life. So if you set the life gained to a negative value, when you add and remove the ability at that level, it winds up gaining the life. <3 Blizzard. Am I being sarcastic? |
| 10-20-2009, 03:24 AM | #9 |
So, for those playing at home, your system will just use -ve value life bonus skills to up the life to whatever you need, then reduce it using +ve values? |
| 10-20-2009, 10:00 PM | #10 |
Not quite exactly. It will add an ability that doesn't work properly. So adding the negative life won't actually do anything at all. But when the ability's removed, it does correctly change the life back, so it will remove the negative life, thus resulting in a permanent life bonus. |
| 10-20-2009, 11:32 PM | #11 |
That's interesting. This is referring to ordinary units and not heroes, right? (where negative Strength removes health) Item Life Bonus doesn't work properly with a negative value, huh... Even when using shift+enter? Now that I think about it, I've actually never tried (or even thought about) using Item Life Bonus with negative numbers. |
| 10-21-2009, 12:16 AM | #12 |
Ok then... time to explain really, really clearly... Examples: 1: Example ability: Based off Item Life Bonus. Has 2 levels. Level 1 has a bonus life of 10. Level 2 has a bonus life of 20. You add the ability to a unit. It gains 10 life. You set the level of the ability to 2. The unit loses the 10 bonus life. The unit does not gain 20 bonus life. BUG. You remove the ability from the unit. The unit loses 20 life. 2: Example ability: Based off Item Life Bonus. Has 2 levels. Level 1 has a bonus life of 0. Level 2 has a bonus life of -10. You add the ability to a unit. It gains 0 life. You set the level of the ability to 2. It loses 0 life. The unit does not lose 10 life. BUG. You remove the ability. The unit loses -10 life. --10 = 10, thus the unit gains 10 life. |
| 10-21-2009, 12:19 AM | #13 |
Perfectly well said, E-F. |
