• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Lots of questions :)

Status
Not open for further replies.
Level 11
Joined
Feb 14, 2009
Messages
884
Hello hello! I have a few questions for you!

  1. I want to create an ability that blocks damage based on the hero's STR. I thought about adding a damage reduction ability, but the amount blocked is dynamic, of course, and I don't think I can change an ability's stats in-game. I also tried this, but it doesn't work and I won't bother fixing it cause it's not efficient.

    • Veteran
      • Events
        • Unit - A unit Is attacked
      • Conditions
        • (Unit-type of (Triggering unit)) Equal to Praetorian Captain (Normal)
      • Actions
        • Set VeteranProc = (Random integer number between 1 and 100)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Level of Veteran for (Triggering unit)) Equal to 1
            • VeteranProc Less than or equal to 5
          • Then - Actions
            • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (((Real((Strength of (Attacked unit) (Include bonuses)))) / 4.00) x -1.00) damage of attack type Hero and damage type Normal
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Level of Veteran for (Triggering unit)) Equal to 2
                • VeteranProc Less than or equal to 10
              • Then - Actions
                • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (((Real((Strength of (Attacked unit) (Include bonuses)))) / 2.00) x -1.00) damage of attack type Hero and damage type Normal
              • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Level of Veteran for (Triggering unit)) Equal to 3
                    • VeteranProc Less than or equal to 100
                  • Then - Actions
                    • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing ((Real((Strength of (Attacked unit) (Include bonuses)))) x -1.00) damage of attack type Hero and damage type Normal
                  • Else - Actions
    This one supposedly heals the hero when it procs, but this means that he has already taken damage. I don't like this, and that's why I dumped it.
  2. I have a Misha-based ability that spawnz a pet. I want the cooldown to start when the pet dies.
  3. I have another ability that creates random Flame Strikes on a target area. How can I actually do this? I will have dummies cast Flame Strikes, but how do I keep them inside the target area?
  4. And I have a 3rd ability that deals random damage. Is there a way to adjust the cooldown based on the damage dealt using a formula?

That's it for now, I hope that you can help me! :cool:
Thanks in advance! :grin:
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
1. Create a trigger that has an action that adds an event "unit takes damage" to your damage detction trigger. Then in the damage detection trigger, set damage taken to a variable and reduce it based on your str formula. Then set life of the triggering unit to life of triggering unit + str reduction.

So you take damage but instantly heal. The trouble comes when your health is low and your hero dies before it can get the reduction back. In that case you need to instantly revive the hero, and then give life back. Also check that if the returned life still isn't enough to keep the unit alive, then kill it.

I can make the trigger for you if you need it. Or if someone else has a better idea, I'd be interested in hearing it. I'm using the same kind of system right now.

3. Use point with polar offset, and use random distance.
 
Level 11
Joined
Feb 14, 2009
Messages
884
Yeah, that's what I tried to do myself. But there is a problem when the hero receives a fatal hit, as you said. Never mind, I'll implement your idea right now and I'll change it if something better comes up.

Thanks for 3) too :)
 
Last edited:
Level 11
Joined
Feb 14, 2009
Messages
884
@xBlackRose

Hm, that's a really good idea. Thanks!

@Maker

Hm, I can't use "Unit takes damage" event as you suggested, since it is only available in the "Specific unit" event. I tried to save the unit in a variable, but it still won't let me use it.
 
Last edited:
Level 10
Joined
Aug 19, 2008
Messages
491
Don't double post, there's an edit button you know...

2: Something using two blank abilities and one dummy ability that does the summon, don't know how exactly
3: Put this function in the map header
JASS:
    //Function made by Vexorian
    //Selects a random region in a disk. All regions have the same chance of beeing choosen
    function GetRandomPointInDisk takes real centerx, real centery, real minradius, real maxradius returns location
        local real d = SquareRoot(GetRandomReal(minradius * minradius, maxradius * maxradius))
        local real a = GetRandomReal(0, 2 * bj_PI)
        return Location(centerx + d * Cos(a), centery + d * Sin(a))
    endfunction
  • Custom script: set udg_<Your location> = GetRandomPointInDisk( <X cooridnate of location>, <Y coordinate of location>, <minimum radius>, <maximum radius> )
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Hm, I can't use "Unit takes damage" event as you suggested, since it is only available in the "Specific unit" event. I tried to save the unit in a variable, but it still won't let me use it.

  • Trigger 001
    • Events
    • Conditions
    • Actions
      • Trigger - Add to Some Trigger <gen> the event (Unit - Temp_Unit Takes damage)
Temp_Unit is your hero stored to a variable.
 
Status
Not open for further replies.
Top