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
 

Faust

You can change this now in User CP.
Reaction score
123
Your hero attacks it with the good chance again before the wait could be over, so it restarts the trigger.
 

Drunken_God

Hopes to get back into Mapmaking with SC2 :)
Reaction score
106
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
 
S

Sausage

Guest
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
 

Faust

You can change this now in User CP.
Reaction score
123
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 :\
 

Faust

You can change this now in User CP.
Reaction score
123
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 :)
 

bananaHUNT

You can change this now in User CP
Reaction score
55
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.
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
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:
 

bananaHUNT

You can change this now in User CP
Reaction score
55
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
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
// 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
 

bananaHUNT

You can change this now in User CP
Reaction score
55
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..
 

bananaHUNT

You can change this now in User CP
Reaction score
55
Cool thanks :D But i noticed something else with the spell.. It fires every attack, not 25% chance, how would i change this?
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
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.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top