I have a plane and i need to make a trigger so that it can fly and land using the up and down arrow keys, also i want to make a trigger so that when you push the the left arrow when the plane is flying it will fly left, and when you push right it will fly right.Also when the plane is up in the air fling(only when flying) it will move forward.
So if you can help thanks.
arrow key movment
Moderator: Cheaters
-
- The Flying Cow!
- Posts: 2196
- Joined: November 2nd, 2007, 10:34 pm
- Location: Melbourne
Re: arrow key movment
It'd probably be best if you made this trigger in JASS, since GUI would require a LOT of space and it would be really leaky.
Visit Ozzapoo.net, my blog and the home of AutoCP and Cheatpack Detector!
AutoCP3 now available for free!
AutoCP3 now available for free!
-
- Junior Member
- Posts: 34
- Joined: August 12th, 2008, 9:35 pm
Re: arrow key movment
could you just tell me how to make the guy fly up in the air?
because i found out how to do the other stuff.
please.
because i found out how to do the other stuff.
please.
-
- The Flying Cow!
- Posts: 2196
- Joined: November 2nd, 2007, 10:34 pm
- Location: Melbourne
Re: arrow key movment
Sort of need more info..?
Visit Ozzapoo.net, my blog and the home of AutoCP and Cheatpack Detector!
AutoCP3 now available for free!
AutoCP3 now available for free!
-
- Junior Member
- Posts: 34
- Joined: August 12th, 2008, 9:35 pm
Re: arrow key movment
I have a plane skin and i whant to make it so you can use the arrow keys to fly up
and land so down would make you land and up would have you fly
(don't know if that is possible)
(also if possible make it so you can fly at different heights) if you cant do that don't bother.
but if you could thanks.
and land so down would make you land and up would have you fly
(don't know if that is possible)
(also if possible make it so you can fly at different heights) if you cant do that don't bother.
but if you could thanks.
-
- Forum Staff
- Posts: 2618
- Joined: June 2nd, 2007, 6:53 pm
- Title: I Just Lost the Game
Re: arrow key movment
Make just have it so that if you press Up, it increases the height of your unit, and when you hit down, it decreases the height. I don't know how you would do this, but I know it can be done.
Maybe something like this?
Up arrow coding:
Down arrow coding:
So, whatever your plane unit's rawcode is, replace UNIT with it. Replace AMOUNT PER PRESS with the height change you want per press of the key, and RATE with the rate you want.
And for making sure it FLIES while it's up there:
Replace UNIT with your plane's rawcode. Set SOMETHING ABOVE GROUND LEVEL to a height that is above ground level, so it can tell if it's taken off, and set AT GROUND LEVEL to the height that ground level is at, or at least the ground level of the airport. Set SPEED INCREASE UPON TAKEOFF to however much faster you want it to go upon taking off from the ground, and set GROUNDSPEED to how fast you want it to go on the ground (it's gotta move when it's down there, too).
Hope that all works for you, I just kinda made that up using Jasscraft. If you needed GUI... I tried, but I couldn't figure out how to make it set the unit's height in GUI. There didn't seem to be an action for that. Maybe I'm just challenged... But I knew how to do it in Jass, so I did. It seems as if it will work, too. Hope your map comes out well!
[edit] I'm not sure how to make it automatically move, and I'm not particularly inclined to try to figure out at the moment... They just have to choose the direction to go by right-clicking, as this is. However, when you get it to go forward automatically...
Set UNIT to your plane's rawcode... You can change 5 to whatever. It basically means that if you hit left, it turns negative 5 degrees (five degrees to its left), if you hit right, it turns 5 degrees (positive would lead it to its right).
ALL these codes only work for player red (0). You would either need to loop them, or to make one for each person.
You probably should also add this into the globals
[/edit]
Maybe something like this?
Up arrow coding:
Code: Select all
function InitTrig_Flying_Up takes nothing returns nothing
set gg_trg_Flying_Up = CreateTrigger( )
call TriggerRegisterPlayerKeyEventBJ( gg_trg_Flying_Up, Player(0), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_UP )
call TriggerAddAction( gg_trg_Flying_Up, function Trig_Flying_Up_Actions )
endfunction
function Trig_Flying_Up_Actions takes nothing returns nothing
call SetUnitFlyHeight(UNIT,(GetUnitFlyHeight(UNIT))+AMOUNT PER PRESS,rate)
endfunction
Code: Select all
function InitTrig_Flying_Down takes nothing returns nothing
set gg_trg_Flying_Down = CreateTrigger( )
call TriggerRegisterPlayerKeyEventBJ( gg_trg_Flying_Down, Player(0), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_DOWN )
call TriggerAddAction( gg_trg_Flying_Down, function Trig_Flying_Down_Actions )
endfunction
function Trig_Flying_Down_Actions takes nothing returns nothing
call SetUnitFlyHeight(UNIT, GetUnitFlyHeight(UNIT))-AMOUNT PER PRESS,RATE)
endfunction
And for making sure it FLIES while it's up there:
Code: Select all
function Trig_Flying_Move takes nothing returns nothing
if GetUnitFlyHeight(UNIT)=AT GROUND LEVEL
SetUnitMoveSpeed(UNIT, GROUNDSPEED)
elseif GetUnitFlyHeight(UNIT)=SOMETHING ABOVE GROUND LEVEL
SetUnitMoveSpeed(UNIT, GetUnitMoveSpeed(UNIT)+SPEED INCREASE UPON TAKEOFF)
endif
endif
endfunction
Hope that all works for you, I just kinda made that up using Jasscraft. If you needed GUI... I tried, but I couldn't figure out how to make it set the unit's height in GUI. There didn't seem to be an action for that. Maybe I'm just challenged... But I knew how to do it in Jass, so I did. It seems as if it will work, too. Hope your map comes out well!
[edit] I'm not sure how to make it automatically move, and I'm not particularly inclined to try to figure out at the moment... They just have to choose the direction to go by right-clicking, as this is. However, when you get it to go forward automatically...
Code: Select all
function InitTrig_Turning_Left takes nothing returns nothing
set gg_trg_Turning_Left = CreateTrigger( )
call TriggerRegisterPlayerKeyEventBJ( gg_trg_Turning_Left, Player(0), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_LEFT )
call TriggerAddAction( gg_trg_Turning_Left, function Trig_Turning_Left_Actions )
endfunction
function Trig_Turning_Left_Actions takes nothing returns nothing
call SetUnitFacing(UNIT, GetUnitFacing(UNIT)-5)
endfunction
function InitTrig_Turning_Right takes nothing returns nothing
set gg_trg_Turning_Right = CreateTrigger( )
call TriggerRegisterPlayerKeyEventBJ( gg_trg_Turning_Right, Player(0), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_RIGHT )
call TriggerAddAction( gg_trg_Turning_Right, function Trig_Turning_Right_Actions )
endfunction
function Trig_Turning_Right_Actions takes nothing returns nothing
call SetUnitFacing(UNIT, GetUnitFacing(UNIT)+5)
endfunction
ALL these codes only work for player red (0). You would either need to loop them, or to make one for each person.
You probably should also add this into the globals
Code: Select all
trigger gg_trg_Flying_Up=null
trigger gg_trg_Flying_Down=null
trigger gg_trg_Turning_Left=null
trigger gg_trg_Turning_Right=null
My Warcraft III Tool Collection
If you want to chat/game with me:
Blizzard: Senethior459#1962
Discord: Kyle#7409
Steam: Spacekidkyle
If you want to chat/game with me:
Blizzard: Senethior459#1962
Discord: Kyle#7409
Steam: Spacekidkyle
-
- Junior Member
- Posts: 34
- Joined: August 12th, 2008, 9:35 pm
Re: arrow key movment
ya i tried that that not as you said it but its going good i just have to
make some more changes to it but if some 1 could post a map with it already
in it (if they had it don't bother making it) it would help alot and save me alot
of time
nvm i got it all done
make some more changes to it but if some 1 could post a map with it already
in it (if they had it don't bother making it) it would help alot and save me alot
of time
nvm i got it all done