• 🏆 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] Projectile Cliff Problem

Status
Not open for further replies.

sentrywiz

S

sentrywiz

Got a simple problem (I believe) can't think of a solution.
Basically:

-its a dummy projectile that flies correctly, hits a target, deals damage

Problem is: its not eye-candy. Since the dummy has Fly movetype it goes up and down when it encounters a cliff. I don't want it. I want it to simple fly in one direction, without changing its height.

This works if its not fly, but then the spear is on the ground. That's even more horrible.

So how to fix that?

Basically I want pudge's hook like animation, only its not a hook but a projectile that flies to some location.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Set dummy's movement type to "foot".

After creation, add and remove the Crow Form ability. This has a bug that allows you to change the unit's flying height afterwards.

When going up and down cliffs and raised terrain, use GetLocationZ(location) to find the difference in height between the current point and the new point, and add that to the dummy's height.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Set movement type to foot and then add Crow form ability to the unit. That is better solution than using fly movement type.

You need to periodically (every 0.03 seconds) update the flying height. You could calculate how much it needs to increase height during every loop (dz).

dz = (EndLocZ-StartLocZ) / (Distance/speed)

If it is a homing missile then it is a bit more troublesome. I recommend not using Blizzard cliffs.

EDIT: Ruler wrote basically the same thing first
 

sentrywiz

S

sentrywiz

This might make the job easier hence the map is almost identical as the one in Pudge Wars (the map is skillshot based as well) so there is only one level of cliff, when the projectile lowers to water level and when it climbs up from water level.

Since its a manual projectile and I have to move it anyhow its better to use the same trigger to modify its height. So when unit is created:

1. I make move type foot and add/remove crow form so dummy gets the bug
2. Then I have 4 variables: start loc, end loc, speed, range.
3. I make the math maker suggested or use ruler's getlocationz (but i don't know jass, so if you can make the custom script for that, I'd be grateful)
4. modify the height.

Is this how I should do it?

Thanks to you both. I'll add rep if I cam
 

sentrywiz

S

sentrywiz

Yes, rather go by Maker's post. It's the same thing as I suggested, just more clearly written.

Note, you need to use a bit of jass to get the height.

  • Custom script: set udg_EndLocZ = GetLocationZ(udg_EndPoint)

Maker's math is kind of more understandable but your script can do all that without calculations.

This sets the var to the height but how to modify it? I will be using this command for that I suppose:

  • Animation - Change (Triggering unit) flying height to ? at ?
So how to "add" the EndLocZ to the flying height and what rate should I use?
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
No, my script was showing you how to get the values you need to use Maker's formula.

Anyway, here's the more verbose code:
  • Actions
    • Set id = (index of dummy)
    • Set tempLoc1 = (Position of dummy)
    • Custom script: set udg_height1 = GetLocationZ(udg_tempLoc1)
    • Animation - Change dummy flying height to ((Current flying height of dummy) + (PlayerLastHeight[id] - height1)) at 0.00
    • Set PlayerLastHeight[id] = height1
    • Custom script: call RemoveLocation(udg_tempLoc1)
 
Status
Not open for further replies.
Top