HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Read: People who used to stack abilites.

12-21-2003, 09:48 PM#1
weaaddar
I've discovered that as long as the ability is a different one they still will add, it just when its the same exact ability its not added.

So since most people used this for armor and damage I decided to create a little demo map with a function set to handle adding arbitrary amounts of armor and damage to a unit.

This uses a method simmilar to bit flagging, it adds powers of 2 up to 512, which allows to it reach all unique integral values in the set [0,2*512-1]

I only went up to 1023, with 10 abilities each. Obviously you can extend it as far 2^31, with 32 abilities but its not worth the effort, as really who needs more then a 1023 armor/damage added?

Also armor % reduced seems to cap out at 98 for those who are curious at about 650 armor.

This requires 20 abilities, vs the 2046 you would of needed to do it without my functions, I guess its a slight win.
Changelog:
Code:
Version 2.0
-Changed name to better represent what it does
-Added functions: B2S, Ix 
 -B2S is soley for the test function, though.
-Cut down on Variables required. DmgBit is now a 2d array which has been renamed to BnsBit.
-Merged and thus cut  functions required: setBonus, clearBonus, addBonus, and getBonus are the new functions. Same usage as before except there is a new parameter. See more about it in the MiniApi trigger comment.
-Added support for mana, and hp.
-setBonus (and addBonus consequently) now return a boolean stating if they failed or not.

Version 1.1
-Stutter effect fixed when a user would enter 1023.
    I now load the spells in memory when the map loads, this slightly slows the load time. Its much better then the
    lag of death this can induce when done in multiplayer. 
Version 1.0
-Initial release.
-Supports adding up to 1023 damage/armor to a unit. Relative ease of use. See the test map to try it yourself.
Just type in a number and your guy gets a bonus. 
Latest version last downloadable in the thread.
12-21-2003, 11:56 PM#2
weaaddar
I found a little fix for the stutter effect thats induced when you type 1023 (adding all abilities).

Thanks to Aiursrage2k for the idea.
Updated again: reduced number of functions added handling of mana and hp.
See bottom of the thread for latest version.
12-22-2003, 12:15 AM#3
FyreDaug
Good job for actually doing it. I haven't looked at it, but what I'm guessing (what I was gonna try to do if I ever got time) was have the bitflags so +1,+2,+4,+8 etc. And use that instead, so if you have +1 armor and you gain another, you remove the +1 armor ability, and add the +2, then for +3 you add the +1 back. Correct?

If so, good job creating an algorithm.
12-22-2003, 01:05 AM#4
Sage the Mage
Interesting, system I'm using only goes up to 210 if I use 20 abils, I'll have to try it.
12-22-2003, 02:53 AM#5
weaaddar
for 210 you only need 8 abilities for each so 16.

You can thank Andy Bond for reminding me about bit flagging. You guessed correctly.

The algorithim wasn't much just a simple loop downward checking if the dmg was greater.
psuedo code here
Code:
for(int i=10,i>0,i--){
if (dmg>=2^i) {
  add ability[i]
  dmg-=2^i
}
}

I should probably optimize to use modulus.
12-22-2003, 03:28 AM#6
Grater
Very clever, I like this method a lot. It's probably better for damage than the old way, and it's a good substitute for armor/attack speed.
12-22-2003, 10:48 AM#7
Zechnophobe
Quote:
Originally posted by weaaddar
for 210 you only need 8 abilities for each so 16.

You can thank Andy Bond for reminding me about bit flagging. You guessed correctly.

The algorithim wasn't much just a simple loop downward checking if the dmg was greater.
psuedo code here
Code:
for(int i=10,i<0,i--){
if (dmg>=2^i) {
  add ability[i]
  dmg-=2^i
}
}

I should probably optimize to use modulus.

I'm guessing that's supposed to be I>0, not I<0 :P.

I like this idea, it's an efficient way of doing info control. Reminds me a bit of how I managed Items in my latest map. You have 3 bits of information you need to know about 1 item, with only the level and HP of the item that's trigger accessible. So what'd I do? I derive two types of info from the HP. The Exact value is used as an index in an array. I then mod the HP by certain values and if it comes up 0 to any of them, I ascertain more information from the number.

For instance, all items that mod20 = 0 were weapons. 20's were swords, 40's were axes, 60 were spears, etc.
12-22-2003, 04:13 PM#8
Vexorian
This is great, I used to use 10 abilities from 1 to 10 and 10 abilities for multiples of 10 this is way better than that since you use a very smart algorythm, * Sicking this first, will move it to the repository after a week *
12-23-2003, 04:27 PM#9
MysticGeneral
I've found that you can have 100% damage reduction on armor. I've got it on my SH, but it requires insane amount of armor. Just a little fyi.
12-24-2003, 11:05 PM#10
weaaddar
See the notes section before you start asking me questions...
from the changelog...
Code:
Version 2.0
-Changed name to better represent what it does
-Added functions: B2S, Ix 
 -B2S is soley for the test function, though.
-Cut down on Variables required. DmgBit is now a 2d array which has been renamed to BnsBit.
-Merged and thus cut  functions required: setBonus, clearBonus, addBonus, and getBonus are the new functions. Same usage as before except there is a new parameter. See more about it in the MiniApi trigger comment.
-Added support for mana, and hp.
-setBonus (and addBonus consequently) now return a boolean stating if they failed or not.

Version 1.1
-Stutter effect fixed when a user would enter 1023.
    I now load the spells in memory when the map loads, this slightly slows the load time. Its much better then the
    lag of death this can induce when done in multiplayer. 
Version 1.0
-Initial release.
-Supports adding up to 1023 damage/armor to a unit. Relative ease of use. See the test map to try it yourself.
Just type in a number and your guy gets a bonus.