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

Re: Flying Unit Question

Unread post by EqualiseR »

I still don't see that working because once you fall off the ramp or whatever, this "0.03 second" timer will take action and set h = current height which would assumably be 0.

Anyways, I can figure that part out- A problem I'm stuck on now is- Let's say there's 2 Ramps - Let's call Ramp 1 X, and Ramp 2 Y. The car drives off Ramp X and now has a flying height that is falling. The second he flies over "Ramp Y" his terrain height will automatically adjust and will now be Flying height + Terrain height of Ramp X.
Image

User avatar
3ICE
Admin
Posts: 2631
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 »

EqualiseR wrote:I still don't see that working because once you fall off the ramp or whatever, this "0.03 second" timer will take action and set h = current height which would assumably be 0.

Anyways, I can figure that part out-
Good.
EqualiseR wrote:2 Ramps
We plot our jump's curve from X and ignore Y until the car actually lands on it.
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 suppose I'll just fuck around with the trigger for awhile until I can get a fair concept of how things would work out and thusly see what needs to be fixed.

Well, first off, I realize that I now have no choice but to use regions and seperate triggers for each because this trigger functions EVERY time I have any little hill and it glitches massively. Even so, the warthog is not driving off the cliff as it should. Right as it drives off the cliff, the unit flies way up in the air and changes flying height every millisecond. I don't really know how to proceed atm. I'll continue looking for a way to fix this but if you want to look at the map, here it is.
Attachments
Warthog Ramp Testing 1.w3m
(562.34 KiB) Downloaded 364 times
Last edited by 3ICE on Sat Mar 26, 2011 3:08 pm, edited 1 time in total.
Reason: merged doublepost
Image

User avatar
3ICE
Admin
Posts: 2631
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 »

You can ignore little hills by checking the delta (tmp-h or h-tmp). If it is too close to zero, then the hill is too small.
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 »

okay Thanks, but when it drives over a cliff without a hill, it doesnt ramp off smoothly. The flying height adjusts way more than the actual ramp height itself. I'll try to fix it.
Image

User avatar
3ICE
Admin
Posts: 2631
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 »

This is the closest I got. It does not work yet.

Code: Select all

library GetUnitZ // 3ICE's GetUnitZ() and SetUnitZ()

globals
  location r=Location(0,0)
endglobals

function GetUnitZ takes unit u returns real
  call MoveLocation(r,GetUnitX(u),GetUnitY(u))
  return GetUnitFlyHeight(u)+GetLocationZ(r)
endfunction

function SetUnitZ takes unit u, real h returns nothing
  call SetUnitFlyHeight(u,h-GetUnitZ(u),0)
endfunction

endlibrary

Code: Select all

globals
  real prv=0
  real cur=0
  real tmp=0
  unit c=null
endglobals

function Init takes nothing returns nothing
  set c=gg_unit_ocat_0000
  call UnitAddAbility(c,'Amrf')
  call UnitRemoveAbility(c,'Amrf')
endfunction

function InitTrig_Init takes nothing returns nothing
  set gg_trg_Init=CreateTrigger()
  call TriggerAddAction(gg_trg_Init,function Init)
endfunction

Code: Select all

globals
  string s //DEBUG
endglobals

function Jump takes nothing returns nothing
  set cur=GetUnitZ(c)
  if prv>GetUnitZ(c)then
    set tmp=prv
  endif
  if tmp-cur>20then
    call DisableTrigger(gg_trg_Jump)
    //Jump downwards
    set s="--JUMP!" //DEBUG
    call TriggerSleepAction(1)
    set tmp=GetUnitZ(c)
    call EnableTrigger(gg_trg_Jump)
  elseif cur-tmp>20then
    call DisableTrigger(gg_trg_Jump)
    //Jump upwards
    set s="++JUMP!" //DEBUG
    call TriggerSleepAction(1)
    set tmp=GetUnitZ(c)
    call EnableTrigger(gg_trg_Jump)
  endif
  call DisplayTextToPlayer(GetLocalPlayer(),0,0,"prv="+R2S(prv)+" tmp="+R2S(tmp)+" cur="+R2S(cur)+" del="+R2S(tmp-cur)+s) //DEBUG
  set prv=cur
endfunction

function InitTrig_Jump takes nothing returns nothing
  set gg_trg_Jump=CreateTrigger()
  call TriggerRegisterTimerEvent(gg_trg_Jump,.03,true)
  call TriggerAddAction(gg_trg_Jump,function Jump)
endfunction
The working version will be posted tomorrow, something came up. /g2g
Attachments
3ICE's AutoJumpVehicles.w3m
(8.78 KiB) Downloaded 390 times
Last edited by 3ICE on Sun Mar 27, 2011 11:28 am, edited 2 times in total.
Reason: bugfix
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 »

Alright thank you :)
Image

User avatar
SHiNNiNG_FaiTH
Posts: 264
Joined: Fri Mar 21, 2008 1:57 am
Realm: US East
Account: SHiNNiNG_FaiTH
Clan: 3ICE
Location: Minnesota, USA
Contact:

Re: Flying Unit Question

Unread post by SHiNNiNG_FaiTH »

:shock: holy crap 3ICE making a tutorial!!! THAT IS NEWS WORTHY! ;)
APM Spamming mineral fields is fun!
Image

User avatar
3ICE
Admin
Posts: 2631
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 »

What tutorial?

...

p.s.: I won't be able to get it working EQ. We are back to square one again.

EDIT - Instructions:
If you can find a physics system that works, great!
Otherwise, use maths and my GetUnitZ(unit) + SetUnitZ(unit,height) functions. They work well both on cliffs and raised terrain.
Find a better way to detect ramps. Or use the method you described earlier (regions).
Don't use flying units, the game automatically corrects (messes up) their height over cliffs.
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, without flying units I don't know how I would make it work regardless. Anyways, I'll continue looking for a working physics system in the mean time. Also, if you can't get it to work with JASSHelper then I doubt I could get it working. I'll still keep trying though.
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 392 guests