• 🏆 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!

2 Problems.

Status
Not open for further replies.
Level 6
Joined
May 8, 2010
Messages
150
1/My spell i created doesn't do damage, this is the trigger below and can somebody tell me what i've done wrong?

[trigger=AOE Slam Spell]
Events
Unit - A unit Begins casting an ability

Conditions
(Ability being cast) Equal to Staff Slam

Actions
Set HammerSlamCast[(Player number of (Triggering player))] = (Casting unit)
Set HammerSlamEnemy[(Player number of (Triggering player))] = (Target unit of ability being cast)
Floating Text - Create floating text that reads Staff Slam! above HammerSlamCast[(Player number of (Triggering player))] with Z offset 0.00, using font size 7.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Set staffslamtext[(Player number of (Triggering player))] = (Last created floating text)
Floating Text - Set the velocity of staffslamtext[(Player number of (Triggering player))] to 64.00 towards 90.00 degrees
Floating Text - Change the fading age of staffslamtext[(Player number of (Triggering player))] to 2.00 seconds
Wait 1.00 seconds
If ((Level of Staff Slam for (Casting unit)) Equal to 1) then do (Unit - Cause HammerSlamCast[(Player number of (Triggering player))] to damage HammerSlamEnemy[(Player number of (Triggering player))], dealing (8.00 x ((Real((Strength of HammerSlamCast[(Player number of (Triggering player))] (Include bonuses)))) / 10.00)) d else do (Do nothing)
Wait 2.00 seconds
Floating Text - Hide staffslamtext[(Player number of (Triggering player))] for (All players)[/trigger]

2/I want to be able to change heroes names to the players name when they choose the hero. <- Using c/p jass or GUI.


Thanks, + rep for helpers again.
 
Level 5
Joined
Jun 14, 2009
Messages
106
As the spell is an area of effect spell, there is no target unit of ability being cast and therefore HammerSlamEnemy becomes equal to no unit. That is the reason why no damage is being dealt. You need to use unit groups in order to pick enemies near the unit and then deal damage to them.
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
Here:
  • Events
    • Unit - A unit Begins casting an ability
  • Conditions
    • (Ability being cast) Equal to Staff Slam
  • Actions
    • Set Loc = (Position of (Triggering unit))
    • Floating Text - Create floating text that reads Staff Slam! above Triggering Unit with Z offset 0.00, using font size 7.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
    • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
    • Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
    • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
    • Unit - Cause (Triggering unit) to damage circular area after 1.00 seconds of radius 300.00 at Loc, dealing (8.00 x ((Real((Strength of Triggering Unit (Include bonuses)))) / 10.00)) damage of attack type Spells and damage type Normal
    • Custom script: call RemoveLocation(udg_Loc)
 
1) You don't need to set the "Casting unit" to a variable. Use "Triggering unit", instead of "Casting unit", it procs 0.015 seconds faster. You use "Triggering player" in the array, when it should be "Owner of (Triggering unit)".

2) Can't be done. The only way to do that is by using a Floating text, constantly moving it at the position of your hero:
  • One
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
    • Actions
      • Floating Text - Create floating text that reads (Name of (Owner of (Sold unit))) above (Sold unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Hashtable - Save Handle Of(Last created floating text) as (Key name) of (Key (Sold unit)) in Hash
      • Unit Group - Add (Sold unit) to DummyGroup
      • Trigger - Turn on Two <gen>
  • Two
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DummyGroup is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in DummyGroup and do (Actions)
            • Loop - Actions
              • Set Text = (Load (Key name) of (Key (Picked unit)) in HashIf the label is not found, this function returns NULL.)
              • Floating Text - Change the position of Text to (Picked unit) with Z offset 0.00
Test Map: View attachment Player Name.w3x
 
Level 6
Joined
May 8, 2010
Messages
150
Problem with the AOS spell, your ideas will make it so it attacks everything in the radius around the hero, even allies.. know how to i can limit to just attacking enemies?

+ Pharoah, i will test and see if i like your name system in the next day and il tell you how it goes:)
+rep when i can again
 
  • Set Point1 = (Position of (Triggering unit))
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units within 300.00 of Point1 matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and do (Actions)
    • Loop - Actions
      • Unit - Cause (Triggering unit) to damage (Picked unit) dealing 500.00 damage of Attack type Spells and Damage type Normal
  • Custom script: call RemoveLocation (udg_Point1)
The condition for the "matching" part is a Boolean comparison, Unit - Unit belongs to an enemy of player.
 
Level 6
Joined
May 8, 2010
Messages
150
Alright, cool cool.
I'l add the custom script in and rewrite the trigger then tell you if it works.

Still doesnt do damage:S.

If ((Level of Staff Slam for (Triggering unit)) Equal to 1) then do (Unit Group - Pick every unit in (Units within 400.00 of StaffSlamCast matching (((Owner of (Matching unit)) is an enemy of (Triggering player)) Equal to True)) and do (Unit - Cause (Casting unit) to damage (Matching unit), dealing (8.00 x ((Real((Strength of else do (Do nothing)

See a problem :S?

Question: An ability such as shock wave.. how would i trigger it so that everything damaged by that spell would have a similar trigger damage effect?
Because the units its effecting arnt in a radius around the hero?

And the name system is perfect- except can i make it so the start of the persons name is more to the left of the unit. So the name doesnt hang off the left side of the unit?:)
Thankyou
 
Last edited:
Level 14
Joined
Nov 18, 2007
Messages
1,084
If ((Level of Staff Slam for (Triggering unit)) Equal to 1) then do (Unit Group - Pick every unit in (Units within 400.00 of StaffSlamCast matching (((Owner of (Matching unit)) is an enemy of (Triggering player)) Equal to True)) and do (Unit - Cause (Casting unit) to damage (Matching unit), dealing (8.00 x ((Real((Strength of else do (Do nothing)
It's supposed to be Picked unit instead of Matching unit when you want to deal damage.
You should also use Triggering unit instead of Casting unit since it's faster. (Though you did do it for the conditional.)
  • If ((Level of Staff Slam for (Triggering unit)) Equal to 1) then do (Unit Group - Pick every unit in (Units within 400.00 of StaffSlamCast matching (((Owner of (Matching unit)) is an enemy of (Triggering player)) Equal to True)) and do (Unit - Cause (Triggering unit) to damage (Picked unit), dealing (8.00 x ((Real((Strength of else do (Do nothing)
It also might be easier for you to use If/Then/Else Multiple Functions since it's easier to edit and you don't need to have Do nothing.
 
Status
Not open for further replies.
Top