I have no idea on how to do this right

Xialian

Member
Reaction score
8
Hey! I've been thinking really hard about making a spell that works something along the lines of the hammer throw that Thor has in Smite and I have had great fun trying to make it with dummy things and all that stuff.
Note: The point it travels to and the hammer itself are preset to make triggering easier.

When he casts the spell, a flag is planted, representing the spot the hammer will travel to. The hammer is then thrown immediatly and will travel to the destination marked, damaging enemies getting near the hammer. The hammer gets to the flag, and is then stuck.

The trigger works something like this: Hammer is sent to go to a region, that is set at the same point as the flag. When it gets to the region, it should travel back to the Hero, but it doesn't; it just stays there.

On a site note, I also have no idea on how to post triggers, so I'm sorry about the sparesome details. I will gladly post them when I learn how to, but I won't promise they'll be pretty!
 

OMGOMGOMG

UMBWGMG (Unidentified Human Being.)
Reaction score
28
When you right click on the trigger, you have the option to copy the trigger as a comment or something. You can copy the trigger here with
[.wc3] and [./wc3] (without the '.'s) We'll need to see the code to help you.
 

Xialian

Member
Reaction score
8
I use a lot of different triggers to make it easier for myself to understand, what I'm doing.

Trigger:
  • Hammer Throw Toss
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Paladin
      • (Ability being cast) Equal to Hammer Throw
    • Actions
      • Set HolyPower = (Mana of ValgtHero)
      • Set HammerLevel = (Level of Hammer Throw for ValgtHero)
      • Set Hammer = Hammer Throw Dummy 0010 <gen>
      • Set Hammer_Point = Hammer Throw Point 0012 <gen>
      • Region - Center HammerReturn <gen> on (Position of ValgtHero)
      • Region - Center HammerPoint <gen> on (Target point of ability being cast)
      • Unit - Move Hammer_Point instantly to (Center of HammerPoint <gen>)
      • Animation - Change Hammer's size to (100.00%, 100.00%, 100.00%) of its original size
      • Animation - Change Hammer_Point's size to (100.00%, 100.00%, 100.00%) of its original size
      • Animation - Change Hammer's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • Animation - Change Hammer_Point's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • Unit - Move Hammer instantly to (Center of HammerReturn <gen>)
      • Unit - Make Hammer face Hammer_Point over 0.00 seconds
      • Unit - Order Hammer to Right-Click (Center of HammerPoint <gen>)
      • Trigger - Turn on Hammer Collision <gen>
      • Trigger - Run Hammer A Switch Teleport <gen> (checking conditions)
    • Hammer Collision
      • Events
        • Unit - A unit comes within 75.00 of Hammer Throw Dummy 0010 <gen>
      • Conditions
        • (Owner of (Triggering unit)) Not equal to Player 1 (Red)
        • ((Triggering unit) is A structure) Equal to False
      • Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Level of Hammer Throw for ValgtHero) Equal to 1
          • Then - Actions
            • Unit - Cause ValgtHero to damage (Triggering unit), dealing (45.00 + (HolyPower x 0.25)) damage of attack type Spells and damage type Normal
          • Else - Actions
    • Hammer Return
      • Events
        • Unit - A unit enters HammerPoint <gen>
      • Conditions
        • (Entering unit) Equal to Hammer
      • Actions
        • Unit - Order Hammer to Right-Click (Center of HammerReturn <gen>)
        • Trigger - Turn on Hammer Remove Region <gen>
        • Trigger - Turn on HammerReturnRegionCheck <gen>
    • Hammer Remove
      • Events
      • Conditions
      • Actions
        • Animation - Change Hammer's size to (0.00%, 0.00%, 0.00%) of its original size
        • Animation - Change Hammer_Point's size to (0.00%, 0.00%, 0.00%) of its original size
        • Animation - Change Hammer's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
        • Animation - Change Hammer_Point's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
        • Trigger - Turn off Hammer Collision <gen>
        • Trigger - Run Hammer A Switch Throw <gen> (checking conditions)
    • Hammer Remove Region
      • Events
        • Unit - A unit enters HammerReturn <gen>
      • Conditions
        • (Entering unit) Equal to Hammer
      • Actions
        • Animation - Change Hammer's size to (0.00%, 0.00%, 0.00%) of its original size
        • Animation - Change Hammer_Point's size to (0.00%, 0.00%, 0.00%) of its original size
        • Animation - Change Hammer's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
        • Animation - Change Hammer_Point's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
        • Trigger - Turn off Hammer Collision <gen>
        • Trigger - Run Hammer A Switch Throw <gen> (checking conditions)
    • Hammer A Switch Teleport
      • Events
      • Conditions
        • (ValgtHero is alive) Equal to True
      • Actions
        • Player - Disable Hammer Throw for Player 1 (Red)
        • Player - Enable Hammer Throw (Teleport) for Player 1 (Red)
    • Hammer A Switch Throw
      • Events
      • Conditions
        • (ValgtHero is alive) Equal to True
      • Actions
        • Player - Enable Hammer Throw for Player 1 (Red)
        • Player - Disable Hammer Throw (Teleport) for Player 1 (Red)
        • Unit - Set level of Hammer Throw for ValgtHero to HammerLevel
    • Hammer Switch Pos
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Hammer Throw (Teleport)
      • Actions
        • Unit - Move ValgtHero instantly to (Position of Hammer)
        • Trigger - Run Hammer Remove <gen> (checking conditions)
        • Trigger - Run Hammer A Switch Throw <gen> (checking conditions)
    • HammerReturnRegionCheck
      • Events
        • Time - Every 0.20 seconds of game time
      • Conditions
      • Actions
        • Region - Center HammerReturn <gen> on (Position of ValgtHero)


It's supposed to throw it to the marker (flag, Hammerpoint), damaging enemies along the way and the Paladin should then be able to teleport to the hammer at will. That's why there are two remove and ability switch triggers. One for when he teleports and one for when it comes back, because it won't do both, but it may not make it any less confusing :)

Also, the unit variables being repeated at the start are experimental, don't look at those two.
 

afisakov

You can change this now in User CP.
Reaction score
37
"Unit - Order Hammer to Right-Click (Center of HammerPoint <gen>)"
Does this mean the hammer is a unit (presumably flying)?

Also, does the hammer actually do damage on its initial flight?
Might make sense to check to see if triggers are interfering with each other.

P.S. It would probably make sense to temp disable the teleport to hammer part of the trigger until the rest starts working. Makes the code cleaner to look at.
 

Xialian

Member
Reaction score
8
Yes, the hammer is a unit. And it deals damage whenever enemy units come within range. I'm not sure about what you mean about the teleport. That is required to make it look like he threw it.
 

afisakov

You can change this now in User CP.
Reaction score
37
by teleport I was referring to the option for him to terminate the ability by teleporting himself to the hammer.
It makes the trigger longer to read and for the time being makes it a harder to locate the source of the problem.

Also I would suggest adding a game- text message to "Hammer Return" so you can see for certain if that event fires.

Also I see that that you have a trigger to turn on " Hammer Remove Region", does anything turn it off? aka is there anything to prevent it from firing the moment the hammer is trigger-moved to hero location at the start of the trigger?
- this is part of reason I asked if hammer actually deals damage
 

Xialian

Member
Reaction score
8
Oh ok, I understand now.

I will do that in a little while.

You can't see which things are initially enabled or disabled here. The Hammer Remove Region is disabled until the hammer reaches Hammer Point, where it is enabled and then disabled again whenever he teleports/the hammer returns.
 

Xialian

Member
Reaction score
8
Ok, it seems that the hammer never "actually" touches the HammerPoint region for some reason. I will keep investigating this matter :)
 

OMGOMGOMG

UMBWGMG (Unidentified Human Being.)
Reaction score
28
There is an 'Edit' button, so you can edit posts instead of double-posting.
 

afisakov

You can change this now in User CP.
Reaction score
37
The best solution I know, is to do it as triggered shockwave. The basic premise.
trigger 1 sets locations and calculates angle.
trigger 2 is periodic and moves dummy unit (in ur case the hammer) and deals damage.
after it runs you will also have to trigger way back, which would be similar to path to target except for way back angle has to be calculated in periodic trigger to it goes toward current unit position instead of where unit was when thrown.

I have a trigger that does it in Jass for my map, but will try to explain the GU equivalent.
you would replace druid1 with ValgtHero, create several location (or point) variables, probably replace magmahit with hammerhit.
Since you make variables with wc3editor, you need to type udg_ before their names in any RemoveLocation or DestroyGroup event.
Code:
function Trig_magma_Conditions takes nothing returns boolean
return (GetSpellAbilityId()=='A0Q4')
endfunction
//the condition: checks spellid-same as ur (Ability being cast) Equal to Hammer Throw
function Trig_magma_Actions takes nothing returns nothing
set druid1=GetSpellAbilityUnit() //defines caster, I think u used ValgtHero
set tp1=GetUnitLoc(druid1) -location of caster
set hammertarget=GetSpellTargetLoc()- target location
set rangle2=AngleBetweenPoints(tp1,hammertarget) -rangle2 is what I named a "real" variable used here to store angle
set magmahit=CreateGroup()
call CreateNUnitsAtLoc(1,'h02J',GetOwningPlayer(druid1),tp1,rangle2) -you would just move your hammer instead, since you do not destroy it and do not need MUI
call RemoveLocation(tp1) -you would use udg_tp1 instead of just tp1 here, custom script
set magmadummy=GetLastCreatedUnit() -not needed for you since hammer prob already assigned to variable
firstpass=true
call EnableTrigger(trg_magmap)
endfunction
 
function magmaenemy takes nothing returns boolean
return IsUnitAliveBJ(GetFilterUnit()) and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(druid1)) and (IsUnitInGroup(GetFilterUnit(),magmahit)==false)
-this is conditions for whom to hit, you will prob use your own
endfunction
function dr1_dam takes nothing returns nothing
call GroupAddUnitSimple(GetEnumUnit(),magmahit)
call UnitDamageTargetBJ(druid1,GetEnumUnit(),dx,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_MAGIC)
-explained inside other part of trigger, do not worry about this
endfunction
 
function Trig_magmap_Actions takes nothing returns nothing
set dx=45.00 + (HolyPower x 0.25)
set tp1=GetUnitLoc(magmadummy)
set rangle2=AngleBetweenPoints(tp1,hammertarget)
tp2=PolarProjectionBJ(tp1,20,rangle2) -polar projection sets new point an angle from old one and a fixed distance (in this case 20), should be set to variable to avoid point leaks
call SetUnitPositionLoc(magmadummy,tp2)
set tg=GetUnitsInRangeOfLocMatching(75,tp2,Condition(function magmaenemy))
-GUI version is set variable "tg" or wahtever you named it equal to units within area (range of hammer) matching conditions (use "and" conditions to get all the ones you want in)
call ForGroupBJ(tg,function dr1_dam)- unitgroup-pick every unit in group and do actions- damage picked unit for dx, add picked unit to magmahit (to avoid hitting twice on one pass
call DestroyGroup(tg) -to avoid group leak, custom script, you would use udg_tg where tg is whatever you named the temporary group
if distance between points (tp2,hammerpoint)<75 then
call SetUnitPositionLoc(magmadummy,hammerpoint)
call disabletrigger(trg_magmap)
run setup functions for a similar trigger that would move hammer to caster, it would be almost exactly the same except instead of calculating angle to hammerpoint it would calculate angle to location of your paladin (which has to be stored as a temp point and removed to eliminate leaks) -
endif
call RemoveLocation(tp1)
call RemoveLocation(tp2)
endfunction

sorry that this is all rather complicated, I tried to explain what I thought might not be easy to understand
If you run into problems making this post what you have thus far and where you are confused and I will try to explain further.
 

Xialian

Member
Reaction score
8
Okay! I have no idea on, how JASS works, but I will try your method sometime. Thanks for your suggestions, though. I tried recreating my triggers from scratch in another map (regions may have been bugging in the map I was using, don't ask why or how), but same result. Your thing may be the solution, but we'll see =)

(Also, for clarity, "Valgt" is Danish and means "Chosen" and it's meant as the hero chosen at the start of the map via Dialog Buttons (it's a PvE map, for personal use only))

Ok, looking at it, I have no idea on how to set it up. It looks like one big mess of Actions. Could you try setting it up like an ordinary WC3 trigger? That would be really helpful! Thanks in advance!
 

afisakov

You can change this now in User CP.
Reaction score
37
I assumed for the first trigger, you already know the setup... unit starts the effects of an ability, and the condition is essentially the same one you where using.
For the second trigger, the one I have named magmap- the event is timed-periodic 0.03 seconds (I should have told you that earlier) and it has no conditions except if/then during its execution. the periodic one is intended to be turned on by the first trigger and turned off by:
Code:
if distance between points (tp2,hammerpoint)<75 then
call SetUnitPositionLoc(magmadummy,hammerpoint)
[B]call disabletrigger(trg_magmap)[/B]
run setup functions for a similar trigger that would move hammer to caster, it would be almost exactly the same except instead of calculating angle to hammerpoint it would calculate angle to location of your paladin (which has to be stored as a temp point and removed to eliminate leaks) -
endif
which is an if/then/else that calculates the distance (I think this is a real, not an integer) between where the hammer is and its target location and ends the periodic if close enough.
for your needs you would likely have to set a real variable to the distance between points and then compare to 75 or 20 or whatever you feel is close enough
 

Xialian

Member
Reaction score
8
Still sounds confusing, but I'll try it out and see if I can make any sense of it somehow :)
 

afisakov

You can change this now in User CP.
Reaction score
37
ok, I did my best to convert it into GUI for you, hopefully without making any mistakes in the process. It should be leakless.
Making the interrupt to tleport hero to hammer will be your job later, I was just trying to make it reliably hit target and come back, doing damage along the way
Trigger:
  • hammercast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Storm Bolt
      • (Triggering unit) Equal to ValtgHero
    • Actions
      • Set tp1 = (Position of ValtgHero)
      • Set hammerpoint = (Target point of ability being cast)
      • Set H_angle = (Angle from tp1 to hammerpoint)
      • Unit - Move hammer instantly to tp1, facing hammerpoint
      • Animation - Change hammer&#039;s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • Set Hammer_damage = (450.00 + 1.00)
      • Custom script: call RemoveLocation(udg_tp1)
      • Trigger - Turn on hammer periodic &lt;gen&gt;

Trigger:
  • hammer periodic
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set tp1 = (Position of hammer)
      • Set tp2 = (tp1 offset by 20.00 towards H_angle degrees)
      • Unit - Move hammer instantly to tp2, facing hammerpoint
      • Set temp_group = (Units within 75.00 of tp2 matching (((((Triggering unit) is A structure) Equal to False) and ((Owner of (Matching unit)) Not equal to Player 1 (Red))) and (((Matching unit) is in hammerhit) Equal to False)))
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Cause ValtgHero to damage (Picked unit), dealing Hammer_damage damage of attack type Spells and damage type Normal
          • Unit Group - Add (Picked unit) to hammerhit
      • Custom script: call DestroyGroup(udg_temp_group)
      • Set dist = (Distance between tp2 and hammerpoint)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • dist Less than or equal to 60.00
        • Then - Actions
          • Unit - Move hammer instantly to hammerpoint, facing Default building facing degrees
          • Trigger - Turn off (This trigger)
          • Unit Group - Remove all units from hammerhit
          • Trigger - Turn on hammer periodic 2 &lt;gen&gt;
        • Else - Actions
      • Custom script: call RemoveLocation(udg_tp1)
      • Custom script: call RemoveLocation(udg_tp2)

Trigger:
  • hammer periodic 2
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set tp1 = (Position of hammer)
      • Set hammerpoint = (Position of ValtgHero)
      • Set H_angle = (Angle from tp1 to hammerpoint)
      • Set tp2 = (tp1 offset by 20.00 towards H_angle degrees)
      • Unit - Move hammer instantly to tp2, facing hammerpoint
      • Set temp_group = (Units within 75.00 of tp2 matching (((((Triggering unit) is A structure) Equal to False) and ((Owner of (Matching unit)) Not equal to Player 1 (Red))) and (((Matching unit) is in hammerhit) Equal to False)))
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Unit - Cause ValtgHero to damage (Picked unit), dealing Hammer_damage damage of attack type Spells and damage type Normal
          • Unit Group - Add (Picked unit) to hammerhit
      • Custom script: call DestroyGroup(udg_temp_group)
      • Set dist = (Distance between tp2 and hammerpoint)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • dist Less than or equal to 60.00
        • Then - Actions
          • Unit - Move hammer instantly to hammerpoint, facing Default building facing degrees
          • Animation - Change hammer&#039;s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
          • Trigger - Turn off (This trigger)
          • Unit Group - Remove all units from hammerhit
        • Else - Actions
      • Custom script: call RemoveLocation(udg_tp1)
      • Custom script: call RemoveLocation(udg_tp2)
      • Custom script: call RemoveLocation(udg_hammerpoint)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top