removing and readding an ability

Grundy

Ultra Cool Member
Reaction score
35
Code:
NEC Unholy Pact
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to NEC Unholy Pact 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Life of (Casting unit)) Greater than ((Max life of (Casting unit)) x 0.15)
            Then - Actions
                Unit - Set life of (Casting unit) to ((Life of (Casting unit)) - ((Max life of (Casting unit)) x 0.15))
                Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) + ((Max mana of (Casting unit)) x 0.15))
            Else - Actions
                Game - Display to (All players) the text: You do not have enough hit points to cast this spell.
                Unit - Remove NEC Unholy Pact  from (Casting unit)
                Unit - Add NEC Unholy Pact  to (Casting unit)

when the hero has less than 15% hp it says "You do not have enough hit points to cast this spell." and NEC Unholy Pact is removed from the unit but it is not being added again. what wrong?
 
Just order the unit to stop. That should work. Why remove and add an ability?
 
well im removing and re-adding so it'll have no cooldown. this still doesnt work
Code:
NEC Unholy Pact
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to NEC Unholy Pact 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Life of (Casting unit)) Greater than ((Max life of (Casting unit)) x 0.15)
            Then - Actions
                Unit - Set life of (Casting unit) to ((Life of (Casting unit)) - ((Max life of (Casting unit)) x 0.15))
                Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) + ((Max mana of (Casting unit)) x 0.15))
            Else - Actions
                Game - Display to (All players) the text: You do not have eno...
                Unit - Order (Casting unit) to Stop
                Unit - Remove NEC Unholy Pact  from (Casting unit)
                Unit - Order (Casting unit) to Stop
                Unit - Add NEC Unholy Pact  to (Casting unit)
                Unit - Order (Casting unit) to Stop
 
Does the whole trigger not work, or just a specific part in it?

Try using for the event, A unit begins casting an ability
 
Just reset the cooldown. I believe it's:
Code:
Action - Reset ability cooldown for casting unit.
But I got that from one of the triggers in the free code section, since I don't have TFT.
 
Im_On_56k in my first post i said it all works except for the adding ability part.

ShaiTan-Enk that action resets cooldown for all abilties not just the one i want
 
Oh ok, sorry. Maybe I should get TFT before I try to help with TFT problems :P
Maybe you could have it run another trigger at that point which gives the ability back to the unit. It could be that it's having trouble doing both in one trigger. (You could use a unit variable to transport the casting unit between triggers).
 
i tried this
Code:
NEC Unholy Pact
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to NEC Unholy Pact 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Life of (Casting unit)) Greater than ((Max life of (Casting unit)) x 0.15)
            Then - Actions
                Unit - Set life of (Casting unit) to ((Life of (Casting unit)) - ((Max life of (Casting unit)) x 0.15))
                Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) + ((Max mana of (Casting unit)) x 0.15))
            Else - Actions
                Game - Display to (All players) the text: You do not have eno...
                Unit - Remove NEC Unholy Pact  from (Casting unit)
                Set GiveAbilityUnit = (Casting unit)
                Trigger - Run NEC Unholy Pact Add <gen> (ignoring conditions)
Code:
NEC Unholy Pact Add
    Events
    Conditions
    Actions
        Unit - Add NEC Unholy Pact  to GiveAbilityUnit
it doesnt work
 
When you remove the ability the unit isnt "casting unit" anymore. Use "triggering unit" insteed. You can use your first trigger with this change.

"casting unit" and "target of ability..." is different from others. For example the doesnt work well after waits.
 
i also never trust event response units if u are using loads of actions
if its possible i always set the event response unit to a local variable
and use this variable all the time..
 
actually it does work well after waits. casting unit doesnt mean the unit that is casting now, because there could be many units casting spells at the same time. it just means its the unit that cast the spell for the event. but anyway, i tried triggering unit, that didnt work. and i tried
Code:
NEC Unholy Pact
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to NEC Unholy Pact 
    Actions
        Set GiveAbilityUnit = (Casting unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Life of GiveAbilityUnit) Greater than ((Max life of GiveAbilityUnit) x 0.15)
            Then - Actions
                Unit - Set life of GiveAbilityUnit to ((Life of GiveAbilityUnit) - ((Max life of GiveAbilityUnit) x 0.15))
                Unit - Set mana of GiveAbilityUnit to ((Mana of GiveAbilityUnit) + ((Max mana of GiveAbilityUnit) x 0.15))
            Else - Actions
                Game - Display to (All players) the text: You do not have eno...
                Unit - Order GiveAbilityUnit to Stop
                Unit - Remove NEC Unholy Pact  from GiveAbilityUnit
                Trigger - Run NEC Unholy Pact Add <gen> (ignoring conditions)
Code:
NEC Unholy Pact Add
    Events
    Conditions
    Actions
        Unit - Add NEC Unholy Pact  to GiveAbilityUnit
and that still didnt work either
 
I tested "triggering unit" with summon water elemental and blizzard and it worked (casting unit didnt), that is maybe something with the ability? Like it isnt channeling or something?




<Unit - Order GiveAbilityUnit to Stop

For this to work you must paus the unit before and unpaus after. It is new with patch 1.18 i think.
 
Try changing "Set GiveAbilityUnit = (Casting unit)" to "Set GiveAbilityUnit = (Triggering unit)"
 
that action works. it is putting the right unit in the variable. everything else in the whole trigger works. it's just not adding the ability to the unit again
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Probably inflates their numbers so they look better to advertisers.
  • The Helper The Helper:
    Yeah google does not filter those bots. I remember when Apex was doing Google ads I saw the same IPs in there as I was seeing here - google is totally tracking all those bots as traffic and most google traffic, at least ours, was all bots
  • The Helper The Helper:
    oh wow, i bet i can post x links now and do the webp pics now giggity
  • The Helper The Helper:
    ahh anubis blocks anyone that has javascript turned off
  • The Helper The Helper:
    Robot: HTTP client library - i love the new robot :)
  • The Helper The Helper:
    New Science News Forum and it starts out with 420 threads :)
  • The Helper The Helper:
    Technical Support forum name changed To Technology News, there is now a Tech, sci/tech and science forums now :)
  • The Helper The Helper:
    Happy Saturday! Hope everyone has a fantastic weekend!
  • Ghan Ghan:
    We are now on Ubuntu 24.04. Had some issues with the style after the OS/PHP upgrade but now resolved.
    +1
  • Ghan Ghan:
    PHP 8.3 now live
    +1
  • The Helper The Helper:
    Weekend went by too fast. Next weekend I am going to try to do a nature thing - buddy of mine lives by the Colorado river and has some kayaks and invited me to do some kayaking from a place he knows to get on the river.
  • Ghan Ghan:
    That sounds like an adventure.
  • The Helper The Helper:
    400 users all online all looking at latest content
  • The Helper The Helper:
    I wonder how all these bots that sit on the lastest content page get passed anubis or maybe they did not but they are just registering on whos online
  • The Helper The Helper:
    showing up on whos online not registration
  • Ghan Ghan:
    The first gate is stopping all the bots that don't execute javascript.
  • Ghan Ghan:
    That's the main thing with Anubis - no Javascript, no site. Typically you can still get the site to load without Javascript.
  • The Helper The Helper:
    I remember the whole javascript thing, question - how many real people disable that?
  • The Helper The Helper:
    Hell I guess I could go back on the stats to know that - we probably capture that and we know the before and after
  • Ghan Ghan:
    Real users can't really disable Javascript anymore these days.
  • Ghan Ghan:
    The internet is broken without it.
  • Ghan Ghan:
    Bot readable, not human usable.
  • The Helper The Helper:
    got it
  • The Helper The Helper:
    Happy Thursday!
  • The Helper The Helper:
    Check out the new Featured Content feature we apparently got with the forum software upgrade! https://www.thehelper.net/featured/

The Helper Discord

Staff online

Members online

Affiliates

Hive Workshop NUON Dome World Editor Tutorials
Back
Top