Passive ability question (sorta)

Avaleirra

Is back. Probably.
Reaction score
128
Hi, I was wondering how to make it so that a passive ability on a unit triggers at a certain point.

Here are some examples of what I'm trying to create (but don't know how to trigger :(

1. Let's say a unit has a passive ability that makes it invulnerable at a certain amount of health

2. A unit has a passive ability that makes it charge at the closest hostile unit

I just need to get the hang of making these kind of spells.


Thanks!
(if I'm not being clear please tell me)

EDIT: forgot one :p

3. A unit has a passive ability that makes it create illusions when it enters combat.
 

roXplosive

New Member
Reaction score
15
For the first thing I have made something that is basicaly giving the hints :

JASS:

function Trig_InvulnerabilityLearn_Conditions takes nothing returns boolean
    return GetLearnedSkill()=='A000'
    //Get ability code of your ability from object editor by pressing Ctrl+D
endfunction

function Trig_InvulnerabilityLearn_Actions takes nothing returns nothing
    call TriggerRegisterUnitEvent( gg_trg_InvulnerabilityDoAction, GetTriggerUnit(), EVENT_UNIT_DAMAGED )
endfunction

//===========================================================================
function InitTrig_InvulnerabilityLearn takes nothing returns nothing
    set gg_trg_InvulnerabilityLearn = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_InvulnerabilityLearn, EVENT_PLAYER_HERO_SKILL )
    call TriggerAddCondition( gg_trg_InvulnerabilityLearn, Condition( function Trig_InvulnerabilityLearn_Conditions ) )
    call TriggerAddAction( gg_trg_InvulnerabilityLearn, function Trig_InvulnerabilityLearn_Actions )
endfunction


JASS:

function Conditions takes nothing returns boolean
 return GetUnitStatePercent(GetTriggerUnit(),UNIT_STATE_LIFE,UNIT_STATE_MAX_LIFE)<= 30.00
 // 30% or another percent as you see fit ; maybe even a value determined by skill level of invincibility
endfunction

function Trig_InvulnerabilityDoAction_Actions takes nothing returns nothing
   call UnitAddAbility(GetTriggerUnit(),'Avul') //adds ability invulnerable neutral
   //do other actions and after a while remove invulnerability or use antother trigger to do it
   //I'm thinking of another trigger if you want to make the units lose invulnerability after they regenerated 
   //Idk how to add cooldown to passive abilities because it would most likely need one 
   call UnitRemoveAbility(GetTriggerUnit(),'Avul')
endfunction

//===========================================================================
function InitTrig_InvulnerabilityDoAction takes nothing returns nothing
    set gg_trg_InvulnerabilityDoAction = CreateTrigger(  )
    call TriggerAddCondition( gg_trg_InvulnerabilityDoAction , Condition(function Conditions))
    call TriggerAddAction( gg_trg_InvulnerabilityDoAction, function Trig_InvulnerabilityDoAction_Actions )
endfunction


For the second function I think it would be appropriate to make a periodic trigger checking if around the unit having ability X are enemies of it's owning player . If the closest enemy (select from a group) is farther away than a minimal value then charge him . You could make a group of units that are performing charge actions to they won't prevent them from changing directions in midcharge if another enemy blinks closerthan the first charge target . The minimal distance treshold is there so your units won't permacharge . This can be done in GUI and I hate GUI because it's so slow (tried to make the first triggers in GUI but got bored and just converted them to custom text ) .

As for number 3 I don't have any idea because I don't know how to determine if a unit wasn't attacking and the suddenly started attacking . And if so you could abuse this by spamming stop every attack . Imho I don't think it would work .
 

Avaleirra

Is back. Probably.
Reaction score
128
Sorry, I don't know any JASS.....I'm just getting the hang of GUI. Thanks for posting though :)
 

Tom Jones

N/A
Reaction score
437
The first one is relatively simple:
Trigger:
  • Cant touch this onLearn
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to to *Some Spell*
      • (Learned skill level) Equal to 1
    • Actions
      • Trigger - Add to Cant touch this Activate <gen> the event (Unit - (Triggering unit)'s life becomes Less than *Some Real*)

Trigger:
  • Cant touch this Activate
    • Events
    • Conditions
    • Actions
      • Unit - Make (Triggering unit) Invulnerable
      • Wait until ((Life of (Triggering unit)) Greater than or equal to *Some Real*), checking every 1.00 seconds
      • Unit - Make (Triggering unit) Vulnerable
 

roXplosive

New Member
Reaction score
15
Trigger:
  • Cant touch this Activate
    • Events
    • Conditions
      • (Percentage life of (Triggering unit)) Less than 30.00
    • Actions
      • Unit - Make (Triggering unit) Invulnerable
      • Wait until ((Life of (Triggering unit)) Greater than or equal to *Some Real*), checking every 1.00 seconds
      • Unit - Make (Triggering unit) Vulnerable


TomJones you have forgotten to add a condition for life treshold in activation . This should do it (forgot to check real comparison first time I tried ; only tried out integer comparison :) me and gui :thdown: ).
 

Avaleirra

Is back. Probably.
Reaction score
128
Oh btw the unit isn't a hero, so how would this change the trigger?

And any idea for the second ability?


EDIT: just realized something... This unit would be impossible to kill right? Or can you add a cooldown to passive abilities?
 

Yoshii

New Member
Reaction score
74
Oh btw the unit isn't a hero, so how would this change the trigger?

And any idea for the second ability?


EDIT: just realized something... This unit would be impossible to kill right? Or can you add a cooldown to passive abilities?

yes it would be it unkillable, why would you want to make a unit invincible at low hp if you want a cooldown on the ability?
As for the second ability its kinnda complex tbh unless there is an ability that do it which I dont think there are.
 

Avaleirra

Is back. Probably.
Reaction score
128
Okay thanks yoshii, but how can I make it so that the first ability can only happen once?

EDIT: better yet, how can I make it so that the unit is only invincible for 5 seconds?
 

Yoshii

New Member
Reaction score
74
Okay thanks yoshii, but how can I make it so that the first ability can only happen once?

EDIT: better yet, how can I make it so that the unit is only invincible for 5 seconds?
well even with a 5second cooldown if the unit has less than HP X the trigger will just run again, if its a general unit then its a problem.

on the other hand if the unit is already on the map at start up you can refer to it and have a boolean variable to make it only work once for example a boss
Make a new variable of type boolean called Once
event: a specific unit (select the unit on your map) has HP less than X
cond: if Once=false
action:make triggering unit invulnerable
wait 5 game-time second.
-set Once=true
 

SuperSoldier

New Member
Reaction score
10
Wouldn't it be easier for the first and third one to create a spell for each one then give it to the unit when the time comes, make him use it, then get rid of it?

As for the second spell you should be a bit more specific. You said you wanted the hero to charge at the nearest hostile unit, but do you want it to be like if they are too close he won't charge and if someone is within that too close range he won't charge at all :confused: Do you want it to have a cooldown/one time use?
And Yoshii's method isn't as good, a better way would be to just turn the trigger off wouldn't it?

EDIT: Sorry, at school, not going to be on comp again.
 

Yoshii

New Member
Reaction score
74
Wouldn't it be easier for the first and third one to create a spell for each one then give it to the unit when the time comes, make him use it, then get rid of it?

As for the second spell you should be a bit more specific. You said you wanted the hero to charge at the nearest hostile unit, but do you want it to be like if they are too close he won't charge and if someone is within that too close range he won't charge at all :confused: Do you want it to have a cooldown/one time use?
And Yoshii's method isn't as good, a better way would be to just turn the trigger off wouldn't it?

EDIT: Sorry, at school, not going to be on comp again.
you could turn the trigger off incase of a boss but a general unit it wouldnt work out. reading your post i got the idea to do number 3

instead of making the unit invulnerable via trigger; give the unit divine shield ability have it use it(make it last 6 second) and Make sure the cooldown on divine shield is set to like 9999 so the unit wont use it again.

simply getting rid of divine shield will not do as the trigger will run again and add it again.
 

Yoshii

New Member
Reaction score
74
Could you show me the trigger please :p


+rep if this works
Event: a unit has HP less than X
cond:
action: Unit add Divine Shield to triggering unit
- Unit order triggering unit to Divine Shield

now in object editor of the ability Divine SHield
set its mana cost to 0 (level 1)
set its cooldown to 9999(lvl 1)
set its duration on hero/non hero to 6(lvl 1)
 

Yoshii

New Member
Reaction score
74
What would the condition be? Thanks btw :D
none there isnt a need for any
edit: actually there is one sec
Condition: triggering unit belong to computer player ( if not you own unit could gain it not sure if thats what you want as you would be stuck with Divine shield)
 

Avaleirra

Is back. Probably.
Reaction score
128
Hmmm, I thought there would be... It's not a hero btw would that change anything?
 

Yoshii

New Member
Reaction score
74
Hmmm, I thought there would be... It's not a hero btw would that change anything?
doesnt matter as long as the unit can cast it(it can since it cost 0 mana and you just gave it the ability).Remenber tho its currently to every unit, tho including your own they will have the divine shield ability if hp get low.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1
  • 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