Flying Unit Question

Do you need World Editor help? Ask here!
Forum rules
Before making a new topic:
First, check if your question has already been answered in the Tutorials section.
If you didn't find a solution, use the search function.
If searching didn't help either, you can make a new topic.

Topic title & content:
You must use a descriptive title. (Help plz is not good) (Need help with Dialog buttons is good)
Go into much detail when posting. You should post attachments. Like screenshots of the problem, the map you are making, replays of the error. Or you could even make a screencast (video) of your problem and upload it here.

Spelling:
Grammar seems to be a serious problem amongst teenagers, so use a spell checker or you will get no love.
Read your posts twice, before pressing the reply button.
And do not use profanity. Chatspeak (y r u nub) and Leetspeak (1 C4N S33 H4X) are not welcome here either.

Only World Editor related questions are allowed here!
(Click for Battle.net help) (Click for World Editor help)
User avatar
EqualiseR
Posts: 177
Joined: Mon Mar 21, 2011 2:38 pm
Realm: US East
Account: EqualiseR
Clan: 3ICE

Flying Unit Question

Unread post by EqualiseR »

I'm currently working on a map where each player has an airplane, and you control this airplane with arrow keys. The airplane itself functions properly as far as steering goes and what not, however I'm running into a problem where when the airplane flies over an area with increased terrain, the airplane automatically adjusts its height accordingly.

Note: The airplane uses a sliding trigger.

Is there a way to make it so no matter how high the terrain is, the airplane will maintain a height that only the player can change? So like if there's a massive mountain in front of the airplane, the airplane will not automatically fly over it, but stop in front of it (at which point I will make a trigger that kills the plane if it is not high enough)

I made a trigger that checks the terrain height at the position of the airplane, and then deducts that from the flying height, however that does not seem to be working. - I uploaded the map as well, just incase you would like to look at it yourself.

Thank you,
~EqualiseR
Attachments
AirplaneTest4.w3m
(112.13 KiB) Downloaded 540 times
Image

User avatar
3ICE
Admin
Posts: 2629
Joined: Sat Mar 01, 2008 11:34 pm
Realm: Europe
Account: 3ICE
Clan: 3ICE
Location: Hungary
Contact:

Re: Flying Unit Question

Unread post by 3ICE »

Multiply it by 32/64/128 before adding. I don't know which one is the right constant, but it's got to be one of those.
ImageImageImageImageImage
Image
ImageImage

User avatar
EqualiseR
Posts: 177
Joined: Mon Mar 21, 2011 2:38 pm
Realm: US East
Account: EqualiseR
Clan: 3ICE

Re: Flying Unit Question

Unread post by EqualiseR »

What exactly would I be multiplying and then adding?

User avatar
3ICE
Admin
Posts: 2629
Joined: Sat Mar 01, 2008 11:34 pm
Realm: Europe
Account: 3ICE
Clan: 3ICE
Location: Hungary
Contact:

Re: Flying Unit Question

Unread post by 3ICE »

I just found t_all GetLocationZ(point). Subtract that from your flying height and it will work as expected.
ImageImageImageImageImage
Image
ImageImage

User avatar
EqualiseR
Posts: 177
Joined: Mon Mar 21, 2011 2:38 pm
Realm: US East
Account: EqualiseR
Clan: 3ICE

Re: Flying Unit Question

Unread post by EqualiseR »

I already had that. Here's the trigger.

Maintain Flying Height Events Time - Every 0.05 seconds of game time Conditions Actions Set TempPoint = (Position of J-10 0000 <gen>) Custom script: set udg_TempReal = GetLocationZ(udg_TempPoint) Animation - Change J-10 0000 <gen> flying height to ((Real(Red_MaintainFlyingHeight_integ)) - TempReal) at 0.00 Custom script: call RemoveLocation(udg_TempPoint)
the variable 'Red_MaintainFlyingHeight_integ' is an integer variable that follows the flying height only the player controls when a player presses the up / down arrow key, and not when the game adjusts it, this prevents the 'every 0.05 seconds' event from deducting "TempReal" every 0.05 seconds.

Any other ways to go about doing this?

~EqualiseR
Image

User avatar
3ICE
Admin
Posts: 2629
Joined: Sat Mar 01, 2008 11:34 pm
Realm: Europe
Account: 3ICE
Clan: 3ICE
Location: Hungary
Contact:

Re: Flying Unit Question

Unread post by 3ICE »

That's what I have always used. And it worked.

By the way why are you using SetCameraTargetControllerNoZForPlayer()?
The camera should follow the airplane on the Z axis too.
ImageImageImageImageImage
Image
ImageImage

User avatar
EqualiseR
Posts: 177
Joined: Mon Mar 21, 2011 2:38 pm
Realm: US East
Account: EqualiseR
Clan: 3ICE

Re: Flying Unit Question

Unread post by EqualiseR »

Can you please edit the map accordingly then? because before I added the "Red_MaintainFlyingHeight" variable, it would just constantly deduct the terrain height from the flying height ever 0.05 seconds, resulting in the flying height always being 0.

And as far as the other questions go, If I recall that was me locking the camera to the airplane for 3 players (Just for beta, so red/blue/teal can follow red's view until I add in more jets)

Thank you,
EqualiseR
Image

User avatar
3ICE
Admin
Posts: 2629
Joined: Sat Mar 01, 2008 11:34 pm
Realm: Europe
Account: 3ICE
Clan: 3ICE
Location: Hungary
Contact:

Re: Flying Unit Question

Unread post by 3ICE »

I think I found the problem.
Your default flying height is 100. The first level of cliff is 128. So the plane should crash into all cliffs.
Try it with default flying height at 1000. The plane will stay level.

I thought units could have negative fly height...

EDIT:
EqualiseR wrote:If I recall that was me locking the camera to the airplane for 3 players (Just for beta, so red/blue/teal can follow red's view until I add in more jets)
But what about the "NoZ" part of the function name? Isn't there a "WithZ" version? The camera should follow the airplane in the air, not on the ground.

EDIT2: You should study how the [trigger] tag works. I already fixed one of your posts from where you can reverse-engineer it.

EDIT3: I'm off to bed, big day tomorrow. (I won't get much sleep between 11 pm - 5 am...)
ImageImageImageImageImage
Image
ImageImage

User avatar
EqualiseR
Posts: 177
Joined: Mon Mar 21, 2011 2:38 pm
Realm: US East
Account: EqualiseR
Clan: 3ICE

Re: Flying Unit Question

Unread post by EqualiseR »

Well, when I said my flying height would stay at 0, it could've been negative. I didn't really pay attention.

And on a different note, my flying height in the object editor is by default set to 300. And 3 seconds into the game it gets changed to 100. I can change those if need be, but then still what would I put for the trigger? Would I keep the trigger I'm currently using?
Image

User avatar
3ICE
Admin
Posts: 2629
Joined: Sat Mar 01, 2008 11:34 pm
Realm: Europe
Account: 3ICE
Clan: 3ICE
Location: Hungary
Contact:

Re: Flying Unit Question

Unread post by 3ICE »

Keep the trigger, it works fine.

EDIT: Hope you didn't miss my edits.

EDIT2: 1333rd post! 4 more to 1337-ness.

EDIT3: Recounted my posts and it turns out I deleted like 200 but the counter didn't update. So I am not close to 1337 posts yet.
ImageImageImageImageImage
Image
ImageImage

Post Reply

Who is online

Users browsing this forum: No registered users and 98 guests