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 11-04-2009, 01:07 AM   #31
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

It registers damage detection triggers, of course it can detect the amount of damage dealt. But it doesn't differentiate between spells and attacks.
grim001 is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 11-07-2009, 01:04 PM   #32
Mr.Malte
User
 
Mr.Malte's Avatar
 
Join Date: Apr 2008
Posts: 286

Submissions (2)

Mr.Malte is on a distinguished road (11)

Default

edit: Can I also prevent the damage differently than creating structs for each unit?
edit 2: Can't you make somtehing like this:

Collapse JASS:
// Gets data from events like GetEventDamage and adds the survival ability e.g
// if necessary
function ModifyDamage takes unit who, real byValue returns nothing

which can be only used in damage events?

But coded by you (used some map-specific funcs. Also I didn't all the research and don't know what to check)

Last edited by Mr.Malte : 11-07-2009 at 03:20 PM.
Mr.Malte is offline   Reply With Quote
Old 11-07-2009, 02:01 PM   #33
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,028

Submissions (19)

Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

No.
__________________
Anitarf is offline   Reply With Quote
Old 11-07-2009, 02:42 PM   #34
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

Quote:
Originally Posted by Mr.Malte
Can't you make somtehing like this:

Making it work that way is actually really difficult and hasn't been done flawlessly before. Maybe sometime in the future.

Last edited by grim001 : 11-07-2009 at 02:43 PM.
grim001 is offline   Reply With Quote
Old 11-07-2009, 05:40 PM   #35
Mr.Malte
User
 
Mr.Malte's Avatar
 
Join Date: Apr 2008
Posts: 286

Submissions (2)

Mr.Malte is on a distinguished road (11)

Default

But this:

Collapse JASS:
library ModifyDamage requires TimerUtils
    //! external ObjectMerger w3a AIl1 DMsa anam "LifeBonus" ansf "(DamageModifiers)" Ilif 1 100000 aite 0
    private struct DamageTaken
        real healAfterwards = 0.
        unit who
    endstruct
    private function AfterDamage takes nothing returns nothing
        local timer t = GetExpiredTimer()
        local DamageTaken a = GetTimerData(t)
        call ReleaseTimer(t)
        if GetUnitAbilityLevel(a.who,'DMsa') > 0 then
            call UnitRemoveAbility(a.who,'DMsa')
        endif
        call SetUnitState(a.who,UNIT_STATE_LIFE,GetUnitState(a.who,UNIT_STATE_LIFE)+a.healAfterwards)
    endfunction
    function ModifyDamage takes real mod returns nothing
        local unit damaged = GetTriggerUnit()
        local real damage = GetEventDamage()
        local real life = GetUnitState(damaged,UNIT_STATE_LIFE)
        local real maxLife = GetUnitState(damaged,UNIT_STATE_MAX_LIFE)
        local timer t
        local DamageTaken a
        
        if life < damage and life - damage + mod > 0.405 then
            call BJDebugMsg("Prevent Death")
            set a = DamageTaken.create()
            set a.who = damaged
            set a.healAfterwards = damage - mod
            call UnitAddAbility(damaged,'DMsa')
            set t = NewTimer()
            call SetTimerData(t,a)
            call TimerStart(t,0.00,false,function AfterDamage)
        endif
        
        if life + mod > maxLife then
            set a = DamageTaken.create()
            set a.who = damaged
            set a.healAfterwards = life + mod - maxLife
            set t = NewTimer()
            call SetTimerData(t,a)
            call TimerStart(t,0.00,false,function AfterDamage)
        else
            call SetUnitState(damaged,UNIT_STATE_LIFE,life+mod)
        endif

    endfunction
endlibrary

works perfectly well (ive tested it) and replaced my damage-reduction by hand easily.
What makes the thing complicated?
Did I forget anything?
Mr.Malte is offline   Reply With Quote
Old 11-07-2009, 07:01 PM   #36
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

I don't feel like getting into the details of how damage modification systems can fail, but there are about a dozen different ways. It gets more complicated if you allow it to increase damage dealt, keep bounties and kill triggers working correctly, avoid life bar flicker, and be called an unlimited number of times on the same unit.
grim001 is offline   Reply With Quote
Old 11-08-2009, 04:52 PM   #37
Fire-Dragon-DoL
User
 
Fire-Dragon-DoL's Avatar
 
Join Date: Mar 2004
Posts: 31

Fire-Dragon-DoL has little to show at this moment (4)

Default

I'm having a problem with the external call (that should come in compile time right?)

It doesn't include any ability (and I haven't even created a single one, or even edited!)...

Can you post a map with the ability (also even the ability, just to allow me copy/paste) because i think it'easier than come up on why the merger doesn't work for me :P

Another little thing
Are there any possibilities for damage types implementation?Or at least something like this in your to-do list?Because damage types are very interesting
Fire-Dragon-DoL is offline   Reply With Quote
Old 11-09-2009, 12:41 PM   #38
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,028

Submissions (19)

Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

If the object merger call isn't working for you, you can create the ability in the object editor yourself instead, I think that's the fastest way. Just pick one of the "Item Life Bonus" abilities, make a custom ability based on it, change the life bonus value to some high number and copy the new ability's rawcode to the calibration section of DamageModifiers.
__________________
Anitarf is offline   Reply With Quote
Old 01-18-2010, 09:48 AM   #39
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

ok I have this simple spell that just modifies the received damage of the targeted unit to deal more damage, but I'm just confused if I still need to this function function RunDamageModifiers takes nothing returns real
If I need to call that function, then where should I call it?
The spell code:
//! zinc
library BOY requires AutoIndex, SpellEvent, DamageModifiers, TimerUtils{
    constant integer spell = 'A01I';
    constant string sfx = "Abilities\\Spells\\NightElf\\Barkskin\\BarkSkinTarget.mdl";
    
    struct boyDamage extends DamageModifier{
        integer l;
        method onDamageTaken(unit c, real dmg)->real{
            return dmg*(0.13*l);
        }
    }
    
    struct data{
        unit u;
        effect fx;
        real ctr;
        boyDamage dm;
        method onDestroy(){
            DestroyEffect(fx);
            ctr = 0.0;
        }
    }
    
    function act(){
        unit c = SpellEvent.CastingUnit;
        unit u = SpellEvent.TargetUnit;
        timer t = NewTimer();
        data d = data.create();
        d.u = u;
        d.fx= AddSpecialEffectTarget(sfx,u,"origin");
        d.ctr = 0.0;
        d.dm= boyDamage.create(u,0);
        d.dm.l = GetUnitAbilityLevel(c,spell);
        SetTimerData(t,d);
        TimerStart(t,0.035,true,function(){
            timer t = GetExpiredTimer();
            data d = GetTimerData(t);
            if(d.ctr >= 8.0 || GetWidgetLife(d.u) <= 0.405){
                d.dm.destroy();
                ReleaseTimer(t);
                d.destroy();
            }
            d.ctr += 0.035;
            t = null;
        });
        t = null;
        u = null;
        c = null;
    }
    
    function onInit(){
        RegisterSpellEffectResponse(spell,act);
    }
}
//! endzinc
__________________
Current Project:
Rise of Sinnergy v1.00
Sinnergy is offline   Reply With Quote
Old 01-18-2010, 02:16 PM   #40
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,028

Submissions (19)

Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

If you have the DamageEvent library in your map, you do not need to call RunDamageModifiers yourself because DamageEvent already does it.
__________________
Anitarf is offline   Reply With Quote
Old 01-27-2010, 01:32 AM   #41
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

ok I have this skill that increases the damage on whatever damage she dealt to enemy units (10/20/30% amplify damage), base spell is from berserk, and the timer inside the trigger checks if the unit still has the berserk buff, else destroy damage modifiers.

I doubt that this trigger doesn't work, why? because I have another spell that deals 300 damage (attack type normal, damage type normal) that when tested to a 330 life unit with 0 armor, the spell left the target with 23 life without the damage modifiers applied, again tested the spell now with damage modifiers applied, now the spell left the target with 19 life, while 300 * 30% = 90 = 390 damage in total, which must kill the target instantly.

So here's the code.
Collapse Zinc:
//! zinc
library ArcaneBless requires TimerUtils, DamageModifiers, SpellEvent{
    constant integer spell = 'A01Y';
    constant integer bap = 'B00K';
    
    struct abDamage extends DamageModifier{
        integer l;
        method onDamageDealt(unit t, real dmg)->real{
            return dmg*(l*0.1);
        }
    }
    
    struct data{
        unit c;
        abDamage dm;
    }
    
    function act(){
        unit c = SpellEvent.CastingUnit;
        timer t = NewTimer();
        data d = data.create();
        d.c = c;
        d.dm = abDamage.create(c,0);
        SetTimerData(t,d);
        TimerStart(t,0.035,true,function(){
            timer t = GetExpiredTimer();
            data d = GetTimerData(t);
            if(GetUnitAbilityLevel(d.c,bap) <= 0 || GetWidgetLife(d.c) <= 0.405){
                d.dm.destroy();
                ReleaseTimer(t);
                d.destroy();
            }
            t = null;
        });
        t = null;
        c = null;
    }
    
    function onInit(){
        RegisterSpellEffectResponse(spell,act);
    }
}
//! endzinc
__________________
Current Project:
Rise of Sinnergy v1.00
Sinnergy is offline   Reply With Quote
Old 01-27-2010, 10:38 AM   #42
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

Correct me if im wrong, but i think you forgot to change d.dm.l when creating a new instance.
__________________
Deaod is offline   Reply With Quote
Old 01-28-2010, 02:43 AM   #43
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

Quote:
Originally Posted by Deaod
Correct me if im wrong, but i think you forgot to change d.dm.l when creating a new instance.
owned
__________________
Current Project:
Rise of Sinnergy v1.00
Sinnergy is offline   Reply With Quote
Old 01-28-2010, 01:27 PM   #44
Kueken
User
 
Join Date: Mar 2009
Posts: 149

Kueken will become famous soon enough (41)Kueken will become famous soon enough (41)

Default

Any possibility to use the variables for the damage types provided by IDDS together with damagemodifiers? I tried to access the GetDamageType function directly in the DamageModifiers onDamageTaken method, but they return 1 for every damage type. I would like to make the modifier behave differently with different damage types.

Last edited by Kueken : 01-28-2010 at 01:29 PM.
Kueken is offline   Reply With Quote
Old 01-28-2010, 05:26 PM   #45
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,028

Submissions (19)

Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by Kueken
Any possibility to use the variables for the damage types provided by IDDS together with damagemodifiers? I tried to access the GetDamageType function directly in the DamageModifiers onDamageTaken method, but they return 1 for every damage type.
That is not something I can answer since I did not make IDDS.

Quote:
I would like to make the modifier behave differently with different damage types.
I use xedamage to achieve this effect.

Edit: Sinnergy: Can I assume your problem has been fixed?
__________________

Last edited by Anitarf : 01-28-2010 at 05:27 PM.
Anitarf 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 11:16 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