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 09: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 09: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 10: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 10: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 03: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 04:48 PM

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

Rising_Dusk 10-13-2009 07: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 08: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 08: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 10:11 PM

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

Earth-Fury 10-19-2009 10: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 04: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 04: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 08: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 03:37 PM

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

Rising_Dusk 10-21-2009 03:47 PM

  • Do you have a scope that shares the name with one of those optional libraries?
  • Have you updated JH to a version that supports optional requirements?
  • If you are using the newest JH, there is a weird bug, just add spaces before the commas in the optional requirements list. (Apparently)

Fulla 10-21-2009 04:20 PM

1 Attachment(s)
Ah, well I just downloaded the latest JH & the bonus mod testmap from here to simply test if it would compile, but getting similar problems with 'optional'. Sorry for going a bit off topic here...

If you download the latest JH, delete your old folder & open the editor from within the new folder, does that not auto update ?

Earth-Fury 10-21-2009 04:54 PM

Err, to update to the latest JH (which this requires), simply download the latest, open the "executables" directory, CnP the 2 exes and the cfg file in to NewGen's jasshelper folder. You don't even need to restart the editor or anything to change JH versions.

As for that specific error you just posted... That's almost surely a sign you're using an outdated JH version, as optional textmacros are rather new.

Vexorian 10-24-2009 02:43 PM

So we can extend Bonus and add our own crazyness huh? That's good, I was looking for that. You know this actually covers for 50% of the work for my planned inventory system?

Well, anyway something I would have always wanted is a way to set a bonus to much higher or lower than the cap. Say you add a +2000 bonus. In game, it is still capped at +1023, but in fact it is 2000 in-code. Then if you subtract 2000 again, it the in-code bonus will go to 0, and the in-game one will mimic the change. If we do it using the current ways, it will go to 1023 first, then to -977 . This is just a request and I guess it may not be worth it. With all that and given the code and the fact that it works, I approve this thing. Just wish I got a way to make ObjectMerger not crash in WINE...

grim001 10-24-2009 03:55 PM

Man, I was going to force EF to work hard and keep improving this thing before approving it, now I wonder if he will get lazy...

Earth-Fury 10-24-2009 05:13 PM

Quote:

Originally Posted by Vexorian
Well, anyway something I would have always wanted is a way to set a bonus to much higher or lower than the cap. Say you add a +2000 bonus. In game, it is still capped at +1023, but in fact it is 2000 in-code. Then if you subtract 2000 again, it the in-code bonus will go to 0, and the in-game one will mimic the change. If we do it using the current ways, it will go to 1023 first, then to -977 . This is just a request and I guess it may not be worth it. With all that and given the code and the fact that it works, I approve this thing. Just wish I got a way to make ObjectMerger not crash in WINE...


I really have to question why the ranges of the bonuses that come with this are insufficient for basically any use, causing me to question how that would be really at all useful...

I mean, seriously. +4095 to -4095 damage... The range of the armour bonus is about as high as it needs to be to cause the in game UI to round damage reduction to 100%... The others are similarly high.

Quote:

Originally Posted by grim001
Man, I was going to force EF to work hard and keep improving this thing before approving it, now I wonder if he will get lazy...

Bribe me with Physics and I will work.

Vexorian 10-24-2009 05:15 PM

Quote:

I really have to question why the ranges of the bonuses that come with this are insufficient for basically any use, causing me to question how that would be really at all useful...
Who really wants those huge bounds? I would be fine with changing the limit to +63 damage, then let it be capped at +63.. So that if my players abuse too much on the attack bonuses, it has a cap . Of course, that won't work because of how it works right now... and let them approach +400 damage just because of it...

Earth-Fury 10-24-2009 05:36 PM

Quote:

Originally Posted by Vexorian
Who really wants those huge bounds? I would be fine with changing the limit to +63 damage, then let it be capped at +63.. So that if my players abuse too much on the attack bonuses, it has a cap . Of course, that won't work because of how it works right now... and let them approach +400 damage just because of it...


Mhh. You have enough of a point for me to add BONUS_TYPE.max = 63 to BonusMod itself. As for tracking over-run... That's up to people using BonusMod. I may write up some overly complex system for tracking were bonus amounts come from, and allowing some sources of bonuses to stack while not others and stuff. But that's at a low priority compared to improving the base BonusMod...

-----------------------

Also, add macros calling macros and configuration will become even simpler. (Yes, it will be even more abusive than it currently is, but it will simplify the documentation and changing the range of bonuses...) And, If I can get Pitzer to update the objectmerger to work well with block externals, we'll have a merry, lua-based christmas.

Vexorian 10-24-2009 06:03 PM

Doesn't objectmerger have sourcecode or something?
You know I could tweak externalblock to make its contents go to a file or something like that...

...
You could always make a bridge program that converts stdin to a file to feed objectmerger with.

Earth-Fury 10-24-2009 06:17 PM

Quote:

Originally Posted by Vexorian
Doesn't objectmerger have sourcecode or something?

99% sure it does. 100% sure I can't find it anywhere I know to look. 80% sure if I could find it, I would be too shite at whatever language it's in to update it.

Quote:

Originally Posted by Vexorian
You know I could tweak externalblock to make its contents go to a file or something like that...

That would be hard, as you have to pass the file to the externalblock's argument list...

Mayhaps:
//! externalblock <filename_to_write> <external_tool> <args>
supplying a path should break. only simple filenames should be allowed to prevent shit like "C:\windows\SOME_IMPORTANT_FILE.dll" as a file...

Don't auto-delete the files, but do auto-overwrite em. mayhaps just pass the filename as an absolute path as an additional argument to the external tool. or add $PREPROCESS$ stuff to external line, but that would just be baddd...

Also, keep the current behaviour with:
//! externalblock stdin <external_tool> <args>
Quote:

Originally Posted by Vexorian
You could always make a bridge program that converts stdin to a file to feed objectmerger with.

The point of externalblock is to make configuration as simple as possible. That kinda defeats that purpose... Unless I get Mindy to add it to NewGen. Of course, Mindy is lazy these days...

Vexorian 10-24-2009 06:32 PM

I meant this:
Collapse JASS:
//! externalblock OBJECTMERGER $file$ blah blah blah
//! i contents of this file go to a windows temp file
//! i then external block gives this file in place of $file$ thing

//! endexternalblock

Earth-Fury 10-24-2009 06:35 PM

That's fine.

Also, needing //! i is awesome. I will be horribly abusing that to combine object generation and declaration in to one easy step.

Though, macros calling macros will make it even cleaner. But usable externalblock takes priority over that, for reducing the insane amount of time it takes to generate the abilities...

Rising_Dusk 10-24-2009 07:20 PM

I refuse to use this until it supports movement speed. I don't even think it should be approved until it supports that. If you don't update it with that in a reasonable time frame, I will move it back to submit a resource. It's really that important.

Earth-Fury 10-25-2009 04:45 PM

BonusMod Todo List: (I'm way too lazy to edit the giant-ass first post)
  • Add Movement speed bonuses
  • Further test how illusions work with bonuses and determine the behaviour for them
  • Make the integer values for bonuses configurable/obviously static, so things like SLK-struct loading can use the integer values for bonus types better. (Likely needs JH update for .allocate(int))

Done:
  • Start switching ability generation to a lua script (Full switch needs JH or OM update)
  • Improve the current two code-based bonuses

If you think there's something missing from my list, speak up.

Mr.Malte 11-01-2009 09:19 PM

Id love you for a SetUnitAttackCooldown(unit,time) function.
So if time is 1.00 then the unit attacks every 1 seconds.

grim001 11-02-2009 03:52 PM

Quote:

Originally Posted by Mr.Malte
Id love you for a SetUnitAttackCooldown(unit,time) function.
So if time is 1.00 then the unit attacks every 1 seconds.

That would require a table of all default units' attack cooldowns, as well as the assumption that BonusMod is the only thing in the map affecting attack speed. I think it is more appropriate for some other script.

Kricz 11-19-2009 03:11 PM

When I save the map with imported Abilitys, JassHelper (0.A.2.7) gives me thousand syntax error in your library BonusModBase.
It tells me, the rawcodes of the textmacros (BonusMod_DeclareBonus) have "unrecognized character ' (ASCII 39) "... (I think its the first and the third parameter)
Don't know why it doesn't work and I don't really want to look all over the code to find that...

I've also read the whole Readme but I didn't find something...

Rising_Dusk 11-19-2009 03:14 PM

I was thinking about this flat mana regen thing. I don't actually think it needs a timer, after a bit of testing. Check the permanent immolation passive ability and set its mana drain to negative. It should work as flat mana regeneration.

Also, f*cking do movement speed.

Vexorian 11-21-2009 04:31 PM

Quote:

Originally Posted by Kricz
When I save the map with imported Abilitys, JassHelper (0.A.2.7) gives me thousand syntax error in your library BonusModBase.
It tells me, the rawcodes of the textmacros (BonusMod_DeclareBonus) have "unrecognized character ' (ASCII 39) "... (I think its the first and the third parameter)
Don't know why it doesn't work and I don't really want to look all over the code to find that...

I've also read the whole Readme but I didn't find something...

That's because of the newest PJass, try using an older PJass version or Zoxc's jass syntax checker.

Kricz 11-21-2009 05:37 PM

Okay thanks, I'll try it out

Thanks again Vex, works perfectly, + rep, but I can't rep you xD

Earth-Fury 11-23-2009 02:46 AM

Quote:

Originally Posted by Rising_Dusk
Also, f*cking do movement speed.


Done. Also some other stuff.

Biiiggg update. Also now requires the latest AutoIndex.

Kricz 11-23-2009 03:41 PM

Nice update!!
+rep

Gamat 11-23-2009 11:40 PM

Could you add here

Requirements:

* Optionally, either:

* AbilityPreload
* xepreload

Caster system? It has the PreloadAbility(id) func

Earth-Fury 11-23-2009 11:59 PM

Quote:

Originally Posted by Gamat
Could you add here

Requirements:

* Optionally, either:

* AbilityPreload
* xepreload

Caster system? It has the PreloadAbility(id) func


The caster system has been deprecated since xe was released... If it's really important to you due to a large pre-existing map that uses the caster system, then just manually add it to the list of requirements of the library.

Rising_Dusk 11-24-2009 01:48 AM

Or just import AbilityPreload and comment out the one in the Caster System. :p


All times are GMT. The time now is 07:19 PM.

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