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

[Spell] Making a GUI Slide Trigger look smooth?

Status
Not open for further replies.
Level 4
Joined
Jun 10, 2019
Messages
69
Hi all,

I'm making a fairly simple spell, mostly as practice/education. It's called Inner Flame. When cast, the caster fires a projectile in a target direction that damages the first enemy hit. The projectile then disappears.

Functionally, I have it working perfectly. I made casting Inner Flame spawn a unit with the projectile's model, and have that unit teleport every few hundredths of a second teleport a few units in the target direction. When an enemy unit comes within range of the projectile, a dummy spawns and damages the enemy. The projectile unit then dies.

While it's working mechanically, the projectile looks clunky while it's moving. I guess that makes sense, as it's teleporting instantly between periods of immobility, but I'm hoping that there's some way of making it look smoother?

Thanks in advance!

Edit: I forgot to mention 2 things:

1) If possible, I'd prefer to keep things in GUI; I don't know the first thing about JASS, and while I'm not opposed to learning, I'd prefer to stick to things I know for this spell.

2) I also figured out how to make the projectile work by ordering the target to move in the target direction, but then I was limited by the movement speed maximum. I don't believe there's an easy way to get around that, but if there is, please let me know.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
I attached a map with an example. It's very basic and has glaring issues, but it shows you how you could go about doing this.

It's late and i'm tired so I don't really feel like going into detail but I think this map should help.
 

Attachments

  • Missile Example.w3x
    19.2 KB · Views: 26
Level 39
Joined
Feb 27, 2007
Messages
4,994
Move speed still has a hard cap and it’s not recommended to do projectile motion that way.

Uncle may have just addressed this in their map (I didn’t look), but... the problem is that the Move Unit Instantly command takes pathing into account and looks rather bad when used rapidly. This is why I suggested using special effects and setting their position in your other thread. Ultimately you will have to use some JASS to use the functions SetUnitX and SetUnitY. You can make using JASS functions easier by having a few variables that you use for arguments:

  • Set SomePoint = whatever point
  • Set SomeUnit = whatever unit
  • Set Xcoord = (X coordinate of SomePoint)
  • Set Ycoord = (Y coordinate of SomePoint)
  • Custom script: call SetUnitX(udg_SomeUnit, udg_Xcoord)
  • Custom script: call SetUnitY(udg_SomeUnit, udg_Ycoord)
  • Custom script: call RemoveLocation(udg_SomePoint) //still clean leak as normal
This of course does not take pathing into account which means it can put the unit inside buildings, unpathable terrain, and destructibles. This probably doesn’t matter for a SFX dummy unit but it would for a regular unit. You can use something like the CheckPathability resource but that’s more JASS.
 
Level 8
Joined
May 21, 2019
Messages
435
Hi all,

I'm making a fairly simple spell, mostly as practice/education. It's called Inner Flame. When cast, the caster fires a projectile in a target direction that damages the first enemy hit. The projectile then disappears.

Functionally, I have it working perfectly. I made casting Inner Flame spawn a unit with the projectile's model, and have that unit teleport every few hundredths of a second teleport a few units in the target direction. When an enemy unit comes within range of the projectile, a dummy spawns and damages the enemy. The projectile unit then dies.

While it's working mechanically, the projectile looks clunky while it's moving. I guess that makes sense, as it's teleporting instantly between periods of immobility, but I'm hoping that there's some way of making it look smoother?

Thanks in advance!

Edit: I forgot to mention 2 things:

1) If possible, I'd prefer to keep things in GUI; I don't know the first thing about JASS, and while I'm not opposed to learning, I'd prefer to stick to things I know for this spell.

2) I also figured out how to make the projectile work by ordering the target to move in the target direction, but then I was limited by the movement speed maximum. I don't believe there's an easy way to get around that, but if there is, please let me know.

If your slider animation is looking extremely choppy, it may be because you are using an inaccurate time event such as Wait.
How are you spacing the movements currently?
 
Level 4
Joined
Jun 10, 2019
Messages
69
@FeelsGoodMan I tried changing it, but it kept on reverting to 522. Google is telling me that changing it in the gameplay constants doesn't work (for whatever reason).

@Uncle Thanks! I'll take a look at it!

@Dr Super Good I've been playing around with movement speeds between 0.01 seconds and 0.10 seconds, and it looks choppy regardless, but I think @Cespie might be onto something, because I am currently using the Wait action to space the movements.

So, my question is then, does anyone have a recommendation on what action to use to set a time interval if not the Wait action? Thanks!

Edit: I figured it out. I made a separate trigger that activates every 0.02 seconds, moving the projectile 16 x VARIABLE distance and adding 1 to the variable every 0.02 seconds. It looks great now! Thank you all so much!
 
Last edited:
@FeelsGoodMan I tried changing it, but it kept on reverting to 522. Google is telling me that changing it in the gameplay constants doesn't work (for whatever reason).

@Uncle Thanks! I'll take a look at it!

@Dr Super Good I've been playing around with movement speeds between 0.01 seconds and 0.10 seconds, and it looks choppy regardless, but I think @Cespie might be onto something, because I am currently using the Wait action to space the movements.

So, my question is then, does anyone have a recommendation on what action to use to set a time interval if not the Wait action? Thanks!

I think I read somewhere that the minimum wait time is around 0.2 seconds, even when you put wait time at 0.00 seconds. That might be why it's still choppy. I'm not sure about this though so someone else should confirm it.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
@Pyrogasm
If the projectile unit has Locust I don't think it will take pathing into account. I've used both SetUnitX/Y and Move Unit Instantly and I can't tell the difference when it comes to moving dummy unit's with locust. But you're right, it's probably for the best to always use SetUnitX/Y since it works a lot better for non-Locust units. Also, I read that SetUnitX/Y is better for performance.

@A Rather Wily Beaver
Anyway, in my example map I use the Move Unit Instantly function because I wanted to keep it as GUI friendly and simple as possible. You can change it to SetUnitX/Y if it's the better option, it's pretty easy to change it.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,192
@Dr Super Good I've been playing around with movement speeds between 0.01 seconds and 0.10 seconds, and it looks choppy regardless, but I think @Cespie might be onto something, because I am currently using the Wait action to space the movements.
This is a bug with your code then. The game internally updates at either 0.02 or 0.03.

TriggerSleepAction (GUI "Wait" action) has a minimum delay of 0.1 seconds, does not factor in game speed and will wait longer in multiplayer than single player due to requiring network synchronization.

For missiles now one should be using special effects. Unit movement should only be used for charge or dash abilities. This removes the need to create dummy units for missiles and all associated overhead of units.
 
Status
Not open for further replies.
Top