wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 07-08-2008, 09:09 PM   #1
Feroc1ty
User
 
Join Date: Nov 2006
Posts: 304

Feroc1ty is on a distinguished road (14)

Default Keeping the same height

Okay so for a projectile spell im making, I wish to keep the projectile the same flying height no matter what terrain heigh it is, I've tried making this work, but it doesn't work out the way I want it to, here is what I made, in a rough outline since the code is on my other computer.

Collapse JASS:

local real difference
local real x
local real y
local real z
set tempLoc = Location(x,y) // It is used in a timer, so x and y values are preset to current location
set difference = GetLocationZ(tempLoc)
set x = newunit //forgot what i put here, but it doesn't really matter
set y = newunit //forgot what i put here, but it doesn't really matter
set tempLoc = Location(x,y)
set difference = difference - GetLocationZ(tempLoc)
set z = z + difference


This doesn't work the way I want it to at all, i'll do a bad attempt at an ASCII image.

Code:
lets just say that the dot is the projectile :D
                   ........
                  .        .
...................         ....................
------------------\        /--------------------
                   \______/
lets just say that the above is the terrain

As you can see, instead of remaining in the same Z axis position, the thing just goes as high as the lowest point in the bump is, making it look like there is an invisible bubble around the hole that makes the bullet go smoothly about.:(
Feroc1ty is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 07-08-2008, 09:46 PM   #2
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Why don't you just store the absolute height you want the projectile to be at, it would make the claculations a lot more simple, the flying height would simply equal absolute height - locationZ.
__________________
Anitarf is offline   Reply With Quote
Old 07-08-2008, 09:50 PM   #3
Flame_Phoenix
retired coder | real ilfe
 
Flame_Phoenix's Avatar
 
Join Date: Mar 2007
Posts: 2,208

Submissions (10)

Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)

Send a message via MSN to Flame_Phoenix
Default

Or you could use some projectile spell from WE xD
__________________
Check out my tutorials at:
1-Creating a Hero Tavern
2-Complete Icon Tutorial - ALL about Icons
3-Making a spell in vJass - Practice Session 1
Check out all my current spells at here
Finally, check my project:
Castle vs Castle Flame Edition
Flame_Phoenix is offline   Reply With Quote
Old 07-08-2008, 10:06 PM   #4
blu_da_noob
Nonchalant
 
blu_da_noob's Avatar


Respected User
 
Join Date: Mar 2006
Posts: 1,933

Submissions (2)

blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)

[Quicksilver #2] - 2nd Place[Quicksilver#1] 1st place

Send a message via MSN to blu_da_noob
Default

Quote:
As you can see, instead of remaining in the same Z axis position, the thing just goes as high as the lowest point in the bump is, making it look like there is an invisible bubble around the hole that makes the bullet go smoothly about.:(

This is a 'feature' of the flying movement type. What you need to do is make your dummy unit ground movement type, remove its collision and use the crow form trick to allow you to change its flying height. Then its absolute Z height will always be exactly GetLocationZ(GetUnitLoc(u)) + GetUnitFlyHeight(u), rather than flying units (which, as you noticed, take the maximum terrain Z height from a certain area around them which I haven't bothered to find the exact dimensions of).
__________________
blu_da_noob is offline   Reply With Quote
Old 07-08-2008, 10:18 PM   #5
Flame_Phoenix
retired coder | real ilfe
 
Flame_Phoenix's Avatar
 
Join Date: Mar 2007
Posts: 2,208

Submissions (10)

Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)

Send a message via MSN to Flame_Phoenix
Default

On second thoughts, you could always order it to move like a flying unit, than it would do all the job for you !
=P Cheap solutions lol
__________________
Check out my tutorials at:
1-Creating a Hero Tavern
2-Complete Icon Tutorial - ALL about Icons
3-Making a spell in vJass - Practice Session 1
Check out all my current spells at here
Finally, check my project:
Castle vs Castle Flame Edition
Flame_Phoenix is offline   Reply With Quote
Old 07-08-2008, 10:18 PM   #6
Feroc1ty
User
 
Join Date: Nov 2006
Posts: 304

Feroc1ty is on a distinguished road (14)

Default

Quote:
Originally Posted by blu_da_noob
This is a 'feature' of the flying movement type. What you need to do is make your dummy unit ground movement type, remove its collision and use the crow form trick to allow you to change its flying height. Then its absolute Z height will always be exactly GetLocationZ(GetUnitLoc(u)) + GetUnitFlyHeight(u), rather than flying units (which, as you noticed, take the maximum terrain Z height from a certain area around them which I haven't bothered to find the exact dimensions of).


Ah, so thats the problem, though flying was same as a ground unit with crow ability, thanks bro, I was thinking my formula was off.


edit: just tested it and it works 110%, thanks, +rep

Last edited by Feroc1ty : 07-08-2008 at 10:44 PM.
Feroc1ty is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 09:23 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services