Hard Light Productions Forums

FreeSpace Releases => Scripting Releases => Topic started by: m!m on March 10, 2011, 12:21:23 pm

Title: Turret control script
Post by: m!m on March 10, 2011, 12:21:23 pm
Here is another script I've been working on that gives you control about a turret :D
I attached a zip file containing the mod. I comes with a test mission and it depends on Blue Planet 2 (because their turrets are perfect for this :nod:).
If you tried it, please tell me what you think and what could be better :)

A random screenshot:
(http://img23.imageshack.us/img23/387/turretcontrol.jpg)

Download the new version here: http://www.mediafire.com/?jzqmoe2882kvv52 (http://www.mediafire.com/?jzqmoe2882kvv52)

Regards,
m!m
Title: Re: Turret control script
Post by: General Battuta on March 10, 2011, 12:40:50 pm
Holy ****.  :eek2:
Title: Re: Turret control script
Post by: MatthTheGeek on March 10, 2011, 02:23:14 pm
This things throws lua errors about screen width, and none of the HUD elements you have on that screenshot are to be found.

Code: [Select]
LUA ERROR: [string "bankInfo.lua"]:5: attempt to perform arithmetic on global 'screenWidth' (a nil value)

------------------------------------------------------------------
ADE Debug:
------------------------------------------------------------------
Name: ?
Name of: field
Function type: Lua
Defined on: 70
Upvalues: 0

Source: misc-sct.tbm - On Game Init
Short source: [string "misc-sct.tbm - On Game Init"]
Current line: 75
- Function line: 6
------------------------------------------------------------------


------------------------------------------------------------------
LUA Stack:
?
loadGauges
?
execute_lua_file
------------------------------------------------------------------

------------------------------------------------------------------

Also, the vertical camera control is inverted, which is quite problematic.
Title: Re: Turret control script
Post by: m!m on March 11, 2011, 04:24:10 am
Ok that could be an issue with the loading order although I can't reproduce it on my side but I uploaded a new version that shouldn't rely on a specific load order.
Also the vertical control isn't an issue on my side. What input system do you use, maybe that is the cause.
Title: Re: Turret control script
Post by: Nuke on March 11, 2011, 06:21:27 am
does this just slave the joystick to the turret control, or ar you using some other method?
Title: Re: Turret control script
Post by: m!m on March 11, 2011, 06:23:05 am
Yes it uses the joystick (or whatever you use) to move the turret.
Title: Re: Turret control script
Post by: m!m on March 20, 2011, 12:12:06 pm
I have an update that adds some minor functionality.
List of changes:
Be sure to test it using a recent build for correct firing points :p

Regards,
m!m

[attachment deleted by ninja]
Title: Re: Turret control script
Post by: Black Wolf on March 21, 2011, 09:32:08 am
I haven't got access to FS2 to test this at the moment, but I do have one question - can it be turned on/off by sexp? I could really, really use this if that ws the case.
Title: Re: Turret control script
Post by: The E on March 21, 2011, 09:34:38 am
Any script can be written in such a way as to make that possible.
Title: Re: Turret control script
Post by: m!m on March 21, 2011, 12:03:57 pm
The script is written with something like that in mind. It can even be modified to only draw the HUD or only control the turret.
Title: Re: Turret control script
Post by: Commander Zane on March 22, 2011, 03:13:02 am
Would this lead to missions where you're forced to operate a turret because an ambush splashes your carrier ship's fighterbay? :D
Title: Re: Turret control script
Post by: Sushi on March 22, 2011, 09:26:31 am
Looks cool, but...

What are the controls?

I can move around, and (sometimes) shoot, but the shots always just go straight up. Enemies are on the radar, but they all seem to be well behind my ship and out of my turret's field of fire...
Title: Re: Turret control script
Post by: m!m on March 22, 2011, 09:48:28 am
You can control the turret using the "standard" input method FS uses (mouse, keyboard, joystick, ...) and press F5 to get a list of possible hotkeys.
Concerning your second problem, are you using a recent build of FSO?
Title: Re: Turret control script
Post by: Sushi on March 22, 2011, 10:43:35 am
You can control the turret using the "standard" input method FS uses (mouse, keyboard, joystick, ...) and press F5 to get a list of possible hotkeys.
Concerning your second problem, are you using a recent build of FSO?

Did an SVN update and a fresh build just to test this out. :)

I'll try it again when I get the chance.
Title: Re: Turret control script
Post by: Sushi on March 22, 2011, 06:41:22 pm
Same problem: turret definitely isn't shooting where I (or the barrel) is pointing.
Title: Re: Turret control script
Post by: Mobius on June 01, 2011, 09:26:03 am
Has the problem mentioned by Sushi been solved? Also, I've just noticed that m!m's screenshot (see link at the beginning of this thread) may have been removed.
Title: Re: Turret control script
Post by: Nuke on January 08, 2012, 08:21:13 am
has this script been mirrored anywhere? i need to update my cockpit script to use the new meathod of turret control and needed a reference implementation to dissect. seems my turret system was broken with newer builds, and instead of trying to fix it i figured id just do things the right way and re-write it to use the new features.
Title: Re: Turret control script
Post by: m!m on January 08, 2012, 08:40:52 am
Here it is http://www.mediafire.com/?7ez65jn0warzf0f (http://www.mediafire.com/?7ez65jn0warzf0f) but I'm not sure if it even works :nervous:
Title: Re: Turret control script
Post by: Nuke on January 08, 2012, 08:55:24 am
this should help, thanks.

thats the funny thing about scripting, stuff that works on one build seldom works on another build. its not as bad as when wmc was trying to hammer out a paradigm for the scripting system, where he renamed functions and variables at random. but its enough to break things that i spent weeks developing. since they fixed my rtt issue been trying to bring old epic scripts up to date with the engine. your features will replace many a dirty hack in my scripts.
Title: Re: Turret control script
Post by: m!m on January 08, 2012, 09:05:15 am
Well, I wasn't active in those days but I rather meant that I'm not sure if I changed something inside the script which broke it.
Also you're welcome for the RTT fix :p
Title: Re: Turret control script
Post by: Nuke on January 08, 2012, 10:04:57 pm
you certainly got my project out of the gutter with that one :D
Title: Re: Turret control script
Post by: m!m on January 09, 2012, 01:45:53 am
And I now have a working guncam script which integrates nicely with Swiftys cockpit display system.
Title: Re: Turret control script
Post by: Alan Bolte on January 10, 2012, 10:26:48 pm
I'm not sure if I changed something inside the script which broke it.
Well, I didn't get any error messages running it on 3.6.14d RC1, but the test mission just gave me the crosshair thing, it didn't have any other visible interface elements or the ability to fire the turret.
Title: Re: Turret control script
Post by: m!m on January 11, 2012, 05:38:24 am
Yeah, that's what I meant but I'll just rewrite it so it can be used as a standalone script and I'll also try to include a FRED interface.
Title: Re: Turret control script
Post by: m!m on September 07, 2012, 04:43:16 am
Here is a new version with a completely rewritten (and this time actually working) version of this script. It includes a FRED interface and the ability to configure a few things using configuration files. The link in the first post has been updated to point to the latest version.

The package contains the script files, a demo mission (requires Blue Planet 2) and an example configuration file, for more information about how to use them please take a look at the PDF file in the data/docs/TCS directory.

If you have been using this script before then you may have to update your missions as some functions have been removed and replaced by corresponding configuration options.
Title: Re: Turret control script
Post by: Dragon on September 09, 2012, 06:38:36 am
You forgot to include the test mission.
Title: Re: Turret control script
Post by: m!m on September 09, 2012, 07:08:38 am
Link updated, now the package should contain the test mission.
Title: Re: Turret control script
Post by: Black Wolf on September 11, 2012, 08:10:34 pm
Just got home, looking forward to testing these upgrades. :D