How to make a seemingly simple custom ability

imakunee

New Member
Reaction score
4
Well, this may be complicated if you feel up to the challenge but you can try out this idea.

Have the trigger select all the units that would be in the cone manually. Use some equation that gets the area of the cone's effect.

Then have the trigger create a dummy unit for each of the selected unit's owners. To be precise, if the trigger selects an enemy unit, have it create a dummy that is allied with that enemy unit.

Make sure the dummy's model is set to .mdl so it has no model. Also give it the locust ability so it can't be selected and is invincible.

Then make sure the dummy's abilities can target allied units and have it cast the spells on the allied unit.

Doing all that makes it so that you don't have to worry about what you can see and can't see. You can also have the trigger deal the damage to the selected units rather than depend on the spell itself (in which case you might want to make the spell deal no damage at all, it would just be for looks and triggering this trigger).

As I said, it could be a little complicated, but manageable. Hardest part is selecting the units in the cone's area without depending on buffs or anything. I know you're new to World Editor but usually getting a tough task like this done really advances your knowledge and helps with experience. Also you can post the code somewhere if you want for others to use and give credit. :D

As for how to set something's model to .mdl:

Go to the unit you want to set the model of.

Open up it's Art - Model File.

Go to the bottom line you can type into. It should be labeled Custom.

Type into that bar only this:

.mdl

Then make sure the selection circle next to the label is checked (has a black dot in it).

Hit OK then you're done. That removes any visual model from it.



Hope this helps at least a little. :)
 

unpro

New Member
Reaction score
1
Joccaren, I already tried your suggestion and it didn't work, making the shade model disappear wouldn't help.

@imakunee
Well, your suggestion swayed me to that direction, and me being too new to this, I resorted to search and managed to find this!

I used the GUI one because I would have greater trouble implementing the JASS one.

So, the trigger is now able to pick the invisible units and apply the relevant debuffs. However, while I did adjust the spells' allowable targets to include allies, the debuffs do not work fully. After some testing, the slow effect works on the affected unit but the faerie fire only applied the armour debuff but did not reveal the unit to the opponent. Any idea how to go about solving this?

P.S. I used the Zone Indicator as a dummy unit so it has no model by default, thus I didn't know about the .mdl thing, good to know anyway, thanks for explaining=)
 

Ayanami

칼리
Reaction score
288
Could you post the full triggers here? Did you ensure that your dummy unit belongs to the caster?
 

unpro

New Member
Reaction score
1
Uh, well here is the trigger:

trigger.png


If I make the dummy unit belong to the caster, the dummy unit cannot see the targets(they have shadowmeld and will be using it 99% of the time) and doesn't cast.

If I make the dummy unit belong to the target, the faerie fire doesn't reveal to the caster.

Dilemma T.T
 

Ayanami

칼리
Reaction score
288
As long as the dummy unit does not belong to you or your teammates, the Faerie Fire will not reveal the units to you or your teammates. Hmm, how about giving your dummy True Sight with a really small area. Then summon it directly next to the enemy units and order it to cast Faerie Fire and remove them.
 

unpro

New Member
Reaction score
1
As long as the dummy unit does not belong to you or your teammates, the Faerie Fire will not reveal the units to you or your teammates. Hmm, how about giving your dummy True Sight with a really small area. Then summon it directly next to the enemy units and order it to cast Faerie Fire and remove them.

Ok, I gave my dummy unit True Sight(Neutral 1), and changed the check dependencies to false. However, it still didn't work. Adding every other available true sight in the same manner also failed. What went wrong?
 

imakunee

New Member
Reaction score
4
Sorry for not rechecking this soon enough. I think what Glenphir meant was that you might have to use two dummy units. You have your first one set up fine, but need to create this new dummy unit.

The new dummy unit will have True Sight and belong to the caster. This dummy unit is the one that casts Faerie Fire since it has the True Sight and can see the invisible unit. Now that the unit casting Faerie Fire belongs to the caster it should reveal the unit to the caster and his allies for the duration of the Faerie Fire.

Hope that works. :D
 

unpro

New Member
Reaction score
1
Thanks for the reply!

I don't see how giving true sight to another dummy unit has any different results from giving true sight to the caster dummy unit. I have tried giving true sight to the caster dummy unit but the true sight apparantly is not fast enough to allow it to target and cast.

I might have not set up true sight properly(too many true sights, which is the ideal one?), so I tried another way: spawn a shade at targetted point before spawning caster dummy unit, both owned by the casting player. The result was no spell casted, which proved that the true sight is not fast enough. Subsequent casts(while the shade was present) were successful in placing the buffs.
 

imakunee

New Member
Reaction score
4
Three ideas, I don't know exactly how well these would work:

1. Have the affected unit share vision with the caster before the dummy casts the faerie fire debuff.

2. Don't cast faerie fire at all! Instead have a unit with Locust and .mdl animation follow the affected unit around using a timed trigger that repeats until the effect is over then just remove those following units. They should have True Sight and belong to the casting player. You may need to create a second trigger that you turn on and off when the spell starts and the effect ends that periodically has each dummy unit instantly move to the appropriate unit it is supposed to be following's location. Make sure they have very high movement speed to keep up.

3. Just have the affected unit and the caster share vision until the spell is done. This is the worst case that I came up with because the caster gets too see everything the affected units own. I don't like this one but thought I'd mention.


Personally I'd say 2 is the best option.
 

unpro

New Member
Reaction score
1
I have to agree with you 2 is the best option. However, I don't know how to create it while keeping it MUI and working with multiple units at a time. Keep in mind the spell is aoe, and two players may cast it at the same time.

The only way I know to code it is create the dummyshade and turn on trigger 2. Trigger 2 moves the last created unit instantly to position of picked unit. In fact, I'm not even certain this would work, let alone work with multiple affected units and MUI.

I'm also wondering if multiple instances of the same trigger can coexist at the same time? And will they clash with each other?
 

imakunee

New Member
Reaction score
4
Use a hashtable. Have a periodic trigger turn on when the spell is cast that every second moves all units of the dummy type to the position of the saved unit. I don't have a good hashtable tutorial in mind because I figured it out myself. I'll find one or create a trigger for you, whatever you want. It's pretty easy actually.

As for the periodic trigger you'd want it to only turn on when the spell is cast then add all the created dummies to a unit group. That unit group is called in the periodic trigger where all those units are instantly moved. Then the trigger checks if there are any units left in the unitgroup. As for killing the dummies I think a generic expiration timer may work if you add it to each one as they're created. I'm not sure if they're necessarily removed from the unit group though.

If the expiration timer doesn't work than you can save an integer that is updated with each call of the periodic trigger that records how long the unit has existed (add 1 each time) until it's at the end of how long the spell should last. Then just kill that one.
 

unpro

New Member
Reaction score
1
imakunee, thanks for that suggestion. I'll try my best to make it first. I found a good tutorial on hashtables here. Below is my attempt at it.

stickyspray.jpg

faeriefirehash.jpg



The dummyshade unfortunately doesn't move =(

I tried fixing the leaks on the 2nd trigger, but apparently I did something wrong. Within 20 casts or so, the game freezes with lag at every cast, with more prominent lag when units are affected. Is my leak-fixing wrong?

Also, another problem is that the true sight of the dummyshade allows the caster to see other non-affected units, despite having a low sight radius. Any ways to prevent this?
 

-Brainiac-

New Member
Reaction score
7
I read your triggers but as far about cones I don't have much experience, just wanted to say that for triggers you can press the "a" button when posting a message and then this appears: [WC3 /WC3] (well with ][ on the inside but that wouldn't reveal it so thats why I typed it this way)

Anyway go to your trigger and select it, then on the top (Above EVENT) thers the name of your trigger, right click and then select "copy as text".

Go back here press the "a" press Ctrl + V (Pasting your trigger on the forum looking like the trigger in your Editor)

looks better then your pictures that you made with a screen and then pasted in paint, just guessing for that though! :D

Succes on your map !
 

imakunee

New Member
Reaction score
4
The reason they aren't following is because you are loading element 2 from the hashtable. You should load element 1 to get the unit that you saved. :p (This is in faeriefirehash)

As for the lag, I think that's because when a unit dies it isn't removed from the group it's in. I'm not entirely sure on this but that may be the reason. You can either reset up the functions to save and update a real with how long the unit has existed then remove it from the game and from the unitgroup after it has existed 5 seconds rather than give it an expiration timer.

Or you may be able to set up a third trigger for when a dummyshade dies to remove it from sprayedunits. I'm not entirely sure it would work but you may as well give this a try to see if it helps the lag before trying the above paragraph's suggestion.

Also some of the lag may be because values are building up in the hashtable as well. You'd want to clear parent hashtable your hashtable if there are no units in sprayed units as well.

As for the true sight problem, did you make sure the true sight's cast range was set down to somewhere around 100, maybe 80 even? I haven't worked with True Sight much so I don't know all the mechanics but I think that would reduce it far enough. Only problem is that it also means the player gets sight of invisible units directly on top of the affected unit. Maybe that could also be part of the spell? I can't think of a way to stop that. If that doesn't work tell me and I'll look deeper into True Sight's mechanics.

And yes, it helps (and is easier for you) if you use the GUI tags when posting your code. As Brainiac said it should look like a gold "a" at the top where you can underline and stuff somewhere near the yellow spoiler triangle. Then you right click the top of your code (where it shows the name just before what your code does) and do copy as text, then paste it inbetween the GUI tags.
 

unpro

New Member
Reaction score
1
Thanks for that tip Brainiac, I must have missed that glancing through the FAQ.

I solved the true sight problem. For the lag, I created the 3rd trigger as you said. To debug it, I added a floating text to reveal the number of units in unitgroup for the dummyshades.

Trigger:
  • stickyspray
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sticky spray
    • Actions
      • Wait 0.10 seconds
      • Unit - Create 1 dummyani (Custom Campaign) for (Triggering player) at (Position of (Triggering unit)) facing 0.00 degrees
      • Unit - Order (Last created unit) to Neutral Alchemist - Healing Spray ((Position of (Triggering unit)) offset by 400.00 towards (Facing of (Triggering unit)) degrees)
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Set Point1 = (Position of (Triggering unit))
      • Set Real1 = (Facing of (Triggering unit))
      • Set Unitgp = (Units within 550.00 of Point1 matching (((Owner of (Matching unit)) Not equal to Player 9 (Gray)) and (((Owner of (Triggering unit)) Not equal to Player 10 (Light Blue)) and ((Unit-type of (Triggering unit)) Not equal to dummy (Custom Campaign)))))
      • Unit Group - Pick every unit in Unitgp and do (Actions)
        • Loop - Actions
          • Set Point2 = (Position of (Picked unit))
          • Set Real2 = (Angle from Point1 to Point2)
          • If (Real2 Less than 0.00) then do (Set Real2 = (Real2 + 360.00)) else do (Do nothing)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Real2 Less than (Real1 + 40.00)
              • Real2 Greater than (Real1 - 40.00)
            • Then - Actions
              • Unit - Create 1 dummy (Custom Campaign) for (Owner of (Picked unit)) at (Position of (Picked unit)) facing 0.00 degrees
              • Unit - Order (Last created unit) to Night Elf Druid Of The Talon - Faerie Fire (Picked unit)
              • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
              • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
              • Unit - Create 1 dummyshade for (Triggering player) at (Position of (Picked unit)) facing 0.00 degrees
              • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
              • Unit Group - Add (Last created unit) to sprayedunits
              • Hashtable - Save Handle Of(Last created unit) as 0 of (Key (Last created unit)) in hashtable
              • Hashtable - Save Handle Of(Picked unit) as 1 of (Key (Last created unit)) in hashtable
              • Trigger - Turn on faeriefirehash <gen>
              • Trigger - Turn on removedeaddummy <gen>
              • Custom script: call RemoveLocation (udg_Point2)
            • Else - Actions
              • Custom script: call RemoveLocation (udg_Point2)
      • Custom script: call RemoveLocation (udg_Point1)
      • Custom script: call DestroyGroup (udg_Unitgp)

Trigger:
  • faeriefirehash
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in sprayedunits and do (Actions)
        • Loop - Actions
          • Set noofdummy = (noofdummy + 1.00)
      • Floating Text - Create floating text that reads (String(noofdummy)) at (Center of (Playable map area)) with Z offset 0.00, using font size 50.00, color (100.00%, 0.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 0.50 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
      • Set noofdummy = 0.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (sprayedunits is empty) Equal to False
        • Then - Actions
          • Unit Group - Pick every unit in sprayedunits and do (Actions)
            • Loop - Actions
              • Set sprayedtar = (Load 1 of (Key (Picked unit)) in hashtable)
              • Set sprayedpoint = (Position of sprayedtar)
              • Unit - Move (Picked unit) instantly to sprayedpoint
              • Custom script: call RemoveLocation (udg_sprayedpoint)
        • Else - Actions
          • Custom script: call DestroyGroup (udg_sprayedunits)
          • Trigger - Turn off removedeaddummy <gen>
          • Trigger - Turn off (This trigger)

Trigger:
  • removedeaddummy
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to dummyshade
    • Actions
      • Unit Group - Remove (Triggering unit) from sprayedunits


The result was a confusing one.

If I casted on a unit, it would display '1' for the full 5 seconds, turning to 0 at the last moment. However, subsequent casts display the floating text '0' once(flashes for a second).

If I casted on a unit, and casted a second time before the first one ends, the counter goes up 1,3,7,15,... The number deviates from the pattern after 5 seconds because the first dummyshade unit is probably removed, so the counter actually goes something like this: 1,3,7,13,28. Another difference is that the floating text lasts for the full 5 second duration for every cast, unlike the first situation where subsequent casts cause a flicker of the floating text.

The most weird thing is that when it gets laggy every cast, when I start casting on another unit, there is no lag at all! Then, I stumbled on the fact that after a min or two passed, casting on the first unit caused no lag either! :confused:

I have to say I'm very new to world editor GUI so I can't visualize how world editor GUI processes the triggers, so I really need help to find out what's happening. :banghead:
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top