Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: CMDBob on April 02, 2012, 01:42:18 pm

Title: Rotating Submodels on ships when a primary bank fires
Post by: CMDBob on April 02, 2012, 01:42:18 pm
Hi, I've got a fighter that has two objects that should rotate when a certain primary bank is being fired. The objects have the right rotation axis defined in their properties, and I've added (what I think is) the right code to the subobject properties to the subobject on the fighter.
(http://homepages.shu.ac.uk/~b0017248/OtherStuff/SubobjProperties.png)

Now, I'm not sure what to do next, do I add a subsystem or something? Any help would be appreciated, as I'm bashing my head on a brick wall here.
Title: Re: Rotating Submodels on ships when a primary bank fires
Post by: Rampage on April 03, 2012, 10:23:36 am
Where's all the fun if you don't do a little sleuthing?  Download NukeMod and use the examples contained therein.

R
Title: Re: Rotating Submodels on ships when a primary bank fires
Post by: General Battuta on April 03, 2012, 10:29:51 am
If you've got BP2 handy you can also use ships therein (the main gun on the Lao Tze, for instance).
Title: Re: Rotating Submodels on ships when a primary bank fires
Post by: --Steve-O-- on April 03, 2012, 10:57:26 am
wrote this up some time ago, should contain most of what you will need in terms of bending the animation code to your will.
http://www.hard-light.net/forums/index.php?topic=49741.msg1006837#msg1006837
Title: Re: Rotating Submodels on ships when a primary bank fires
Post by: Aesaar on April 03, 2012, 10:58:44 am
The Lao Tze doesn't have a rotary cannon anymore.  Look at the Gattler.
Title: Re: Rotating Submodels on ships when a primary bank fires
Post by: CMDBob on April 03, 2012, 11:44:12 am
I think I've got it. A shame I have to make the rotational bit (as it's not the whole gun, it's just two little bits that are joined on to the ship) the weapon model, but it'll work. Now I just have to find a way to lock primary armament selection while still allowing secondary selection in the briefing.
Title: Re: Rotating Submodels on ships when a primary bank fires
Post by: MatthTheGeek on April 03, 2012, 11:56:17 am
I don't think it's possible at the moment, although it has been requested.
Title: Re: Rotating Submodels on ships when a primary bank fires
Post by: headdie on April 03, 2012, 01:16:11 pm
I think I've got it. A shame I have to make the rotational bit (as it's not the whole gun, it's just two little bits that are joined on to the ship) the weapon model, but it'll work. Now I just have to find a way to lock primary armament selection while still allowing secondary selection in the briefing.

limit the player's weapon selection and use $pbank allowed: ( "123" "1234" )( "12345" )

There is a sub model rotation for external primaries

Quote
$External Model File:
FS2 Open 3.6.10:
Defines the models shown on the gunpoint, used with Bobb's external-visible-weapon code.
Syntax: String.pof, model filename

$Submodel Rotation Speed:
FS2 Open 3.6.10:
Defines the rotation speed of the external weapon model
Syntax: Float

$Submodel Rotation Acceleration:
FS2 Open 3.6.10:
Defines the rotation acceleration of the external weapon model
Syntax: Float

and iirc you can fake moving primary gun points by having several in the circle and using the cycle flag on the weapon
Title: Re: Rotating Submodels on ships when a primary bank fires
Post by: Nuke on April 03, 2012, 02:08:39 pm
I think I've got it. A shame I have to make the rotational bit (as it's not the whole gun, it's just two little bits that are joined on to the ship) the weapon model, but it'll work. Now I just have to find a way to lock primary armament selection while still allowing secondary selection in the briefing.

you can prevent other types of weapons from being equipped to a certain bank (using $allowed pbanks: and $default pbanks:), but i dont think you can enforce the bank so that there is always a weapon there. might launch without one for example. id really like a feature that treats a weapon as part of the ship, where its always equipped (and possibly for ballistic weapons allow partial weapon loads for primary banks).

i brought up another idea a few days ago in another thread, to do a banktypes system. each bank is assigned a type, each type containing a collection of bank settings. like whether to show weapon models in the loadout screen, allow weapon to be changed, ammo characteristics, energy usage, autoaim features (instead of being a per ship or per weapon thing, would be awesome at the per bank level, like having a gimballed gun mount that can accommodate any weapon). possibly also change the way primary and secondary banking is handled, for example treat a secondary bank like a primary bank and vise versa. you could possibly also configure linking and selecting characteristics for various banks. just an idea, im considering it for my own engine, but i dont see why it wont work in fs.
Title: Re: Rotating Submodels on ships when a primary bank fires
Post by: General Battuta on April 03, 2012, 02:18:33 pm
Simple solution - allow only one weapon in the bank and fire a SEXP at mission start to change that bank to the weapon you want, just in case the player for some reason removes it.
Title: Re: Rotating Submodels on ships when a primary bank fires
Post by: Nuke on April 03, 2012, 02:27:21 pm
or you could do that. you could probibly also script it.

but dont shoot down the bank types idea just yet, it could allow for a broad range of cool new features.
Title: Re: Rotating Submodels on ships when a primary bank fires
Post by: General Battuta on April 03, 2012, 02:41:34 pm
Oh, I'm not shooting it down, that system sounds awesome.
Title: Re: Rotating Submodels on ships when a primary bank fires
Post by: Dragon on April 03, 2012, 04:34:20 pm
It looks like your gatling gun is a part of a ship.
http://www.hard-light.net/wiki/index.php/Subobject_and_subsystem_properties#.24pbank
This could help.
Title: Re: Rotating Submodels on ships when a primary bank fires
Post by: Nuke on April 03, 2012, 05:11:50 pm
weapon models use the "$gun_rotation" property.

i dont know if i ever used $pbank, this actually reminds me of an old deprecated feature (also why nukemod uses weapon models, they had used the older feature before that point) that worked the same way as this is described. the wiki seems to indicate that this was added back in.
Title: Re: Rotating Submodels on ships when a primary bank fires
Post by: Dragon on April 03, 2012, 05:51:35 pm
He seems to be using a gun model integrated with the ship model. Hence I propose using this.
Title: Re: Rotating Submodels on ships when a primary bank fires
Post by: qwadtep on April 03, 2012, 07:46:53 pm
I think I've got it. A shame I have to make the rotational bit (as it's not the whole gun, it's just two little bits that are joined on to the ship) the weapon model, but it'll work.
Pretty sure that shouldn't be a problem, just make the spinny bits their own subobjects and set the firing point to the end of whatever nonspinny bit when you're converting. One of the PCS2 gurus can probably explain better.