• 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] Can't figure out this triggin' spell.

Status
Not open for further replies.
Level 1
Joined
Jan 12, 2015
Messages
2
So I decided, in my endless love for all things Medusa, that I would attempt to create one as a hero. I decided that the very first order of business should be making a Petrifying Gaze spell for her, and set about doing so with triggers. I borrowed the Breath of Fire spell to serve as a base, and found a Time Stop spell on youtube to serve as the adjustments I would need for the trigger editor, and everything seemed to have been going swimmingly...

The problem that's perplexing me is that she presently possesses the power to petrify...well everything. Buildings included. For the sake of any scrap of realism, I wish for her not to be able to turn stone to stone.

Setup
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Petrifying Gaze
Actions
Unit - Hide (Triggering unit)
Unit Group - Pick every unit in (Units within 375.00 of (Target point of ability being cast)) and do (Actions)
Loop - Actions
Unit - Pause (Picked unit)
Animation - Change (Picked unit)'s animation speed to 0.00% of its original speed
Animation - Change (Picked unit)'s vertex coloring to (20.00%, 20.00%, 20.00%) with 0.00% transparency
Wait 0.01 seconds
Unit - Unhide (Triggering unit)
Selection - Select (Triggering unit)
Wait 2.00 seconds
Unit Group - Pick every unit in (Units in (Entire map)) and do (Actions)
Loop - Actions
Unit - Unpause (Picked unit)
Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency


That is what I have so far. I'm certain the culprit is the "Unit Group -- Pick every Unit" line in the beginning but am unsure how to change it properly. Any help would be appreciated.

Edit: WOOOW I am SO bad at using forums. I tried so hard and read SO many guides and stickies to make that work and I just failed...
 

Attachments

  • PetGaze.wtg
    2.1 KB · Views: 78
Level 23
Joined
Oct 20, 2012
Messages
3,075
Put your trigger in the middel of [trigger][/trigger] tags so that they would show up like:
  • Setup
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Petrifying Gaze
    • Actions
      • Unit - Hide (Triggering unit)
      • Unit Group - Pick every unit in (Units within 375.00 of (Target point of ability being cast)) and do (Actions)
        • Loop - Actions
          • Unit - Pause (Picked unit)
          • Animation - Change (Picked unit)'s animation speed to 0.00% of its original speed
          • Animation - Change (Picked unit)'s vertex coloring to (20.00%, 20.00%, 20.00%) with 0.00% transparency
          • Wait 0.01 seconds
      • Unit - Unhide (Triggering unit)
      • Selection - Select (Triggering unit)
      • Wait 2.00 seconds
      • Unit Group - Pick every unit in (Units in (Entire map)) and do (Actions)
        • Loop - Actions
          • Unit - Unpause (Picked unit)
          • Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
          • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
It's as easy as CnP and you'd get a lot more help if you do so. :)

Yeah, it petrifies all units in the AOE because you're not sorting the units here:
  • Unit Group - Pick every unit in (Units within 375.00 of (Target point of ability being cast)) and do (Actions)
I haven't touched the WE in almost a year now but as far as I remember, it would go better if you set the unit group in a variable first then just destroy the group there after. Adding the point in a variable and destroying it helps in reducing lag in your map as well. You'll also be able to remove the hide and unhide triggers by sorting the casting unit just like how you'll sort the buildings and other units. You should never use waits in spells. There are a lot of alternatives but I can't explain that atm. Too long to do so.

I'm not so sure if they are correct but your trigger would be something like this
  • Set TargetAbilityCast = (Target point of ability being cast)
  • Set UnitGroupPetrify = (Units within 375.00 of (TargetAbilityCast))
  • Unit Group - Pick every unit in (UnitGroupPetrify) and do (Actions)
    • Loop - Actions
      • If-Then-Else
        • If-Conditions
          • Picked Unit is not equal to (triggering unit)
          • Picked Unit is not equal to (structure)
          • Picked unit is not equal to (Ancient)
        • Then - Actions
          • Petrify actions
        • Else - Actions
          • (Leave this blank instead of using the Do Nothing trigger)
  • Custom Script - call DestroyGroup(udg_UnitGroupPertrify)
  • Custom Script - call RemoveLocation(udg_TargetAbilityCast)
Also, Don't use pause. It could cause bugs or something like that. Use Storm bolt instead to stun your targets. (Just make sure to change the damage to 0 and the duration to the duration of your petrifying spell.) And just change the animation speed of the units affected. I recall that's how people in DOTA code the Chronosphere spell. (Time stops in the Aoe, etc.)

BTW, don't rely on youtube if you want good triggers. Youtube videos about triggers are usually cancer.
 
Level 1
Joined
Jan 12, 2015
Messages
2
Thank you for the advice on how to post the trigger properly. A sticky I read said all I had to do was Copy and Paste it from the "right window of the editor to the hive workshop" and the rest would take care of itself. I suppose I have a different definition in mind and that's where I screwed up.

As for correcting my coding, yours looks much nicer than mine does, and I excitedly went about making the changes. Again, everything went smoothly until I got to the part about choosing "Unit is not equal to a structure". That doesn't seem to be an option I can find using either of our coding attempts. I imagine if it were a plainly presented option, though, I wouldn't be here to begin with.

And LOL, ah yes, youtube. It is clearly as to coders as Wikipedia is to a University report. Please forgive my naivety.
 
Level 29
Joined
Sep 26, 2009
Messages
2,596
First of all, learn to use Channel spell - the spell itself does nothing, but it is meant for triggered spells like the one you made. It has various options to make your life easier too!

That aside, there are better ways to pick units in front of caster. You can pick all enemies nearby the caster and compare the angle [from caster to location of picked unit] to facing angle of the caster. If it is within certain radius from the facing angle, freeze the unit.
Also, by using the condition "(matching unit) belong to an enemy of (owner of (triggering unit))", you can avoid the need to hide the caster and later show him back.
You should avoid the "Pause unit" action by using stunning spell instead. But be aware, that sometime setting 0 to some values in spell means "infinity" - so if your storm bolt spell instantly kills units, change damage from 0 to 1.
You should also avoid waits and use timers or periodic events instead.
Store all units that are petrified by the caster in some unit group so later you can just unfreeze everyone in the unit group instead of going through everyone in the entire map (your approach becomes problematic as the map becomes bigger and bigger with more units in it).

Last thing - you maybe want to consider also checking if the target is looking in the general direction of the caster! I mean afaik Medusa could petrify only those that looked at her - not those that were turned away from her.
 
Level 23
Joined
Oct 20, 2012
Messages
3,075
And LOL, ah yes, youtube. It is clearly as to coders as Wikipedia is to a University report. Please forgive my naivety.

Haha, don't worry. I did that too when I was just starting out as well. I just wanted others to move out of that way asap. xD

As for the Unit is not a structure thing, Nichilus' post above explained it quite nicely. :)
 
Level 14
Joined
Aug 30, 2004
Messages
909
It sounds like Vanity is pretty new to the editor, and some of the suggestions here are rather complex, e.g. using Stormbolt means you need to create invisible units with the locust and a modified stormbolt ability and order them to attack all the units you want to petrify. Vanity, if you're up for it, that is better than pausing. But if you're still beginning and don't want to try something that complex, you can use pause and will probably be fine so long as other abilities and cinematics aren't using it.

One important question: are multiple units going to be using this gaze? If only one unit is using the spell it will be much easier. Answer that, and I'll help you make an easier (though less professional) version if you're still having trouble.

EDIT: I completely forgot to answer your earlier question. The "is this unit a structure" condition is found in the Boolean comparisons. I think it's the default one.
 
Level 6
Joined
Oct 31, 2014
Messages
170
For your trigger I suggest you to create a "Unit group" and you exclude "units belong to an ally of player 1" then you just clear your group at the beginning of your trigger.


Setup
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Petrifying Gaze
Actions
unit group - clear (groupunit1)
Unit - Hide (Triggering unit)
Unit Group - Pick every unit in (Units within 375.00 of (Target point of ability being cast)) and do (Actions)
Loop - Actions
unit - add (picked unit) to (groupunit1)
unit - remove (unit belong to an ally of player1) from (groupunit1)

Unit - Pause all unit from (unitgroup1)
Animation - Change (unitgroup1)'s animation speed to 0.00% of its original speed
Animation - Change (unitgroup1)'s vertex coloring to (20.00%, 20.00%, 20.00%) with 0.00% transparency
Wait 0.01 seconds
Unit - Unhide (Triggering unit)
Selection - Select (Triggering unit)
Wait 2.00 seconds
Unit Group - Pick every unit in (Units in (Entire map)) and do (Actions)
Loop - Actions
Unit - Unpause (Picked unit)
Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency


something like this, you have to exclude structures as well I guess. it should be working.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
This is how I would do it:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Custom script: local unit udg_TempUnit
      • Custom script: local group udg_TempUnitGroup
      • Set TempUnit = (Triggering unit)
      • Set TempLocation = (Target point of ability being cast)
      • Set TempUnitGroup = (Units within 375.00 of TempLocation)
      • Custom script: call RemoveLocation(udg_TempLocation)
      • Unit - Hide TempUnit
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • Set TempUnit2 = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempUnit2 belongs to an enemy of TempPlayer) Equal to True
              • (TempUnit2 is A structure) Equal to False
            • Then - Actions
              • Unit - Pause TempUnit2
              • Animation - Change TempUnit2's animation speed to 0.00% of its original speed
              • Animation - Change TempUnit2's vertex coloring to (20.00%, 20.00%, 20.00%) with 0.00% transparency
              • Wait 0.01 game-time seconds
            • Else - Actions
              • Unit Group - Remove TempUnit2 from TempUnitGroup
      • Unit - Unhide TempUnit2
      • Selection - Select TempUnit2
      • Wait 2.00 game-time seconds
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • Set TempUnit2 = (Picked unit)
          • Unit - Unpause TempUnit2
          • Animation - Change TempUnit2's animation speed to 100.00% of its original speed
          • Animation - Change TempUnit2's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
        • call DestroyGroup(udg_TempUnitGroup)
Here is some explaination:
1. You cannot use (Triggering Unit) or any other event response like that when you used a wait timer or tigger sleep action.
Therefor you must create local variables.

2. You should use exacly the same units from the first group in the second group.
Imagine that you pause units by casting this spell on other units and they got immediately unpaused because the timer of the last spell just ran out.

3. Using variables is faster than (Picked Unit) or whatever, thats why I added everything in variables.

4. Some stuff is merely to fix leaks.

BTW: Don't mind the Animate Death ability... I didn't took the time to create an ability for this.
 
Status
Not open for further replies.
Top