wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 04-12-2009, 10:45 PM   #1
Deaod
User
 
Join Date: Jan 2007
Posts: 538

Submissions (11)

Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)

Send a message via ICQ to Deaod Send a message via MSN to Deaod
Default OrbStacking

A library to ease stacking orbs. And to add limitations to stacking orbs.

This uses vJass, DamageEvent, DamageModifiers, AutoIndex, Table and optionally GroupUtils.

In-Game commands

-reset: Spawns some footmen around you.
-level <level>: Sets the level of your hero to the specified level. Note that you cannot decrease your hero's level this way.
-handleid: Creates a location, displays its index - 0x1000001 and destroys it.
-commands: Shows this list.
-credits: Shows the credits.
-clear: Clears all text-messages.



Changelog

13/04/2009 - Version 1.0.0
- initial release

13/04/2009 - Version 1.0.1
- made removing the buff optional and moved it to the top to prevent recursion

16/04/2009 - Version 1.1.0
- changed internal handling of Item Orbs to Table for a performance gain
- each Orb now has a chance to be run. Refer to the manual for more information

16/04/2009 - Version 1.2.0
- added Category Types (if you have a more logical naming for those types, let me know)
- as a result of that, .AddToCategory()'s interface was changed.

23/04/2009 - Version 1.3.0
- each Category now has an execution limit, which can be adjusted
- backwards compatible

29/04/2009 - Version 1.3.1
- forgot to initialize the string table in the Category struct
- deleted irritating debug messages

29/04/2009 - Version 1.4.0
- reworked the way randomness is handled. 1.4.0 uses Ammorth's ChanceToProc library for that. Due to the severe performance impact i decided to keep 1.3.1 for those who are comfortable with the "spikes" the old way imposes on the chances

08/05/2009 - Version 1.5.0
- reworked the way randomness is handled (again). Removed the chance calculation on my side. The user decides whether the orb was applied or not with his own calculations
- as a result, the function interface was changed. You now have to return a boolean. For compatibility, use the constants provided by this library

22/05/2009 - Version 1.5.1
- deleted the superfluous H2I function
- minor other changes.

07/08/2009 - Version 1.5.2
- Compatibility with 1.24

06/11/2009 - Version 1.5.3
- fixed a few bugs by changing the ability the Generic Orb is based upon.
- Simplified implementation of the library and added a note that you have to add an ability to all units you want to have custom orbs.

06/02/2010 - Version 1.6.0
- Heavily optimized code run when a unit takes damage
- Made LightLeaklessDamageDetect exchangeable with IDDS by implementing an abstraction layer.

10/02/2010 - Version 1.6.1
- dramatically simplified importing this library. Now, you only need to copy over the code, everything else gets done automatically.
- removed the requirement of LightLeaklessDamageDetect, you can still use it, but its not required anymore.
- fixed Orbs for preplaced units.
- fixed destroying Orbs.
- clarified a few things in the documentation.

14/02/2010 - Version 1.6.2
- more bugfixes. Skilling the same ability multiple times no longer creates multiple UnitOrb instances.
- now supports adding Orbs via GUI.

15/02/2010 - Version 1.7.0
- breaks backwards compatibility in order to implement stacking priority. Orbs with higher priority get executed first. Only the interface of Orb.Create was changed.
- Allows changing the damage dealt to the damaged unit with the SetDamage(real new) function.

21/05/2010 - Version 1.8.0
- breaks backwards compatibility again. Ill get into that separately as basically the whole API changed. My aim was to reduce possibility of collision of names (eg. Category was far too general a name for a struct in a public library) (and i wanted to correct past mistakes).
- added missile modificators. Orbs can now change the missile a unit attacks with. Note that it doesnt take the target unit of an attack into account for speed reasons.

New API:
ABILITY_TYPE_SKILL --> ORB_TYPE_SKILL
ABILITY_TYPE_ITEM --> ORB_TYPE_ITEM
CATEGORY_TYPE_READ --> ORB_CATEGORY_TYPE_READ
CATEGORY_TYPE_WRITE --> ORB_CATEGORY_TYPE_WRITE
CATEGORY_TYPE_READWRITE --> ORB_CATEGORY_TYPE_READWRITE
Category --> OrbCategory
Orb_Callback --> OrbCallback
All members of publicly available structs now start with a lower-case-letter.

15/06/2010 - Version 1.8.1
- fixed OrbStacking for unit upgrading.
- did a few optimizations.
- added a few lines warning about using other orbs combined with this library (it just wont work the way you want it to).



Expand Script Code:

I additionally attached a map with two samples.
Attached Files
File Type: w3x OrbStacking_1.7.0.w3x (80.2 KB, 16 views)
File Type: w3x OrbStacking_1.8.1.w3x (80.8 KB, 40 views)
__________________

Last edited by Deaod : 06-26-2010 at 01:06 PM. Reason: Updated to 1.8.1
Deaod is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 04-16-2009, 02:19 PM   #2
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

Hmnn, an item based addon for LLDD sounds like a good idea, however:
- Heroes only have 6 items while a map could have like err 20 orbs. In other words, instead of iterating through all the orbs and checking if the hero has such item, iterate through all the items and if the item is an orb, do it.

- Maybe also add randomization into the equation? Most orbs would like to be random and I think it would be better to handle the random stuff inside your script so it doesn't have to call TriggerEvaluate

- Also some stacking is better, a hero could have the same orb multiple times, but for mapmakers just doubling the power of the orb is not that of a great idea, how about running the orb's function once but passing an argument/variable that tells the coder how many of those orbs does he have?
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 04-16-2009, 03:17 PM   #3
Deaod
User
 
Join Date: Jan 2007
Posts: 538

Submissions (11)

Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)

Send a message via ICQ to Deaod Send a message via MSN to Deaod
Default

i could use table, but that would make this thing slow.
Adding the randomization will be a pain in the ass, but ill see what i can do.
Having the same orb twice will not do anything (as long as they share at least one category). The user could still check how many times the unit has that orb.
__________________
Deaod is offline   Reply With Quote
Old 04-16-2009, 03:26 PM   #4
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

Quote:
i could use table, but that would make this thing slow.
Definitely faster than this though.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 04-16-2009, 04:40 PM   #5
Deaod
User
 
Join Date: Jan 2007
Posts: 538

Submissions (11)

Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)

Send a message via ICQ to Deaod Send a message via MSN to Deaod
Default

Version 1.1.0

Edit:

Version 1.2.0
__________________

Last edited by Deaod : 04-17-2009 at 02:19 PM.
Deaod is offline   Reply With Quote
Old 04-23-2009, 04:56 PM   #6
Deaod
User
 
Join Date: Jan 2007
Posts: 538

Submissions (11)

Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)

Send a message via ICQ to Deaod Send a message via MSN to Deaod
Default

Version 1.3.0
__________________
Deaod is offline   Reply With Quote
Old 04-23-2009, 07:46 PM   #7
Magissia
User
 
Magissia's Avatar
 
Join Date: Mar 2009
Posts: 72

Magissia has little to show at this moment (4)

Default

Can you make a demo map with blizzard's orb as sample but using you're system ??? (Ice orb, lightning otb ... etc)

And this line private constant integer AID = 'A005' mean the character have the item A005 or the spell A005 (Learned or on an item) (i think it spell, if it, can we trigger this from an item and not a skill ? (Item without any skill on it all triggered, or item with allready these 4 skills max that i want to add an other effect))

Sorry about my very poor english >_>
__________________
1337 0\/// )4 \/021)

F**k patch 3.1.0 and 3.1.1

Last edited by Magissia : 04-23-2009 at 07:50 PM.
Magissia is offline   Reply With Quote
Old 04-29-2009, 06:22 PM   #8
Deaod
User
 
Join Date: Jan 2007
Posts: 538

Submissions (11)

Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)

Send a message via ICQ to Deaod Send a message via MSN to Deaod
Default

Version 1.3.1

I added a map with two sample orbs created by blizzard initially (you could probably replicate those two orbs with simple object editor work, but they wouldnt stack).

Yes, you can make items have orbs easily, just pass ABILITY_TYPE_ITEM instead of ABILITY_TYPE_SKILL to Orb.Create().
And yes, you technically dont need a separate ability on the item to trigger the orb, but if you, for example, want to modify the missile art of the unit, you have to add one (either you add one, or you find a way to modify the units missile art through scripting).

EDIT:

Version 1.4.0
__________________

Last edited by Deaod : 04-29-2009 at 08:33 PM.
Deaod is offline   Reply With Quote
Old 05-08-2009, 09:39 PM   #9
Deaod
User
 
Join Date: Jan 2007
Posts: 538

Submissions (11)

Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)

Send a message via ICQ to Deaod Send a message via MSN to Deaod
Default

Version 1.5.0
__________________
Deaod is offline   Reply With Quote
Old 05-22-2009, 12:38 AM   #10
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

Approving it.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 05-22-2009, 07:55 PM   #11
Deaod
User
 
Join Date: Jan 2007
Posts: 538

Submissions (11)

Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)

Send a message via ICQ to Deaod Send a message via MSN to Deaod
Default

Version 1.5.1
__________________
Deaod is offline   Reply With Quote
Old 08-07-2009, 02:26 PM   #12
Deaod
User
 
Join Date: Jan 2007
Posts: 538

Submissions (11)

Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)

Send a message via ICQ to Deaod Send a message via MSN to Deaod
Default

Version 1.5.2
__________________
Deaod is offline   Reply With Quote
Old 11-04-2009, 08:13 AM   #13
Sinnergy
User
 
Sinnergy's Avatar
 
Join Date: Apr 2009
Posts: 173

Sinnergy has little to show at this moment (8)

Send a message via Yahoo to Sinnergy
Default

Can you provide more examples for:
ORB_APPLIED
ORB_NOT_APPLIED
CATEGORY_TYPE_READ
CATEGORY_TYPE_WRITE
CATEGORY_TYPE_READWRITE

We really can't get it clearly if you are only using 1 type for both spells, it would be better if you will create examples for each category type, each ability type and something that uses ORB_NOT_APPLIED as the returned boolean. Or if you are too lazy to create actual spells and items for examples, can you please state them into words? Thank you.

Is CATEGORY_TYPE_READ stacking? or non stacking? I really don't get these category types, and ORB_APPLIED and ORB_NOT_APPLIED are explained before you explained category types, which is really confusing.
__________________
Current Project:
Rise of Sinnergy v1.00

Last edited by Sinnergy : 11-04-2009 at 08:15 AM.
Sinnergy is offline   Reply With Quote
Old 11-04-2009, 08:54 AM   #14
Deaod
User
 
Join Date: Jan 2007
Posts: 538

Submissions (11)

Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)Deaod is a jewel in the rough (188)

Send a message via ICQ to Deaod Send a message via MSN to Deaod
Default

Okay, i will try.

Each category has an execution limit associated to it (which defaults to DEFAULT_CATEGORY_EXEC_LIMIT). Each orb can be associated to multiple categories. For the orb to trigger, its necessary that all categories its associated with (and are of type READ or READWRITE) have not yet reached their respective execution limits.

If the category for an orb is of type READ, that orb ONLY checks if another orb of that category can be executed but does not increase the execution count of that category.

If the category for an orb is of type WRITE, that orb ONLY increases the execution count, but does not check if another orb of that category can be executed.
Given that all preconditions are met, and the callback for that orb is executed, you can return ORB_APPLIED or ORB_NOT_APPLIED from the callback, since you might want to trigger an orb like bash or critical strike (which trigger based on chance).
If you return ORB_NOT_APPLIED, the execution count for all categories (of type WRITE or READWRITE) the orb is associated with will not be increased.
If you return ORB_APPLIED, the execution count for those categories will be increased.

The category type READWRITE combines those two. Meaning, it checks whether the execution limit of that category has been reached, and if the orb is successfully executed (its callback returned ORB_APPLIED) it increases the execution count of the category.
__________________
Deaod is offline   Reply With Quote
Old 11-04-2009, 09:38 AM   #15
Sinnergy
User
 
Sinnergy's Avatar
 
Join Date: Apr 2009
Posts: 173

Sinnergy has little to show at this moment (8)

Send a message via Yahoo to Sinnergy
Default

Thanks for the information.
In your life steal spell example, you stated above that it acts like blizzard's life steal spell. Lets say I created an item which also acts like life steal orb in your system, then I want it to stack with the same item, then what types will I use?
Example:
Mask of Death item, an orb item that steals 10% of the damage dealt which stacks with another Mask of Death item, meaning if I have two Mask of Death, then I will have 20% life steal per attack.

Edit: Looks like my code isn't working, I imported it right using the same abilities and buffs inside your test map and still using its raw codes in my map, I don't need to calibrate the script because it has the same raw codes used in my map. Heres the code.
Collapse unworking code:
scope Bear initializer init
    globals
        private constant integer superBeing = 'A00D'
        private constant integer tr = 'A009'
    endglobals
    
    private function trash takes nothing returns boolean
        local unit c = GetDamagingUnit()
        local unit t = GetDamagedUnit()
        local xecast xe
        debug call BJDebugMsg("trash is called")
        if(GetUnitAbilityLevel(c,superBeing)>0 and GetUnitAbilityLevel(c, tr) > 0 and GetUnitAbilityLevel(t,'mark') == 0 and IsUnitEnemy(c,GetOwningPlayer(t)) )then
            if GetRandomInt(0,100) <= 30 then
                call UnitDamageTarget(c,t,60.0,true,false,ATTACK_TYPE_MELEE,DAMAGE_TYPE_NORMAL,null)
                set xe = xecast.createA()
                set xe.abilityid = cr
                set xe.orderstring = "cripple"
                set xe.owningplayer = GetOwningPlayer(c)
                call xe.castOnTarget(t)
                debug call BJDebugMsg("with bonus")
            endif
        elseif GetUnitAbilityLevel(c,superBeing) == 0 and GetUnitAbilityLevel(c, tr) > 0 and GetUnitAbilityLevel(t,'mark') == 0 and IsUnitEnemy(c,GetOwningPlayer(t))  then
            if GetRandomInt(0,100) <= 20 then
                call UnitDamageTarget(c,t,30.0,true,false,ATTACK_TYPE_MELEE,DAMAGE_TYPE_NORMAL,null)
                debug call BJDebugMsg("without bonus")
                if GetUnitAbilityLevel(c,bb) > 0 then
                    set xe = xecast.createA()
                    set xe.abilityid = cr
                    set xe.orderstring = "cripple"
                    set xe.owningplayer = GetOwningPlayer(c)
                    call xe.castOnTarget(t)
                    debug call BJDebugMsg("buff applied")
                endif
            endif
        endif
        set c = null
        set t = null
        return ORB_APPLIED
    endfunction
    
    private function init takes nothing returns nothing
        call Orb.Create(tr,ABILITY_TYPE_SKILL,Orb_Callback.trash).AddToCategory("trasher",CATEGORY_TYPE_READWRITE)
    endfunction
endscope
none of the debug messages are displayed in testing the map in debug mode
__________________
Current Project:
Rise of Sinnergy v1.00

Last edited by Sinnergy : 11-04-2009 at 11:01 AM.
Sinnergy is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 03:41 AM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

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