• 🏆 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] Turn Rate Too Slow?

Status
Not open for further replies.

sentrywiz

S

sentrywiz

I'm making a skillshot spell that requires the unit to face point and a dummy is launched according to that. However, the turn rate isn't fast enough and if you cast it from a 180 degree opposite angle, the missile goes randomly because the unit doesn't turn fast enough.

So I tried with using "X Center of Point" hopefully that would resolve it, but that also doesn't work idk why.

Anyone have ideas? Either somehow increase turn rate of unit or make the dummy unit face the point of target ability being cast? Either would work.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
When you create dummy projectile, make it facing to target point of ability regardless of caster unit's facing.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
You can do 3 things:

1. Go to object editor and increase this field: Movement - Turn Rate: (real)

2. When a unit starts casting that ability, put it in a group.
Check every 0.03 seconds of gametime if that unit is facing the point where he cast the ability to.
When that happens, you create the dummy etc.
You do need something to avoid the ability cooldown if the unit is ordered to do something else while he has not yet reached the facing angle.
You could reset the ability cooldown too if that would be easier than avoid the cooldown.

3. You can, as mentioned by Ceday, use the angle between position of unit and target position of ability being cast. Make sure you don't forget to remove the leaks.
 

sentrywiz

S

sentrywiz

When you create dummy projectile, make it facing to target point of ability regardless of caster unit's facing.

How? Show me in triggers.

Cuz I've tried on my own with ideas but none worked.

You can do 3 things:

1. Go to object editor and increase this field: Movement - Turn Rate: (real)

2. When a unit starts casting that ability, put it in a group.
Check every 0.03 seconds of gametime if that unit is facing the point where he cast the ability to.
When that happens, you create the dummy etc.
You do need something to avoid the ability cooldown if the unit is ordered to do something else while he has not yet reached the facing angle.
You could reset the ability cooldown too if that would be easier than avoid the cooldown.

3. You can, as mentioned by Ceday, use the angle between position of unit and target position of ability being cast. Make sure you don't forget to remove the leaks.

I tried number 1 didn't work. Still too slow.

Number 2 is an interesting idea. Might give that a bash.

And number 3 like I already said above, idk. I expect an example
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Something like this:
  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Set TempLocation = (Position of (Triggering unit))
      • Set TempLocation2 = (Target point of ability being cast)
      • Unit - Create 1 Footman for (Owner of (Triggering unit)) at TempLocation facing (Angle from TempLocation to TempLocation2) degrees
      • -------- other unit stuff --------
      • Custom script: call RemoveLocation(udg_TempLocation)
      • Custom script: call RemoveLocation(udg_TempLocation2)
This creates a footman at the location of the caster that looks in the direction of the targeted point of ability being cast.
It is also pretty leakless.
I don't know what the unit should do... or what missile system you have. But you should be able to make the rest of the stuff.

btw change animate death to whatever your ability is ;D
 

sentrywiz

S

sentrywiz

Something like this:
  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Set TempLocation = (Position of (Triggering unit))
      • Set TempLocation2 = (Target point of ability being cast)
      • Unit - Create 1 Footman for (Owner of (Triggering unit)) at TempLocation facing (Angle from TempLocation to TempLocation2) degrees
      • -------- other unit stuff --------
      • Custom script: call RemoveLocation(udg_TempLocation)
      • Custom script: call RemoveLocation(udg_TempLocation2)
This creates a footman at the location of the caster that looks in the direction of the targeted point of ability being cast.
It is also pretty leakless.
I don't know what the unit should do... or what missile system you have. But you should be able to make the rest of the stuff.

btw change animate death to whatever your ability is ;D

Oh damn. I didn't know there was an option "Angle from Point A to Point B" which is what I was looking for in the first place.

I'll test this right away.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Yea I could have used that one too. But why would I.
I would not reduce the length of the code. But I would reduce performance:
JASS:
function CreateNUnitsAtLocFacingLocBJ takes integer count, integer unitId, player whichPlayer, location loc, location lookAt returns group
    return CreateNUnitsAtLoc(count, unitId, whichPlayer, loc, AngleBetweenPoints(loc, lookAt))
endfunction

Create unit facing point redirects to create unit facing angle.
 
Status
Not open for further replies.
Top