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

[Trigger] 2 problems with a custom ability

Status
Not open for further replies.
Level 29
Joined
Jul 29, 2007
Messages
5,174
Didn't have the strength to censor my ability as I usually do lol, if you wanna steal it... steal it :hohum:

  • Line Killing Teleports
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Line Killing Teleports
    • Actions
      • Unit - Pause (Triggering unit)
      • Unit - Turn collision for (Triggering unit) Off
      • Set TempLoc_LineKillingTeleports[0] = (Position of (Triggering unit))
      • Set TempLoc_LineKillingTeleports[1] = (Target point of ability being cast)
      • Set Real = ((Distance between TempLoc_LineKillingTeleports[0] and TempLoc_LineKillingTeleports[1]) / 10.00)
      • Set TempLoc_LineKillingTeleports[2] = (TempLoc_LineKillingTeleports[0] offset by Real towards (Facing of (Triggering unit)) degrees)
      • Set TempLoc_LineKillingTeleports[3] = (TempLoc_LineKillingTeleports[0] offset by (2.00 x Real) towards (Facing of (Triggering unit)) degrees)
      • Set TempLoc_LineKillingTeleports[4] = (TempLoc_LineKillingTeleports[0] offset by (3.00 x Real) towards (Facing of (Triggering unit)) degrees)
      • Set TempLoc_LineKillingTeleports[5] = (TempLoc_LineKillingTeleports[0] offset by (4.00 x Real) towards (Facing of (Triggering unit)) degrees)
      • Set TempLoc_LineKillingTeleports[6] = (TempLoc_LineKillingTeleports[0] offset by (5.00 x Real) towards (Facing of (Triggering unit)) degrees)
      • Set TempLoc_LineKillingTeleports[7] = (TempLoc_LineKillingTeleports[0] offset by (6.00 x Real) towards (Facing of (Triggering unit)) degrees)
      • Set TempLoc_LineKillingTeleports[8] = (TempLoc_LineKillingTeleports[0] offset by (7.00 x Real) towards (Facing of (Triggering unit)) degrees)
      • Set TempLoc_LineKillingTeleports[9] = (TempLoc_LineKillingTeleports[0] offset by (8.00 x Real) towards (Facing of (Triggering unit)) degrees)
      • Set TempLoc_LineKillingTeleports[10] = (TempLoc_LineKillingTeleports[0] offset by (9.00 x Real) towards (Facing of (Triggering unit)) degrees)
      • Wait 0.20 seconds
      • Animation - Change (Triggering unit)'s animation speed to 600.00% of its original speed
      • -------- - --------
      • Unit - Move (Triggering unit) instantly to TempLoc_LineKillingTeleports[2], facing TempLoc_LineKillingTeleports[1]
      • Wait 0.10 seconds
      • Animation - Play (Triggering unit)'s attack animation
      • Unit - Create 1 Dummy Instance for Player 1 (Red) at TempLoc_LineKillingTeleports[0] facing (Position of (Triggering unit))
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Animation - Play (Last created unit)'s attack animation
      • -------- - --------
      • Unit - Move (Triggering unit) instantly to TempLoc_LineKillingTeleports[3], facing TempLoc_LineKillingTeleports[1]
      • Wait 0.10 seconds
      • Animation - Play (Triggering unit)'s attack animation
      • Unit - Create 1 Dummy Instance for Player 1 (Red) at TempLoc_LineKillingTeleports[2] facing (Position of (Triggering unit))
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Animation - Play (Last created unit)'s attack animation
      • -------- - --------
      • Unit - Move (Triggering unit) instantly to TempLoc_LineKillingTeleports[4], facing TempLoc_LineKillingTeleports[1]
      • Wait 0.10 seconds
      • Animation - Play (Triggering unit)'s attack animation
      • Unit - Create 1 Dummy Instance for Player 1 (Red) at TempLoc_LineKillingTeleports[3] facing (Position of (Triggering unit))
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Animation - Play (Last created unit)'s attack animation
      • -------- - --------
      • Unit - Move (Triggering unit) instantly to TempLoc_LineKillingTeleports[5], facing TempLoc_LineKillingTeleports[1]
      • Wait 0.10 seconds
      • Animation - Play (Triggering unit)'s attack animation
      • Unit - Create 1 Dummy Instance for Player 1 (Red) at TempLoc_LineKillingTeleports[4] facing (Position of (Triggering unit))
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Animation - Play (Last created unit)'s attack animation
      • -------- - --------
      • Unit - Move (Triggering unit) instantly to TempLoc_LineKillingTeleports[6], facing TempLoc_LineKillingTeleports[1]
      • Wait 0.10 seconds
      • Animation - Play (Triggering unit)'s attack animation
      • Unit - Create 1 Dummy Instance for Player 1 (Red) at TempLoc_LineKillingTeleports[5] facing (Position of (Triggering unit))
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Animation - Play (Last created unit)'s attack animation
      • -------- - --------
      • Unit - Move (Triggering unit) instantly to TempLoc_LineKillingTeleports[7], facing TempLoc_LineKillingTeleports[1]
      • Wait 0.10 seconds
      • Animation - Play (Triggering unit)'s attack animation
      • Unit - Create 1 Dummy Instance for Player 1 (Red) at TempLoc_LineKillingTeleports[6] facing (Position of (Triggering unit))
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Animation - Play (Last created unit)'s attack animation
      • -------- - --------
      • Unit - Move (Triggering unit) instantly to TempLoc_LineKillingTeleports[8], facing TempLoc_LineKillingTeleports[1]
      • Wait 0.10 seconds
      • Animation - Play (Triggering unit)'s attack animation
      • Unit - Create 1 Dummy Instance for Player 1 (Red) at TempLoc_LineKillingTeleports[7] facing (Position of (Triggering unit))
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Animation - Play (Last created unit)'s attack animation
      • -------- - --------
      • Unit - Move (Triggering unit) instantly to TempLoc_LineKillingTeleports[9], facing TempLoc_LineKillingTeleports[1]
      • Wait 0.10 seconds
      • Animation - Play (Triggering unit)'s attack animation
      • Unit - Create 1 Dummy Instance for Player 1 (Red) at TempLoc_LineKillingTeleports[8] facing (Position of (Triggering unit))
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Animation - Play (Last created unit)'s attack animation
      • -------- - --------
      • Unit - Move (Triggering unit) instantly to TempLoc_LineKillingTeleports[10], facing TempLoc_LineKillingTeleports[1]
      • Wait 0.10 seconds
      • Animation - Play (Triggering unit)'s attack animation
      • Unit - Create 1 Dummy Instance for Player 1 (Red) at TempLoc_LineKillingTeleports[9] facing (Position of (Triggering unit))
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Animation - Play (Last created unit)'s attack animation
      • -------- - --------
      • Unit - Move (Triggering unit) instantly to TempLoc_LineKillingTeleports[1], facing (Target point of ability being cast)
      • For each (Integer A) from 1 to 20, do (Actions)
        • Loop - Actions
          • Animation - Play (Triggering unit)'s attack animation
          • Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 100.00 at TempLoc_LineKillingTeleports[1], dealing 20.00 damage of attack type Spells and damage type Normal
          • Wait 0.10 seconds
      • Animation - Change (Triggering unit)'s animation speed to 100.00% of its original speed
      • Custom script: call RemoveLocation( udg_TempLoc_LineKillingTeleports[0])
      • Custom script: call RemoveLocation( udg_TempLoc_LineKillingTeleports[1])
      • Custom script: call RemoveLocation( udg_TempLoc_LineKillingTeleports[2])
      • Custom script: call RemoveLocation( udg_TempLoc_LineKillingTeleports[3])
      • Custom script: call RemoveLocation( udg_TempLoc_LineKillingTeleports[4])
      • Custom script: call RemoveLocation( udg_TempLoc_LineKillingTeleports[5])
      • Custom script: call RemoveLocation( udg_TempLoc_LineKillingTeleports[6])
      • Custom script: call RemoveLocation( udg_TempLoc_LineKillingTeleports[7])
      • Custom script: call RemoveLocation( udg_TempLoc_LineKillingTeleports[8])
      • Custom script: call RemoveLocation( udg_TempLoc_LineKillingTeleports[9])
      • Custom script: call RemoveLocation( udg_TempLoc_LineKillingTeleports[10])
      • Unit - Turn collision for (Triggering unit) On
      • Unit - Unpause (Triggering unit)
Now, first problem is that a lot of times it does it 10 times like its suppose to, but only half of the distance.
For example instead of moving 600 (60 each time) it moves 300 (30 each time).

Second problem is, when the hero is supposed to make his 20 hits in TempLoc_LineKillingTeleports[1] he instead does it in the middle of the map.

Anyone spot the problems source ? :eekani:


Additional Questions (oh how I love asking multiple questions don't I ?)

- Is there a way to make a unit ethreal with a passive skill ? (by ethreal I mean half invisible)
- Is there a way to make a unit with a "Generic expiration timer" to not DIE at the end of the timer but to... whatever it is summons do when the time of them finishes ?
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
You're in luck :)

I happen to know a certain.....hmm.....irregularity. When using the event "finishes casting an ability", "target point of ability being cast" doesn't exist! It's null, meaning it's coordinates are 00.00, meaning it's in the center of the map.

Hmm you probably chose "finishes casting" because of that pausing unit bug.......maybe use "begins casting"? Or "starts the effect" + tiny wait?

But I'm not sure about this part:

Now, first problem is that a lot of times it does it 10 times like its suppose to, but only half of the distance.
For example instead of moving 600 (60 each time) it moves 300 (30 each time).

Everything seems right there, are you sure the distance is 600? How do you know it's 600?

- Is there a way to make a unit ethreal with a passive skill ? (by ethreal I mean half invisible)

You mean the visual effect? Or ethereal classification? Or what?

- Is there a way to make a unit with a "Generic expiration timer" to not DIE at the end of the timer but to... whatever it is summons do when the time of them finishes ?

Well, no, but why don't you just use a timer? If you have multiple units just use a timer array.

Btw, you should really learn how to use loops (For each integer A/B....) =), it would save you some space and it would be more readable.

Btw2, there are some things in the code that could've been done better, mind if I modify your code and post it? (I will explain what I did if it's necessary)

if you wanna steal it... steal it

Ha! You wish! :) (kidding)
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
A Unit Finishes Casting An Ability doesn't store Target Point of Ability Being Cast (and thus it plays it at 0,0 coordinates)

Use A Unit Starts the Effect Of An Ability.

Your other problem is weird though.

Ethereal: try the Ghost ability, it would only do the art though. (Not the playability effects)

Expiration: Summons die when they time out, they just have an Art-Special and they explode. Basically, use

call SetUnitExploded(yourUnit,true)

With the proper art-special field, and an expiration timer.


EDIT: Silvenon has just proved why you don't keep this many windows open at once -.-
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
First, it worked :thumbs_up:
It does have some sense in it, since the unit finished to cast the game auto deletes the target-leak.

Now about your questions.

1. 600 was an example, I keep my mouse on the casting target and I see that it does just 1/2 of the range.

2. The visual effect.

3. Didn't understand why I should use a timer, and about the loops, since you told it, you must now teach me how to use them :xxd:
Now really... I hardly know what they do at all :confused:
Did manage to use them for some of my abilities but all of them are based on the same thing lol.

4. Yes you may edit it or whatever you want.
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
What's wrong with GUI's "explode unit" action?

Now really... I hardly know what they do at all

??

You're using them in your code (Integer A).

Now, the code (I commented everything):

  • Line Killing Teleports
    • Events
      • Unit - A unit Starts the effect of an ability
      • -------- note that I have changed this event --------
    • Conditions
      • (Ability being cast) Equal to Line Killing Teleports
    • Actions
      • Set Caster = (Triggering unit)
      • Set Facing = (Facing of Caster)
      • Unit - Pause (Caster)
      • -------- new variables: Caster (unit), Facing (real) --------
      • Unit - Turn collision for Caster Off
      • Set TempLoc_LineKillingTeleports[0] = (Position of Caster)
      • Set TempLoc_LineKillingTeleports[1] = (Target point of ability being cast)
      • Set Real = ((Distance between TempLoc_LineKillingTeleports[0] and TempLoc_LineKillingTeleports[1]) / 10.00)
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Set TempLoc_LineKillingTeleports[(Integer A + 1)] = (TempLoc_LineKillingTeleports[0] offset by (Integer A x Real) towards Facing)
      • -------- indexes go in an ascending order (1, 2, 3...) so we can put it in a loop --------
      • -------- we'll mulptiply Real with Integer A so the order is like this: --------
      • -------- 1 x Real (Real), 2 x Real (2Real), 3 x Real (3Real)..... --------
      • Wait 0.20 seconds
      • Animation - Change Caster's animation speed to 600.00% of its original speed
      • -------- - --------
      • Unit - Move Caster instantly to TempLoc_LineKillingTeleports[2], facing TempLoc_LineKillingTeleports[1]
      • Wait 0.10 seconds
      • Animation - Play Caster's attack animation
      • Set TempLoc = (Position of Caster)
      • Unit - Create 1 Dummy Instance for Player 1 (Red) at TempLoc_LineKillingTeleports[0] facing TempLoc
      • Custom script: call RemoveLocation(udg_TempLoc)
      • -------- new variable: TempLoc (point) --------
      • -------- i created it because you had a leak --------
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Animation - Play (Last created unit)'s attack animation
      • -------- - --------
      • For each (Integer A) from 3 to 10, do (Actions)
        • Loop - Actions
          • Unit - Move Caster instantly to TempLoc_LineKillingTeleports[Integer A], facing TempLoc_LineKillingTeleports[1]
          • Wait 0.10 seconds
          • Animation - Play Caster's attack animation
          • Set TempLoc = (Position of Caster)
          • Unit - Create 1 Dummy Instance for Player 1 (Red) at TempLoc_LineKillingTeleports[(Integer A - 1)] facing TempLoc
          • Custom script: call RemoveLocation(udg_TempLoc)
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Animation - Play (Last created unit)'s attack animation
      • -------- indexes go in an ascending order too, so we can put it in a loop --------
      • -------- for "Unit - Move" action we can put Integer A as the array index --------
      • -------- but "Unit - Create" has a lesser index than "Unit - Move" by 1 --------
      • -------- so we can just subtract by 1 so we get the right pattern --------
      • -------- - --------
      • Unit - Move Caster instantly to TempLoc_LineKillingTeleports[1], facing TempLoc_LineKillingTeleports[1]
      • For each (Integer A) from 1 to 20, do (Actions)
        • Loop - Actions
          • Animation - Play (Triggering unit)'s attack animation
          • Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 100.00 at TempLoc_LineKillingTeleports[1], dealing 20.00 damage of attack type Spells and damage type Normal
          • Wait 0.10 seconds
      • Animation - Change Caster's animation speed to 100.00% of its original speed
      • For each (Integer A) from 0 to 10, do (Actions)
        • Loop - Actions
          • Custom script: call RemoveLocation( udg_TempLoc_LineKillingTeleports[bj_forLoopAIndex] )
      • -------- indexes here also go in an ascending order --------
      • -------- bj_forLoopAIndex is "Integer A" in custom script (JASS) --------
      • -------- so it's like we put Integer A --------
      • Unit - Turn collision for Caster On
      • Unit - Unpause Caster

Everything clear? :grin: (god I have no life)
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Ok didn't really need any of this (in the mean time I managed to use the loops as you did anyway... its just that to use this kind of stuff I need to start thinking more in the world editor's way lol, but ill get to it ! :xxd:)
BUT for the last line I LOVE YOU !! (nah kidding... I don't), searched for a way to remove locations with a loop for hours :razz::thumbs_up:
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
So what you meant to say was that I spent my time on nothing? :)

I did this so you can improve your coding, you were cleaning leaks, few people know how to do it nowadays, you should be proud of yourself. You code well, later you will learn how to code more efficiently.

Btw, there is no "thinking in the world editor's way", you're thinking the way you should already.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Silvenon sorry to make you work for nothing :xxd:

And no... the more I use it the more I start thinking "programming-like" way.

There are tons of things that I will say like "duh" when I see it, but actualy I would never have thought about it myself.
So I need to get more into it :)
Anyway, since I really want to learn programming I really think this would help me later on, on the thinking of HOW to make stuff work :thumbs_up:
 
Status
Not open for further replies.
Top