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 01-20-2010, 11:02 AM   #46
Anachron
User
 
Anachron's Avatar
 
Join Date: Mar 2009
Posts: 1,079

Anachron will become famous soon enough (51)Anachron will become famous soon enough (51)

Default

Okay thanks.
__________________
CustomInventory [Discussion - Download] - Got Directors Cut!
CustomMissle [Discussion - [Download (not yet)] - In development!
Other systems [Spawn System] [Move System] [CustomBar] [SpellBar]
Anachron is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 01-26-2010, 11:04 AM   #47
Anachron
User
 
Anachron's Avatar
 
Join Date: Mar 2009
Posts: 1,079

Anachron will become famous soon enough (51)Anachron will become famous soon enough (51)

Default

There is another bug.
If I add movementspeed to the unit and remove it, sometimes it gets to something ridiculous small and is like perma-slowed.
Can you fix that, please?
__________________
CustomInventory [Discussion - Download] - Got Directors Cut!
CustomMissle [Discussion - [Download (not yet)] - In development!
Other systems [Spawn System] [Move System] [CustomBar] [SpellBar]
Anachron is offline   Reply With Quote
Old 02-03-2010, 08:06 AM   #48
fX_
User
 
fX_'s Avatar
 
Join Date: Jan 2007
Posts: 528

Submissions (2)

fX_ will become famous soon enough (38)fX_ will become famous soon enough (38)

Default

Add/SetUnitBonus(myUnit, BONUS_SIGHT_RANGE) returns 1648 when its initial value is 0 and the offset is negative. it doesnt return the proper value : 0+offset (which should be a negative value). this might be just a case (where initial bonus is 0) of something 'bigger'.
fX_ is offline   Reply With Quote
Old 02-03-2010, 08:25 AM   #49
Anachron
User
 
Anachron's Avatar
 
Join Date: Mar 2009
Posts: 1,079

Anachron will become famous soon enough (51)Anachron will become famous soon enough (51)

Default

Hmm, you should fix these 2 Bugs, EF.
__________________
CustomInventory [Discussion - Download] - Got Directors Cut!
CustomMissle [Discussion - [Download (not yet)] - In development!
Other systems [Spawn System] [Move System] [CustomBar] [SpellBar]
Anachron is offline   Reply With Quote
Old 02-05-2010, 02:23 AM   #50
fX_
User
 
fX_'s Avatar
 
Join Date: Jan 2007
Posts: 528

Submissions (2)

fX_ will become famous soon enough (38)fX_ will become famous soon enough (38)

Default

Collapse JASS:
scope Test2 initializer Run

    private function Run takes nothing returns nothing
        local unit u = CreateUnit(Player(0), 'hfoo', 0, 0, 0)

        call BJDebugMsg("Initial value: " + I2S(GetUnitBonus(u, BONUS_ARMOR)))
        call BJDebugMsg("added new value: " + I2S(SetUnitBonus(u, BONUS_ARMOR, -4)))
        call BJDebugMsg("get new value: " + I2S(GetUnitBonus(u, BONUS_ARMOR)))
        call BJDebugMsg("undo new value: " + I2S(SetUnitBonus(u, BONUS_ARMOR, 4)))
        call BJDebugMsg("final value: " + I2S(GetUnitBonus(u, BONUS_ARMOR)))
    endfunction

endscope

prints:
0
1020
-4
4
4

bugs out the same way when SetUnitBonus is changed to AddUnitBonus.

Last edited by fX_ : 02-05-2010 at 02:24 AM.
fX_ is offline   Reply With Quote
Old 02-05-2010, 03:07 AM   #51
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

SetUnitBonus(u, BONUS_ARMOR, 4) will set the armor to 4, not add 4 to the current value. SetUnitBonus(u, BONUS_ARMOR, 0) or AddUnitBonus(u, BONUS_ARMOR, 4) will bring you back to 0.
__________________
Ammorth is offline   Reply With Quote
Old 02-05-2010, 03:25 AM   #52
fX_
User
 
fX_'s Avatar
 
Join Date: Jan 2007
Posts: 528

Submissions (2)

fX_ will become famous soon enough (38)fX_ will become famous soon enough (38)

Default

thats right.

what i meant rather was that set/addunitbonus will return incorrect values when the net bonus value is negative. (GetUnitBonus works fine.)

Last edited by fX_ : 02-05-2010 at 03:27 AM.
fX_ is offline   Reply With Quote
Old 02-15-2010, 11:26 AM   #53
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

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

Default

Doesnt compile with PJASS 1.0l. Replace "(" inside the prefix argument of the textmacro BonusMod_DeclareBonus with any char other than " ' ", "(" or "\" to get it to compile.

Edit: I uploaded a PJASS version that compiles BonusMod correctly in the PJASS Update thread.

Edit: I was looking for a Movement Speed Bonus library that memorizes overflowed bonuses and handles them correctly. Earth_Fury didnt want to implement this into BonusMod (or its extension library) for the sake of consistency.
So i wrote a library that allows exactly that.

Collapse JASS:
library MovespeedBonusWrapper uses MovementBonus, BonusMod, AutoIndex
    
    private function IntegerClamp takes integer value, integer min, integer max returns integer
        if value<min then
            return min
        elseif value>max then
            return max
        endif
        return value
    endfunction
    
    private struct MovementData
        private integer defaultSpeed
        private integer bonus=0
        
        private method onCreate takes nothing returns nothing
            set defaultSpeed=R2I(GetUnitMoveSpeed(me)+0.5)
        endmethod
        
        implement AutoCreate
        
        method setBonus takes integer new returns nothing
            set bonus=new
            if IsUnitType(me, UNIT_TYPE_STRUCTURE) then
                call SetUnitBonus(me, BONUS_MOVEMENT_SPEED, IntegerClamp(defaultSpeed+bonus, MIN_BUILDING_MOVEMENT, MAX_BUILDING_MOVEMENT)-defaultSpeed)
            else
                call SetUnitBonus(me, BONUS_MOVEMENT_SPEED, IntegerClamp(defaultSpeed+bonus, MIN_UNIT_MOVEMENT, MAX_UNIT_MOVEMENT)-defaultSpeed)
            endif
        endmethod
        
        method getBonus takes nothing returns integer
            return bonus
        endmethod
        
        method isBonusValid takes integer bonus returns boolean
            return IsBonusValid(me, BONUS_MOVEMENT_SPEED, bonus)
        endmethod
    endstruct
    
    function SetUnitMoveSpeedBonus takes unit u, integer new returns nothing
        call MovementData[u].setBonus(new)
    endfunction
    
    function GetUnitMoveSpeedBonus takes unit u returns integer
        return MovementData[u].getBonus()
    endfunction
    
    function AddUnitMoveSpeedBonus takes unit u, integer delta returns nothing
        call MovementData[u].setBonus(MovementData[u].getBonus()+delta)
    endfunction
    
    function RemoveUnitMoveSpeedBonus takes unit u returns nothing
        call RemoveUnitBonus(u, BONUS_MOVEMENT_SPEED)
    endfunction
    
    function IsMoveSpeedBonusValid takes unit u, integer bonus returns boolean
        return MovementData[u].isBonusValid(bonus)
    endfunction
    
endlibrary
__________________

Last edited by Deaod : 02-16-2010 at 06:28 AM.
Deaod is offline   Reply With Quote
Old 09-08-2010, 08:03 AM   #54
sephiroth1234
User
 
sephiroth1234's Avatar
 
Join Date: Dec 2009
Posts: 6

sephiroth1234 has little to show at this moment (0)

Default

Nice coding!!!! It proves to be useful in my map! Keep it up! :D
sephiroth1234 is offline   Reply With Quote
Old 03-01-2011, 01:04 PM   #55
CeDiL
User
 
CeDiL's Avatar
 
Join Date: Sep 2008
Posts: 53

CeDiL has little to show at this moment (1)

Default

This is some insane revolutionary script. It's usefulness is at the same level with Table! Great!
CeDiL is offline   Reply With Quote
Old 06-26-2011, 12:53 PM   #56
BBQ
User
 
Join Date: May 2011
Posts: 85

Submissions (2)

BBQ will become famous soon enough (30)BBQ will become famous soon enough (30)

Default

Quote:
Originally Posted by Earth-Fury
Collapse BonusMod:
//@         - There is a maximum attack speed. I have no idea what it is.
The maximum is 400%, while the minimum is -80%. A unit's total (a.k.a. when all attack speed bonuses are taken into account) increased attack speed cannot go above the maximum or below the minimum.

Last edited by BBQ : 06-26-2011 at 12:53 PM.
BBQ is offline   Reply With Quote
Old 11-19-2011, 05:22 AM   #57
l46kok
User
 
Join Date: Jun 2009
Posts: 4

l46kok has little to show at this moment (0)

Default

Worst. Mod. Ever.

After I ran the text macros from this map, it literally broke my map. Half of the objects name got changed to Unknown Ability (A0D2) ish and some abilities don't even work correctly.

I can't believe a single library would devastate the map. Absolute thumbs down.
l46kok is offline   Reply With Quote
Old 11-19-2011, 10:11 AM   #58
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

Quote:
Originally Posted by l46kok
Worst. Mod. Ever.

After I ran the text macros from this map, it literally broke my map. Half of the objects name got changed to Unknown Ability (A0D2) ish and some abilities don't even work correctly.

I can't believe a single library would devastate the map. Absolute thumbs down.
AS always, with any software that exists, you must do a backup before testing, you don't do it, then you take the possible risk of bad implementation.

Sorry for your map.
moyack is offline   Reply With Quote
Old 01-21-2012, 07:46 AM   #59
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)

Default

Earth-Fury would you please separate ability generation from your system code.
No one reads your system comments and they never set ability creation to false.

And even when you set it to false it still uses //! external directives....

Just put ability generation in separate scripts.

An example of properly made (thou a bit outdated) bonus mod system:
http://www.thehelper.net/forums/show...e-modification)
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.

Last edited by cohadar : 01-21-2012 at 07:49 AM.
cohadar 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 07:14 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

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