Decreasing attack damage upon attack

bananaHUNT

You can change this now in User CP
Reaction score
55
I have an Item "Palin's Axe" that decreases the attacked Hero's damage with 15 every hit for 6 seconds. I have this, but sometimes it works, and sometimes very wierd.
Code:
Hero Damage
    Events
        Unit - A unit Is attacked
    Conditions
        And - All (Conditions) are true
            Conditions
                ((Attacked unit) is A Hero) Equal to True
                ((Attacking unit) has an item of type Palin's Axe) Equal to True
                (Random integer number between 1 and 100) Less than or equal to 25
    Actions
        Set Palin_Hero = (Attacked unit)
        Unit - Add Palin's Axe (-15) to Palin_Hero
        Wait 6.00 seconds
        Unit - Remove Palin's Axe (-15) from Palin_Hero
When i try it with more than 1 item it starts acting wierd,,

edit; this might help (i know chances are random, but for easy understanding it's once every 4 attacks):
palinum1.png
 
Your hero attacks it with the good chance again before the wait could be over, so it restarts the trigger.
 
i dont think this would stack that way
maybe use an dummy unit which casts a spell on your hero that gives a buff and lasts 6 seconds
with another trigger check for units with that buff and reduce their damage

PS: nice icon
 
Code:
Hero Damage
    Events
        Unit - A unit Is attacked
    Conditions
        And - All (Conditions) are true
            Conditions
                ((Attacked unit) is A Hero) Equal to True
                ((Attacking unit) has an item of type Palin's Axe) Equal to True
                (Random integer number between 1 and 100) Less than or equal to 25
    Actions
        Set Palin_Hero = (Attacked unit)
        [B]Trigger - Turn off this trigger[/B]
        Unit - Add Palin's Axe (-15) to Palin_Hero
        Wait 6.00 seconds
        [B]Trigger - Turn on this trigger[/B]
        Unit - Remove Palin's Axe (-15) from Palin_Hero

Just my guess :p
 
Code:
Hero Damage
    Events
        Unit - A unit Is attacked
    Conditions
        And - All (Conditions) are true
            Conditions
                ((Attacked unit) is A Hero) Equal to True
                ((Attacking unit) has an item of type Palin's Axe) Equal to True
                (Random integer number between 1 and 100) Less than or equal to 25
    Actions
        Set Palin_Hero = (Attacked unit)
        [B]Trigger - Turn off this trigger[/B]
        Unit - Add Palin's Axe (-15) to Palin_Hero
        Wait 6.00 seconds
        [B]Trigger - Turn on this trigger[/B]
        Unit - Remove Palin's Axe (-15) from Palin_Hero

Just my guess :p
It will never have -30 then :\
 
I got a strange idea but it should work.
Create a dummy unit, and create it on the map anywhere when the lucky hit happens. Give it 6 seconds expiration timer. Give it to a custom UnitGroup variable

Another trigger checks every second how many of those units are alive, and then calculate to level the ability given to the hero, or just remove it and add it (I think it should stack that way)
Don't forget to remove those dummies when they die
2-3 triggers :)
 
Thanks, i now have:
Code:
Hero Damage
    Events
        Unit - A unit Is attacked
    Conditions
        And - All (Conditions) are true
            Conditions
                ((Attacked unit) is A Hero) Equal to True
                ((Attacking unit) has an item of type Palin's Axe) Equal to True
                (Random integer number between 1 and 100) Less than or equal to 25
    Actions
        Unit - Create 1 Dummy for Player 1 (Red) at (Position of (Attacked unit)) facing Default building facing degrees
        Unit - Order (Last created unit) to Human Priest - Inner Fire (Attacked unit)

Code:
Palin Buff Detection
    Events
        Time - Every 0.10 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        And - All (Conditions) are true
                            Conditions
                                ((Picked unit) is A Hero) Equal to True
                                ((Picked unit) has buff Unknown (BHfs)) Equal to True
                    Then - Actions
                        Unit - Add Palin's Axe (-15) to (Picked unit)
                    Else - Actions
                        Unit - Remove Palin's Axe (-15) from (Picked unit)
But it doesn't stack; i'm using Item Attack Bonus (-15) as ability.
 
Shall it work like this:
Hero 1: Attacker with your Axe
Hero 2: Attacked Unit [with base damage of 100]

Hero 1 attacks.... Hero2 loses 15 damage ... 85left.

3 Secs later
Hero 1 attacks again. Hero2 loses 15 further damage... 70left.

3Secs later

6 seconds after the first attack are over...he regains 15 damage, 85 now.

3Secs later

6 seconds passed after the second attack, Hero 2 regains 15 damage again and is restored. 100.

If you want it like this I could easily create a trigger in JASS for you... doing this in GUI will barely work.

Edit:
Yours wouldn't work properly... that way the hero loses 150damage a second :eek:
 
Shall it work like this:
Hero 1: Attacker with your Axe
Hero 2: Attacked Unit [with base damage of 100]

Hero 1 attacks.... Hero2 loses 15 damage ... 85left.

3 Secs later
Hero 1 attacks again. Hero2 loses 15 further damage... 70left.

3Secs later

6 seconds after the first attack are over...he regains 15 damage, 85 now.

3Secs later

6 seconds passed after the second attack, Hero 2 regains 15 damage again and is restored. 100.

If you want it like this I could easily create a trigger in JASS for you... doing this in GUI will barely work.

Edit:
Yours wouldn't work properly... that way the hero loses 150damage a second :eek:

Yeah this is exactly what i want! :D But with a maximum of 4 stacks (so max is -60 damage, though only very high attack speed would get this).
If you could make this for me big thanks :D
 
// Edited everything...

So... create a new Trigger and convert it to custom text. Replace the script with the one below. You need a item (your axe) and a item ability which is based of item damage. Give it 5levels. 1 - 0 damage 2 - 15 damage 3 - 30 damage 4 - 45 damage 5 - 60 damage. Then look at the green text I wrote in the script and it should work fine. I made it so, that the effect appears almost on hit and not on start attack and denies abusing it.


JASS:
function Conditions takes nothing returns boolean
    return UnitHasItemOfTypeBJ(GetAttacker(),'hval') == true and IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO) == true // exchange 'hval' with the Raw Id of your item --- don't forget the "  '  ' " though
endfunction

function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
if GetUnitAbilityLevel(u,'A000') == 0 then     // exchange 'A000' with the Raw Id of your item - damage ability
    call UnitAddAbility(u,'A000')
endif
    call DisableTrigger(GetTriggeringTrigger())  // This is against abusing it 
    call TriggerSleepAction(0.4)                    //  and to make the effect appear
    call EnableTrigger(GetTriggeringTrigger())   //  on HIT and not on ATTACK start
    call SetUnitAbilityLevel(u,'A000',GetUnitAbilityLevel(u,'A000') + 1)
    call TriggerSleepAction(6) // change the value that gives the time after which the damage is restored
    call SetUnitAbilityLevel(u,'A000',GetUnitAbilityLevel(u,'A000') - 1)
endfunction

//===========================================================================
function InitTrig_Palins_Axe takes nothing returns nothing
    set gg_trg_Palins_Axe = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Palins_Axe,EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerAddCondition(gg_trg_Palins_Axe, Condition(function Conditions))
    call TriggerAddAction( gg_trg_Palins_Axe, function Actions )
endfunction
 
Thank you so much! :D +rep
EDIT: Uhm it gives an error:
The trigger "blabla" must have an initialization function called "InitTrig_blabla"
Then i get a box full with errors and it closes down..?

i put in the right raw ID codes i think..
 
Cool thanks :D But i noticed something else with the spell.. It fires every attack, not 25% chance, how would i change this?
 
Oh sorry missed that part. You didn't mentioned that aside of your trigger where it was involved.. hence I forgot it^^.

Add the two lines at the places I put them. The "// add this line" lines^^.

JASS:
function Conditions takes nothing returns boolean
    return UnitHasItemOfTypeBJ(GetAttacker(),'hval') == true and IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO) == true // exchange 'hval' with the Raw Id of your item --- don't forget the "  '  ' " though
endfunction

function Actions takes nothing returns nothing
local unit u = GetTriggerUnit() 

if GetRandomInt(1,100) <= 25 then   //add this line

    if GetUnitAbilityLevel(u,'A000') == 0 then     // exchange 'A000' with the Raw Id of your item - damage ability
        call UnitAddAbility(u,'A000')
    endif
    
    call DisableTrigger(GetTriggeringTrigger())  // This is against abusing it 
    call TriggerSleepAction(0.4)                    //  and to make the effect appear
    call EnableTrigger(GetTriggeringTrigger())   //  on HIT and not on ATTACK start
    call SetUnitAbilityLevel(u,'A000',GetUnitAbilityLevel(u,'A000') + 1)
    call TriggerSleepAction(6) // change the value that gives the time after which the damage is restored
    call SetUnitAbilityLevel(u,'A000',GetUnitAbilityLevel(u,'A000') - 1)

endif    //add this line

endfunction

//===========================================================================
function InitTrig_Palins_Axe takes nothing returns nothing
    set gg_trg_Palins_Axe = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Palins_Axe,EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerAddCondition(gg_trg_Palins_Axe, Condition(function Conditions))
    call TriggerAddAction( gg_trg_Palins_Axe, function Actions )
endfunction
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top