• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

spell for hero

Status
Not open for further replies.
Level 17
Joined
Dec 24, 2018
Messages
580
Hello, is there way to created spell like this? : when hero cast spell roar, friend units instead of bonus attack damage they will have kritikal strike or bash or cold attack or ability of orb of corruption.
 
Level 28
Joined
Feb 18, 2014
Messages
3,579
  • Critical Strike Aura
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Roar (Bonus Critical Strike)
    • Actions
      • Set Temp_Point = (Position of (Casting unit))
      • Set Temp_Group = (Units within 600.00 of Temp_Point matching (((Matching unit) belongs to an ally of (Owner of (Casting unit))) Equal to TRUE))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit - Add Critical Strike (Roar Bonus) to (Picked unit)
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Custom script: call DestroyGroup (udg_Temp_Group)
  • Remove Bonus
    • Events
      • Time - Every 0.40 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • 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
              • ((Picked unit) has buff Roar) Equal to FALSE
            • Then - Actions
              • Unit - Remove Critical Strike (Roar Bonus) from (Picked unit)
            • Else - Actions
 

Attachments

  • Critical Strike Aura.w3x
    18 KB · Views: 21
Level 17
Joined
Dec 24, 2018
Messages
580
  • Critical Strike Aura
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Roar (Bonus Critical Strike)
    • Actions
      • Set Temp_Point = (Position of (Casting unit))
      • Set Temp_Group = (Units within 600.00 of Temp_Point matching (((Matching unit) belongs to an ally of (Owner of (Casting unit))) Equal to TRUE))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit - Add Critical Strike (Roar Bonus) to (Picked unit)
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • Custom script: call DestroyGroup (udg_Temp_Group)
  • Remove Bonus
    • Events
      • Time - Every 0.40 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • 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
              • ((Picked unit) has buff Roar) Equal to FALSE
            • Then - Actions
              • Unit - Remove Critical Strike (Roar Bonus) from (Picked unit)
            • Else - Actions
wow this is awesome thanks buddy
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
To add onto Warseeker's example, I'd recommend expanding it a bit more to improve performance.

I attached a map with a working Roar example that will give better results.

And about the 40 second interval thing, Warseeker set it to 0.40, so it'd run 2.5 times per second. He used a "large" number like this because it helps improve performance (it's difficult for the game to loop through 10+ units, 10+ times per second).
 

Attachments

  • Roar Example.w3m
    18.9 KB · Views: 30
Level 17
Joined
Dec 24, 2018
Messages
580
To add onto Warseeker's example, I'd recommend expanding it a bit more to improve performance.

I attached a map with a working Roar example that will give better results.

And about the 40 second interval thing, Warseeker set it to 0.40, so it'd run 2.5 times per second. He used a "large" number like this because it helps improve performance (it's difficult for the game to loop through 10+ units, 10+ times per second).
cant opened
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
The script relies on the removal of the ability by simply checking if the unit has the specific buff or not.
So it should work if the values are set correctly (including object editor values)

Obviously, the periodic timer is set to 0.40 seconds interval. Meaning it only detects every 0.40 seconds.
If you have set the buff duration lower than the interval value or set the interval longer than the buff duration
You're doing it imprecisely, so there will be a noticeable delay based on how long the interval was set to.

Also check if the timer is periodic and not elapsing. Maybe you screwed it after you changed it.
Make use of debug messages;
  • Game - Display to (All players) the text: runs
its hero ability,i tried test in your map replace roar(bonus critical strike) with hero version of roar, and in game after i use roar critikal strike stand 0,4 second but buff still continue. critikal strike was not removed after buf ends in 0,4 second.

Not sure if I'm getting this, but why a buff duration ends very shortly... 0.40 seconds? I mean what's the point on this exactly?

I can't also test the demo maps given here, but based on the posted script it should work (unless there's something illogical)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
Replace Ability being cast with your own ability. Replace Critical Strike (Neutral Hostile) with your passive ability. Replace the Roar buff with the buff that your ability uses.
  • Cast Roar
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Roar
    • Actions
      • Set VariableSet TempPoint = (Position of (Triggering unit))
      • Set VariableSet TempGroup = (Units within 664.00 of TempPoint.)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an ally of (Triggering player).) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is hidden) Equal to False
              • ((Picked unit) is in RoarGroup.) Equal to False
            • Then - Actions
              • Unit - Add Critical Strike (Neutral Hostile) to (Picked unit)
              • Unit Group - Add (Picked unit) to RoarGroup
            • Else - Actions
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Custom script: call DestroyGroup (udg_TempGroup)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Roar Timer <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Roar Timer <gen>
        • Else - Actions
  • Roar Timer
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in RoarGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Roar) Equal to False
            • Then - Actions
              • Unit - Remove Critical Strike (Neutral Hostile) from (Picked unit)
              • Unit Group - Remove (Picked unit) from RoarGroup.
            • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in RoarGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • Remove Roar Extra
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) has buff Roar) Equal to False
      • ((Attacking unit) is in RoarGroup.) Equal to True
    • Actions
      • Unit - Remove Critical Strike (Neutral Hostile) from (Attacking unit)
      • Unit Group - Remove (Attacking unit) from RoarGroup.

Remove Roar Extra will guarantee that a unit will NEVER crit if it doesn't have the Roar buff.

You can set the button position of your passive ability to x:0, y:-11 in order to hide it's icon. This makes it look like the buff is granting all of these bonuses.

There's no point in posting a video. Show us your triggers!
 
Last edited:
Level 17
Joined
Dec 24, 2018
Messages
580
i think is now optimal
buff.png
 
Status
Not open for further replies.
Top