Enabling / Disabling Ability

Status
Not open for further replies.
Level 3
Joined
Aug 12, 2008
Messages
34
Greetings :grin:

Once again, I have a question I just cannot figure out. It sounds like this;

A hero learns a skill. This skill is a passive one and is supposed to regen health and move speed. However, whenever out of combat (no damage taken in at least 3 seconds), the spell will improve, healing more every second. In other words, still spell will possibly be switched out with another spell (most likely a "unit" ability, not "hero").
But the problem is, I haven't found any possible way to counter this process backwards. With this I mean that once this unit is attacked or damaged, the skill will return to normal, at the same level and with the same remaining skill points.

Suggestions are warmly welcome and rep is a given ;)

~Razorwind~
 
Weep's GDD can help you out with unit-damaged event detection.

Additionaly; I would suggest using loop trigger that runs with short period and if 'delay' before unit's ability level is increased reaches full duration buff the ability.
Also, each time loop trigger evaluates, check if picked unit has been damaged; if so reset the data.

Damage enter trigger would be here just to set some boolean variable to 'true' meaning, data for given unit should be reseted. Unit Indexer can be usefull too.

  • loop
    • Events
      • Time - Every 0.03 second of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CustomGroup and do Actions
        • Loop - Actions
          • Set u = (Picked unit
          • Set i = (Custom value of u)
          • If (All conditions are true) then do (Then Actions) else do (Else actions)
            • If - Conditions
              • Damaged[i] Equal to True
            • Then - Actions
              • // call reset data
            • Else - Actions
              • Set Delay[i] = Delay[i] - 0.03
              • If (All conditions are true) then do (Then Actions) else do (Else actions)
                • If - Conditions
                  • Delay[i] Less or equal to 0.00 then
                • Then - Actions
                  • // call buff ability
                • Else - Actions
  • onDamage
    • Events
      • GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamagedUnit is in CustomGroup) Equal to True
    • Actions
      • Set i = (Custom value of GDD_DamagedUnit)
      • Set Damaged[i] = true
^Example of such manipulation. Note that it's just an example - shows you the basic. You have to declare CustomGroup; add to it units which should be enumerated for eventual actions; and much much more.

'u' - unit variable
'i' - integer variable
Rest data comes from systems used.
 
Level 8
Joined
Apr 26, 2011
Messages
403
1, create a trigger for change ability to stronger version:

  • // hero_group is the group of your hero
  • Trigger : every 3 second // not damage taken at lease 0-3 seconds
  • action:
  • pick every unit in hero_group and do
    • if current order of pick unit is NOT equal to "attack" then
      • // code for change ability to stronger version
2, create an trigger for change ability to weaker version:

  • // hero_group is the group of your hero
  • Trigger : unit is attacked
  • condition : attacking unit is in hero_group
  • action:
  • if current level stronger_ability for triggering unit is >0 then
    • remove stronger_ability from triggering unit
    • add weaker_ability to triggering unit
  • endif

sorry for bad format, I don't have world editor next to me
 
Level 8
Joined
Apr 26, 2011
Messages
403
I found a better way to do this :

1, create a new ability base on any spell with duration (like poison),
- change duration to 3
- change damage to something (eg, health regen difference between during combat or out of combat)
- change slow speed to something (eg, move speed difference between during combat or out of combat)
- change spell effect to nothing
- put your own icon (eg, name is as "Fighting")

2, create a trigger :

  • Trigger - unit is attacked
  • condition - attcked unit is Hero_001 // Hero_001 is the one with ability
  • if (attacking unit do not have buff "Fighting" then
    • set temp_point = position of attacked unit.
    • create 1 dummy_caster_unit at temp_point
    • set expire timer on last create unit : 1 second
    • add "Fighting" ability to dummy_caster
    • order dummy_caster to cast "Fighting" ability on attacked unit
  • end
  • removeLocation(temp_point)

so everytime your hero is attacked, it will get a "poison" buff that always last for 3 seconds.

you can add trigger for when hero is attacking too.(and add "poison" buff after attack)
 
Status
Not open for further replies.
Top