PDA

View Full Version : Aircraft script 50% done, need help



NOVA_Maimer
06-11-2004, 08:49 PM
hey, me and my coder have been working on an aircraft script, and so far weve been successful, only problem is, the current controls donta llow for full flying. We need to change the controls to the following, but we cant find how to do it, if anyone can find it, it would help alot. Of course, if we get this script to work we will release it for public use, no sense in making something this good and hoarding it :P

Mouse --roll and pitch
Forward/w --power up
Backward/s --power down
Left/right/a/d --yaw left and right

-------------------------
My Models (http://maimer.no-ip.info)

NOVA_Maimer
06-11-2004, 08:49 PM
hey, me and my coder have been working on an aircraft script, and so far weve been successful, only problem is, the current controls donta llow for full flying. We need to change the controls to the following, but we cant find how to do it, if anyone can find it, it would help alot. Of course, if we get this script to work we will release it for public use, no sense in making something this good and hoarding it :P

Mouse --roll and pitch
Forward/w --power up
Backward/s --power down
Left/right/a/d --yaw left and right

-------------------------
My Models (http://maimer.no-ip.info)

Submiqent
06-11-2004, 11:53 PM
Anyone? Aircraft would be a valuable addition.

xardy
06-12-2004, 02:37 AM
dont think any1 knows the controls is something that they hide away pretty good. i think you will need the sdk for it.

NOVA_Maimer
06-13-2004, 10:45 AM
We still have had no success in finding where the gliders controls are, even a pointer to the right file could help. I doubt this requires the SDK

-------------------------
My Models (http://maimer.no-ip.info)

xardy
06-13-2004, 11:04 AM
a pointer could help. but i havent found anywhere how to add new controls. even add a new control option to the menu...

aarbro
06-13-2004, 03:07 PM
I havn't found any way to get hold of key capturing except a very limitied way for the use key. Is it even inside Lua? Anyone with more info? Crytek?

thedudemanguy
06-13-2004, 05:27 PM
here is a limited go at a flying machine type vehicle changing the glider's properties, this will basically let you fly around indefinitely in it, accelerate upwards, etc, but like I said it's limited and needs a LOT more, right now it resembles nothing realistic, hehe... to do things nicely you'd probably have to write some expressions to account for acceleration and stuff like that and to get the controls you want you want have to scour the luas to possibly find something to emulate... without any docs on this stuff no one can give exact answers because we don't have the info


anyway to use this, make a directory structure called C:\Program Files\Ubisoft\Crytek\Far Cry\Scripts\Default\Entities\Vehicles (or wherever you put the game at the beginning part) copy out the paraglider.lua into there and replace the beginning part with the following... (FC will now use this script for glider control until you delete it)


Properties = {
bTrackable=1,

--fileName = "objects/Vehicles/zodiacraft/zodiacraft.cgf",
fileName = "objects/Vehicles/glider/glider.cgf",

-- [kirill] vehicle gets different damage depending on who's shooter
-- defines the intensity of the damage caused by the weapons to
-- the vehicle
-- shooter is player
fDmgScaleExplosion = 1.1, -- explosions
fDmgScaleBullet = 0.01, -- shooting
-- shooter is AI
fDmgScaleAIExplosion = 0.7, -- explosions
fDmgScaleAIBullet = 0.01, -- shooting

bUserPassanger = 0,
bDrawDriver = 0,
damping = 0.1,
water_damping = 1.5,
water_resistance = 0,
fLimitLRAngles = 150,
fLimitUDMinAngles = -90,
fLimitUDMaxAngles = 90,

},

boat_params={
Damprot = 40, --turning dump
Dampv = 10, --movement dump
Dampvs = 10, --
Dampvh = 10, --
Dampw = 50, --waves dump
Turn = 30,
--Speedv = 5000,
Speedv = 6000,
Speedturnmin = 5,
WaveM = 100, --fake waves momentum
Stand = 30, -- forsing to normal vertical position impuls
TiltTurn = 2, --tilt momentum when turning

TiltSpd = 2, --tilt momentum when speeding up
TiltSpdA = 0.3, --tilt momentum when speeding up (acceleration thrhld)
TiltSpdMinV = 5.0, --tilt momentum when speeding up (min speed to tilt when not accelerating)
TiltSpdMinVTilt = 0.37, --tilt momentum when speeding up (how much to tilt when not accelerating)

DownRate = 2000,
BackUpRate = 3000,
BackUpSlowDwnRate= 0,
UpSpeedThrhld = 0,

fMass = 100,
Flying = 1,
},


primitive but might give you some ideas, as I said it will be a lot of work to get a good plane working right now since you'll have to figure it all out on your own

NOVA_Maimer
06-13-2004, 05:43 PM
we already have all the mechanics for the plane, we just need to change the controls so the mouse is involved

-------------------------
My Models (http://maimer.no-ip.info)

farmerTom
06-13-2004, 05:51 PM
<BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by NOVA_Maimer:
we already have all the mechanics for the plane, we just need to change the controls so the mouse is involved

-------------------------
http://maimer.no-ip.info<HR></BLOCKQUOTE>

Flying a plane with a mouse would be a bummer. Save the mouse for looking, and use the glider code. It has roll, pitch, yaw, and left-right, and has mouse look.

sasquatchian
06-13-2004, 05:56 PM
but it doesn't have throttle up/down. A fixed throttle plane is rather difficult to land. http://ubbxforums.ubi.com/infopop/emoticons/icon_biggrin.gif

the_fubz
06-13-2004, 06:29 PM
I THINK i have what you need...
C:\Program Files\Ubisoft\Crytek\Far Cry\game.cgf
has all of the controls http://ubbxforums.ubi.com/infopop/emoticons/icon_smile.gif

---
Sex on the T.V. can't hurt... unless you fall off

thedudemanguy
06-13-2004, 06:42 PM
<BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by NOVA_Maimer:
we already have all the mechanics for the plane, we just need to change the controls so the mouse is involved

-------------------------
http://maimer.no-ip.info<HR></BLOCKQUOTE>

ahaha, I wish I hadn't spent time on that then. can you post what you've got as far as settings I want to give it a whirl.

drtydetroit69
06-13-2004, 07:26 PM
wow seems like some real work went into this, would it be possible to include this in other peoples mod if we give credit to you, because in the mafia mod we were looking to make planes.??

NOVA_Maimer
06-13-2004, 07:40 PM
yep, as i stated above we will release the script(s) when they are all done.

@the_fubz: thats the file that defines the players control options, it doesnt allow me to change how the glider is controled however.

heres our current aircraft script, it has no fine tuning, and to get the tilt in we need to find the controls
http://68.146.96.36/vv/Paraglider.txt

-------------------------
My Models (http://maimer.no-ip.info)

farmerTom
06-13-2004, 08:35 PM
<UL TYPE=SQUARE>
<LI>You can write a function in Lua to call the win32 api for keyboard/mouse input. (not portable)
<LI>You can merge the buggies code for the throtle input.
<LI>You could make the "Speedv = 6000" a "bSpeedv = 6000" and get the variable from a seperate mouse handle.
[/list]

the_fubz
06-13-2004, 10:12 PM
<BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by NOVA_Maimer:
@the_fubz: thats the file that defines the players control options, it doesnt allow me to change how the glider is controled however.
<HR></BLOCKQUOTE>
Well what if you take the info like [i dont know this and am not gonan act like i do]
getkey[mouseup],frontendtiltup
getkey[mousedown],frontendtiltdown
meh, or neh?

---
Sex on the T.V. can't hurt... unless you fall off

aarbro
06-14-2004, 01:44 AM
farmerTom:
"You can write a function in Lua to call the win32 api for keyboard/mouse input. (not portable)"

That sounds very interesting. Do you think it's possible to make that a callback from Win32 into LUA? That way it looks all possible combinations of keys and controls can be used without having a script constantly running in the background. It's just removing the key from the game handler and let the new function take care of it. Say ctrl-G for lowering the landing gear for instance.

Also I'm thinking about new entities that can be controlled by keyboard when next to it. Such as a lock that must be given a code from the num keys for instance.

Marco.C.
06-14-2004, 04:59 AM
<BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by aarbro:
farmerTom:
"You can write a function in Lua to call the win32 api for keyboard/mouse input. (not portable)"

That sounds very interesting. Do you think it's possible to make that a callback from Win32 into LUA? That way it looks all possible combinations of keys and controls can be used without having a script constantly running in the background. It's just removing the key from the game handler and let the new function take care of it. Say ctrl-G for lowering the landing gear for instance.

Also I'm thinking about new entities that can be controlled by keyboard when next to it. Such as a lock that must be given a code from the num keys for instance.<HR></BLOCKQUOTE>

Check out the LUA menu controls scripts, there are already some script game functions built-in to get keys and mouse buttons, you could just go ahead and use those for making new entities controlled by keyboard (like entering a code from the num keys, like in your example)

cheers

xardy
06-14-2004, 05:02 AM
but in that script you just use a name like cryvision? but where is the link with the script its excecuits then. where is the link with the cryvision gogles?

smeekers13
06-14-2004, 06:31 AM
NOVA Im not sure if this is what you mean or not. As far as planes go I havent really tried much b/c i dont wanna invest too much time into a game that *may not* have an sdk. But anyway my thought is boats behave in farcry much like a plane would they have pitch yaw etc... I was messing with the boat and tried to document some of the settings as best I could so if you want em here you go:


---------------------------------------
boat_params={
Damprot = 50000, --8000, has to do with turning when set too low turning made back fishtail
Dampv = 4500, --3500, has to do with moving farward and backward set too high cant move somewhat like friction?
Dampvs = 33500, --3500, similar to damprot except doesnt kill sliding momentum
Dampvh = 100000, --this param controls how the boat bounces to low shoots boat in air too high boat slams to sea floor
-- Dampw = 300000, --waves dump
Dampw = .3, --waves damp not completely sure but when value is set too high boat flips like crazy
Turn = 42000, --7000 controls turning on a horizontal plane
TurnMin = 38000, --7000 similar to above not sure of the difference
TurnVelScale = 10, --not too sure about this one
Speedv = 175000,--115000, speed forward or backward
Speedturnmin = 3, --controls how fast you must go before you can turn i couldnt get and effect above 300 tho
Stand = 350000, -- forsing to normal vertical position impuls how much of a force needed to stand the boat on end
WaveM = 10000, --fake waves momentum 10000 how big of a force the fake waves put on the boat
TiltTurn = 2770, --tilt momentum when turning how hard and fast the boat will tilt from left to right and VV.
TiltSpd = 3500, --tilt momentum when speeding up adjusts how hard the tilt from front to back is
TiltSpdA = 0.05, --tilt momentum when speeding up (acceleration thrhld) not sure
TiltSpdMinV = 10.0, --tilt momentum when speeding up (min speed to tilt when not accelerating)
TiltSpdMinVTilt = 0.17, --tilt momentum when speeding up (how much to tilt when not accelerating)
fMass = 15000,
Flying = 0,

StandInAir = 10000, -- forsing to normal vertical position impuls, when in air.
gravity = -9.81,--gravity , used whe the boat is jumping

CameraDist = 8.5,

------------------------------------
btw if any crytek pple are out there a little help in this dept would be great. if not a full api at least a sample script or two.

[Gemm]
06-14-2004, 06:54 AM
In game.cfg you have:

Input:BindAction("TURNLR", "maxisx", "default", 0);
Input:BindAction("TURNUD", "maxisy", "default", 0);

You then need to bind the movement on TURNLR or TURNUD. VehicleCommon.lua unfortunately does not contain any control key bindings, so it's a bit of a mystery..
I'll let you know if I come up with anything.

smeekers13
06-14-2004, 07:15 PM
I have had thoughts of trying to write some generalized scripts for the mod community like a AircraftCommon or HeliCommon (i know theres one but its basis is mostly ai near as i can figure) So if any other coders wanna get together on irc we can start hammering some stuff out. Buncha heads are better than one. Who knows maybe itll jumpstart Crytek into starting up that #### crymod site and maybe an sdk sometime b4 the sun burns out.

aarbro
06-15-2004, 01:46 AM
<BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by Marco.C.:

Check out the LUA menu controls scripts, there are already some script game functions built-in to get keys and mouse buttons, you could just go ahead and use those for making new entities controlled by keyboard (like entering a code from the num keys, like in your example)

cheers<HR></BLOCKQUOTE>

Excellent, thanks for the direction Marco. I found a way to get hold of individual keypresses. Just added this to an entity and when a key is pressed it's name is shown onscreen:

<pre class="ip-ubbcode-code-pre">
function AnEntity:OnUpdate()
local PressedKey = Input:GetXKeyPressedName();
if ( tostring(PressedKey) ~= "nil" ) then
Hud:AddMessage( tostring(PressedKey) );
end
end
</pre>

It however seems Input:GetXKeyPressedName() only registers when a key is being pressed once. It doesn't recognize when it's repeatingly held down which is needed to make it a controller for a vehicle. Perhaps there is a another function for that or it can be coded around.

The lua scripts are a goldmine, problem is where to start digging http://ubbxforums.ubi.com/infopop/emoticons/icon_smile.gif

xardy
06-15-2004, 04:15 AM
and how do you refere it to a script it needs to use? like for example cryvision? i pres the key and cryvision goes on


(yes i know cryvision is allready in the game just an example to see how it is connected to the script)

aarbro
06-15-2004, 09:08 AM
The function GetXKeyPressedName just returns the last key pressed on the keyboard since last update. If there was none, nil is returned. You have to call it repeatedly to get hold of a key. It doesn't affect the current bindings at all. I found it in BindWaitForKey.lua which is the code where the game asks for what key you want to rebind in the menu.

I still don't know how to bind a key directly to what events are fired. BindAction suggests that for instance TURNLR is the reference to such an event. I have searched all lua files and not found any trace of that. I imagine it can be some kind of table somewhere.

the_fubz
06-15-2004, 11:30 AM
well its gotta be there somewere... good work so far. Were did you people learn the lua's? http://ubbxforums.ubi.com/images/smiley/10.gif
there has to be a holdkey somewere o else how would the vehicles turn...

---
Sex on the T.V. can't hurt... unless you fall off

jasper_vermaas
06-15-2004, 12:25 PM
why not add a Rocket engine to a Glider http://ubbxforums.ubi.com/infopop/emoticons/icon_wink.gif thats a Engine and a Plain in 1 http://ubbxforums.ubi.com/infopop/emoticons/icon_wink.gif

iam working on a Guided Rocket Script and thats the Way iam going to steer the rocket but i need to give it a AI so it will atack targets http://ubbxforums.ubi.com/infopop/emoticons/icon_wink.gif

http://home.publishnet.nl/~pvermaas/fc/oa_banner.jpg (http://www.op-archangel.com)

NOVA_Maimer
06-15-2004, 05:18 PM
hmm, im not having any luck with it yet either, but ill keep trying and post anything i find that can help us.

-------------------------
My Models (http://maimer.no-ip.info)

i8food4dinner
06-15-2004, 08:48 PM
Sorry I can't help with scripting, but this is a great idea and as soon as I saw this thread some questions popped into my head:

1.Will there be a copilot spot so you can jump out the window or something experimental(stupid)?
2. If the mouse wont look around, will there be side and back view keys?
3. Will there be a turret sort of thing in the back like in an old warplane?
4.Will there be a parachute or hanglider or something so that if for any reason you have to/want to bail out you can do so safely?
5.Will there be lots of cargo room?
6.Can you drop bombs from the plane onto merc camps? http://ubbxforums.ubi.com/images/smiley/784.gif

Sorry if I posted to early in the production phase http://ubbxforums.ubi.com/images/smiley/1072.gif but any working plane would be awesome (It's nice to see serious modders/scripters now that most people have worked out their "fun with chainswing!" enthusiasm)

drtydetroit69
06-26-2004, 10:19 AM
*bumpity bump*

any progress?
will we be free to use it in our mods.??

NOVA_Maimer
06-26-2004, 10:58 AM
I still havent found an easy way to get the controls to work, it may require a less conventional method.

And yes, as was stated in the first post and in a response to the same question. This is a community project, therefore everyone has access to it.

-------------------------
My Models (http://maimer.no-ip.info)http://68.146.96.36/maim/greensig.gif

Magnetmannen
06-26-2004, 05:50 PM
well, coding will probably be released with the sdk, so we just got to hope crytek releases some info soon.

http://colossus.hl2central.net/images/news/magnet_sig.jpg
http://colossus.hl2central.net

Kuoster
06-26-2004, 06:35 PM
huray! Airplanes! http://ubbxforums.ubi.com/infopop/emoticons/icon_biggrin.gif

http://img8.imageshack.us/img8/2114/66.jpg

http://images.google.com/images?q=tbn:IPdrkll0K08J:www.eagle97.freeserve.co .uk/Flanker%2520Title.jpg

"Your 6 is my 12"

[A]lpha [N]ovember [D]elta [Y]ankee

Cantrana
06-26-2004, 07:43 PM
I didn't add any buttoms, but playin around with the coding that was already there, I managed to get a VERY crude way to use the paraglider and actually increase ur altitude.
Really all I did was make a few of the properties Nil and played around with other settings in the code below. I'm not sure if the gravity actually works or not, but its in there, lol.

<pre class="ip-ubbcode-code-pre">
Paraglider = {

bNoImpuls=1,

bParaglider=1,
CanShoot = 0, -- player can shoot from his veapon while driving this vehicle -
-- don't change action map to vehicle when entering

fileModelDead = "objects/Vehicles/glider/glider.cgf",

userCounter = 0,
driverWaiting = 0,
driverDelay = 0,
passengerLimit = 0,

messageTime=0,

-- previous state on the client before entering the vehicle
bDriverInTheVehicle = 0,
-- previous driver on the client before leaving the vehicle
pPreviousDriver=nil,
-- previous passenger state on the client before entering the vehicle
bPassengerInTheVehicle = 0,
-- previous passenger on the client before leaving the vehicle
pPreviousPassenger=nil,

IsPhisicalized = 0,

--szNormalModel="objects/Vehicles/zodiacraft/zodiacraft.cgf",
szNormalModel="objects/Vehicles/glider/glider.cgf",

PropertiesInstance = {
sightrange = 180,
soundrange = 10, -- rememeber that sound ranges intersect and sound range for AI doubles when in alert
aibehavior_behaviour = "Boat_idle",
groupid = 154,
},

Properties = {
bTrackable=0,

--fileName = "objects/Vehicles/zodiacraft/zodiacraft.cgf",
fileName = "objects/Vehicles/glider/glider.cgf",

-- [kirill] vehicle gets different damage depending on who's shooter
-- defines the intensity of the damage caused by the weapons to
-- the vehicle
-- shooter is player
fDmgScaleExplosion = 1.1, -- explosions
fDmgScaleBullet = 0.01, -- shooting
-- shooter is AI
fDmgScaleAIExplosion = 0.7, -- explosions
fDmgScaleAIBullet = 0.01, -- shooting

bUserPassanger = 0,
bDrawDriver = 0,
damping = 0.1,
water_damping = 1.5,
water_resistance = 0,
fLimitLRAngles = 180,
fLimitUDMinAngles = -60,
fLimitUDMaxAngles = 60,

},

boat_params={
Damprot = 25, --turning dump
Dampv = 30, --movement dump
Dampvs = 100, --
Dampvh = 100, --
Dampw = 20, --waves dump
Turn = 30,
--Speedv = 5000,
Speedv = 3500,
Speedturnmin = 2,
WaveM = 500, --fake waves momentum
Stand = 30, -- forsing to normal vertical position impuls
TiltTurn = 2, --tilt momentum when turning

TiltSpd = 2, --tilt momentum when speeding up
TiltSpdA = 1.3, --tilt momentum when speeding up (acceleration thrhld)
TiltSpdMinV = 1.5, --tilt momentum when speeding up (min speed to tilt when not accelerating)
TiltSpdMinVTilt = 1.37, --tilt momentum when speeding up (how much to tilt when not accelerating)

DownRate = 1,
BackUpRate = 1000,
BackUpSlowDwnRate=nil,
UpSpeedThrhld = nil,

fMass = 1,
Flying = 1,
gravity = -9.87,
},</pre>

//::Mein Herz Brennt::\\

Cantrana
06-27-2004, 11:15 PM
i hope my above code helped some.. i'm not sure if it might, but i know on the code u provided, it wasn't able to move up or down, but w/ my code it moves up or down.. I just don't like how the gliders moves so fast when i'm trying to decend!

//::Mein Herz Brennt::\\