Wc3C.net

Wc3C.net (http://www.wc3c.net/forums.php)
-   Scripts (http://www.wc3c.net/forumdisplay.php?f=737)
-   -   BonusMod (http://www.wc3c.net/showthread.php?t=107940)

Earth-Fury 10-13-2009 08:52 AM

BonusMod
 
1 Attachment(s)
Zoom (requires log in)
Version 3.3.1
Introduction
BonusMod is written in vJass and requires the NewGen editor, or Jass Helper with PitzerMike's Object Merger configured for it. BonusMod requires the latest version of Jass Helper.

BonusMod is a system for applying reversible bonuses to stats, such as damage, for specific units. Most of the bonuses provided by this system show green or red numbers in the command card, much like the bonuses provided by items. BonusMod is limited in the range of bonuses it can apply. The more abilities a bonus type uses, the larger the maximum and minimum bonuses.

BonusMod can also grant bonuses through code. For example, five optional bonus types are distributed with the basic BonusMod library. They are maximum life and mana, absolute mana per second regeneration, percentage of life per second regeneration, and movement speed. Even more bonus types can be provided by external libraries. The minimum and maximum bonuses these can apply differ depending on the library providing them.

Further explanation, and a guide to the API, is in the libraries documentation.
Credits
The BonusMod Library
Requirements:
The BonusMod library comes with the following bonus types with the given minimum and maximum values:

Bonus Types and Ranges:
Bonus Constant: Minimum:Maximum:
BONUS_DAMAGE
-1024
+1023
BONUS_ARMOR
-1024
+1023
BONUS_SIGHT_RANGE
-2048
+2047
BONUS_LIFE_REGEN
-256
+255
BONUS_AGILITY
-256
+255
BONUS_STRENGTH
-256
+255
BONUS_INTELLIGENCE
-256
+255
BONUS_ATTACK_SPEED
-512%
+511%
BONUS_MANA_REGEN_PERCENT
-512%
+511%
Note that you can easily remove unused bonuses, and easily increase or decrease the range of bonuses individually. Information on how is within the libraries documentation.

To add BonusMod to your map, copy and paste the below library in to a custom-text trigger in your map.

You will want to close your map after the first time you save it with BonusMod in it, reopen it, and disable ability (re)generation in the configuration section. If you fail to do that, a small delay will be added every time you save your map.
Expand BonusMod:


Additional Bonus Types
Bonus Maximum Life / Mana
Requirements:
This library provides two new bonus types:
Bonus Types and Ranges:
Bonus Constant:
BONUS_LIFE
BONUS_MANA
The minimum bonus these bonus types can apply depends on the unit. You can apply any positive or negative bonus that does not result in a unit's maximum life or maximum mana going below 1.

To add these bonuses to BonusMod, simply copy and paste the following library in to a custom-text trigger in your map.
Expand Bonus Max Life / Mana:


Bonus Life Regen (%) and Mana Regen (Absolute)
Requirements:
This library provides two new bonus types:
Bonus Types and Ranges:
Bonus Constant:
BONUS_MANA_REGEN
BONUS_LIFE_REGEN_PERCENT
These bonuses do not have minimum or maximum values. Any bonus amount is valid.

To add these bonuses to BonusMod, simply copy and paste the following library in to a custom-text trigger in your map. You may wish to change the refresh delay of the system, to either increase or decrease the time between updates.
Expand Bonus Life Regen (%) and Mana Regen (Absolute):

Bonus Movement Speed
Requirements:
This library provides one new bonus type:
Bonus Types and Ranges:
Bonus Constant:
BONUS_MOVEMENT_SPEED
The maximum and minimum bonus depends on a unit's base movement speed, and the maximum and minimum movement speed set in the gameplay constants. A unit's movement speed can not go below or above the minimum or maximum movement speed as defined in the gameplay constants.

To add this bonus to BonusMod, simply copy and paste the following library in to a custom-text trigger in your map. You must change the constants for maximum/minimum movement speed if you change the gameplay constants from their defaults.
Expand Bonus Movement Speed:

Demo Map
Below is the demo map for BonusMod. You can download it to test out the functionality.

Attachment 46671
Change Log

BonusMod & Additional Bonuses Change Log

  • 3.3.1:
    • Movement Speed bonus added
  • 3.3.0:
    • Switched ability creation to lua
    • Minor optimizations
  • 3.0 - 3.2:
    • Complete rewrite
    • Bug fixes
  • 1.0 - 2.0:
    • Ancient versions


Anachron 10-13-2009 08:59 AM

Finally the BonusMod on Wc3c.net!

And with an even better code, which sadly doesn't give more functionality.

Is there any chance you can add Attackspeed and Movespeed aswell?
(Attackspeed with "Gloves Of Haste"-Spell and Movespeed with triggering?)

Earth-Fury 10-13-2009 09:05 AM

Quote:

Originally Posted by Anachron
And with an even better code, which sadly doesn't give more functionality.

Did you miss the whole part of the code and documentation about having code-based bonuses? Also, each bonus now has it's own range, allowing you to minimize the number of abilities it uses.
Quote:

Originally Posted by Anachron
Is there any chance you can add Attackspeed and Movespeed aswell?
(Attackspeed with "Gloves Of Haste"-Spell and Movespeed with triggering?)

Maybe.

Anachron 10-13-2009 09:16 AM

Quote:

Did you miss the whole part of the code and documentation about having code-based bonuses? Also, each bonus now has it's own range, allowing you to minimize the number of abilities it uses.
Well, but who wants to have an value smaller as -4096 or higher as 4095?
Anyway, I (as you may have noticed) added an attackspeed bonus and movespeed bonus right to your system at hws, so yeah, would be good if you could add those.

Rising_Dusk 10-13-2009 02:15 PM

You should probably add the movespeed with the boots of speed ability. A single, changeable boots of speed ability can work, I've done lots of testing on that already for one of my maps. Anyways, if you insist you could use the natives.

The general stuff this should cover is as follows:
  • Strength
  • Intelligence
  • Agility
  • Damage
  • Armor
  • Attack Speed
  • Movement Speed
  • Life Regeneration (Flat)
  • Mana Regeneration (Flat)
  • Mana Regeneration (%)
  • Max Life
  • Max Mana
  • Sight Range

Anyways, just offhand the code looks okay and so does the documentation.

Fledermaus 10-13-2009 03:48 PM

I'd go with boots of speed ability to make it consistent with everything else (green bonus).

Rising_Dusk 10-13-2009 06:33 PM

That was my logic as well. Since they don't stack, however, even if you properly set the gameplay constant, you'd have to use one ability with a crapton of levels. I think either way it'd be the way to go, though.

Ignitedstar 10-13-2009 07:12 PM

Quote:

Originally Posted by Earth-Fury
Did you miss the whole part of the code and documentation about having code-based bonuses? Also, each bonus now has it's own range, allowing you to minimize the number of abilities it uses.

This is the thing that stood out to me the most. It's exactly why this rendition of BonusMod is awesome. Now I can have ~8000 bonus health and not have to do the same thing for everything else. Thank you, Earth-Fury!

Other than that, from what I take, calling setbonus is no different from the old BonusMod, right?

Earth-Fury 10-13-2009 07:40 PM

Quote:

Originally Posted by Ignitedstar
This is the thing that stood out to me the most. It's exactly why this rendition of BonusMod is awesome. Now I can have ~8000 bonus health and not have to do the same thing for everything else. Thank you, Earth-Fury!

if you mean maximum health, you'll hopefully be able to have an arbitrary health bonus. And mana bonus. If I can get it to work right... (It's basically a whole different thing jammed in to the same interface as the rest of it, which is why the other part of what you quoted is also awesome.)

Quote:

Originally Posted by Ignitedstar
Other than that, from I take, calling setbonus is no different from the old BonusMod, right?

Well, different naming convention for one.

Also, the old one returned a boolean, and failed if you tried to set something above/below the maximum. This one returns an integer which tells you the ACTUAL new bonus the unit got, and will simply give the min/max bonus if you go over/under. (And toss a warning if compiled in debug mode.)

In short: Basically, yeah. Barring the shit I'm sure no one ever used, they are identical.

Anachron 10-19-2009 09:11 PM

Still doesn't support movespeed. Will you add it?

Earth-Fury 10-19-2009 09:13 PM

Quote:

Originally Posted by Anachron
Still doesn't support movespeed. Will you add it?

Eventually. It turned out to be even more complex a thing than I had thought. It will require substantial testing to figure out all the possible kinks. For now, enjoy it without movement speed.

Av3n 10-20-2009 03:22 AM

Earth-Fury I would suggest to add the negatives like this: -1, -2 etc.
Since I did had problems before with negative bonuses where a -hp (shouldn't happen since of the method you are using) or a -str bonus that is changed can kill a unit.

-Av3n

Earth-Fury 10-20-2009 03:27 AM

Quote:

Originally Posted by Av3n
Earth-Fury I would suggest to add the negatives like this: -1, -2 etc.
Since I did had problems before with negative bonuses where a -hp (shouldn't happen since of the method you are using) or a -str bonus that is changed can kill a unit.

-Av3n


The negative bonuses are applied using a massive negative ability, which is added after the positive abilities. In other words, that issue has already been solved.

Anachron 10-20-2009 07:38 AM

Hmm, I think some guys should seriously look at the code before posting.

Thanks again for doing this, I already used it 4 times.

Fulla 10-21-2009 02:37 PM

1 Attachment(s)
I tried implementing it, but came across the following error:
Zoom (requires log in)


All times are GMT. The time now is 02:28 AM.

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services