Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Spoon on July 25, 2009, 01:25:18 pm

Title: request: animation on firing
Post by: Spoon on July 25, 2009, 01:25:18 pm
Hello there wizards
I've been working on a mod for a while now and I'm using quite a bit of animation in it. The animation 'triggers' are however a bit limited. What I'd love to see next to primary_bank is primary_bank_fired or something along those lines. As well as certain key presses like throttle increase or when strafing is pressed.
I have no idea if this is scriptable but I have absolutely zero scripting knowledge and no programming talent myself.

Is this easy to add or am I making a unreasonable request here?  :)
Title: Re: request: animation on firing
Post by: Zacam on July 25, 2009, 03:18:55 pm
Look at the FTFx Thor (sp) on the Wiki.

It has a damn nice animation phase for the firing of the Thor's Hammer. Would make a passable start for something like the main gun on the BeBop if you wanted to go Cowboy.
Title: Re: request: animation on firing
Post by: Spoon on July 25, 2009, 05:14:17 pm
Look at the FTFx Thor (sp) on the Wiki.

It has a damn nice animation phase for the firing of the Thor's Hammer. Would make a passable start for something like the main gun on the BeBop if you wanted to go Cowboy.
Aye ive seen it before when I did my first 'research' into the animation
The Thor however uses the 'primary_bank' trigger. You select the bank the thor's hammer is in and the animation triggers.
What I would like however is a trigger when you actually fire a weapon (for recoil animation etc)
Title: Re: request: animation on firing
Post by: Zacam on July 25, 2009, 06:19:44 pm
Ahhh. K. Yeah, that would be cool.
Title: Re: request: animation on firing
Post by: Bobboau on July 25, 2009, 08:11:11 pm
I'm fairly sure this trigger is in place
though knowing my luck it get removed
I know I left instructions on how to add triggers, possibly in the internal forum.
Title: Re: request: animation on firing
Post by: Spoon on July 25, 2009, 08:28:49 pm
If the trigger already exists then I humbly request that it be added in the wiki page on animation code. (pretty please with some space refined sugar on top)
If not, how much 'effort' is it to add such a thing? As I already said, I have close to zero scripting knowledge
Title: Re: request: animation on firing
Post by: Colonol Dekker on July 26, 2009, 03:11:09 am
Where are the weapons for that ship pack, I've had it for a while now but never got around to finding them....
Title: Re: request: animation on firing
Post by: Flipside on July 26, 2009, 03:35:05 am
I'm pretty sure the Maul on the Azaes I made would only rotate when fired, but I can't remember if that was a 'gatling gun specific' type code...
Title: Re: request: animation on firing
Post by: Colonol Dekker on July 26, 2009, 05:20:50 am
Nukemod features animated / rotating chaingun style external animations. D'oh I should have remembered earlier. It's on freespacemods.net
Title: Re: request: animation on firing
Post by: Spoon on July 26, 2009, 05:52:16 am
Just checked out the nuke mod tables
Code: [Select]
$Subsystem: gatling01,100,0
+untargetable
$animation: triggered
$type: Turret Firing
+sub_type: 1
+delay: 0
+relative_angle: 0,120,0
+velocity: 0,5000,0
+acceleration: 0,10000,0
+time: 100
Its done with turret firing. Which unfortunatly =/= primaries firing
Title: Re: request: animation on firing
Post by: Colonol Dekker on July 26, 2009, 06:15:44 am
Does it have the desired end result? If so, what's the prob. .  :huh:
Title: Re: request: animation on firing
Post by: Spoon on July 26, 2009, 06:24:46 am
Does it have the desired end result? If so, what's the prob. .  :huh:
Eeeh.. should be pretty obvious why this does not bring the desired end result right?
Player primary weapon =/= turret
Title: Re: request: animation on firing
Post by: Nuke on July 26, 2009, 07:18:58 am
Just checked out the nuke mod tables
Code: [Select]
$Subsystem: gatling01,100,0
+untargetable
$animation: triggered
$type: Turret Firing
+sub_type: 1
+delay: 0
+relative_angle: 0,120,0
+velocity: 0,5000,0
+acceleration: 0,10000,0
+time: 100
Its done with turret firing. Which unfortunatly =/= primaries firing

dont use that, it never worked

you can use the weapons model feature to have gatling guns, however thats about all you can do with it. if you want something else, like recoiling weapons, you may be able to script those, but it wont be pretty. im not sure if theres any way to actually tell if a ship is firing from scripting, aside from constantly scanning for weapons of a certain type fired by a certain ship. and even then theres no way to know for certain what bank it was from.

I'm fairly sure this trigger is in place
though knowing my luck it get removed
I know I left instructions on how to add triggers, possibly in the internal forum.

any way you can make this public? ive been giving thought to enhancing the animation system to do some of the things ive been doing in script, only faster (animating things from script can cost up to about 5 fps, and might cause collision detection problems). ive also been giving thought to extending the capabilities of the weapon models system as well. making scripting do these things by brute force may not be the best thing to do with the engine.
Title: Re: request: animation on firing
Post by: Spoon on July 27, 2009, 06:25:39 am
Quote
if you want something else, like recoiling weapons, you may be able to script those, but it wont be pretty. im not sure if theres any way to actually tell if a ship is firing from scripting, aside from constantly scanning for weapons of a certain type fired by a certain ship. and even then theres no way to know for certain what bank it was from.
Sounds like a no go then, pity
Title: Re: request: animation on firing
Post by: Bobboau on July 27, 2009, 07:25:36 am

I'm fairly sure this trigger is in place
though knowing my luck it get removed
I know I left instructions on how to add triggers, possibly in the internal forum.

any way you can make this public? ive been giving thought to enhancing the animation system to do some of the things ive been doing in script, only faster (animating things from script can cost up to about 5 fps, and might cause collision detection problems). ive also been giving thought to extending the capabilities of the weapon models system as well. making scripting do these things by brute force may not be the best thing to do with the engine.

well seeing as I do not have that little SCP icon next to my name, no.
maybe there should be a new user group of people who have access to the internal, but are not active coders.
Title: Re: request: animation on firing
Post by: Nuke on July 27, 2009, 10:02:15 am
that would be a good idea, since i seem to be writing c whenever i hit a scripting roadblock. if you can atleast point me in the right direction in the code that would be good too.

Quote
if you want something else, like recoiling weapons, you may be able to script those, but it wont be pretty. im not sure if theres any way to actually tell if a ship is firing from scripting, aside from constantly scanning for weapons of a certain type fired by a certain ship. and even then theres no way to know for certain what bank it was from.
Sounds like a no go then, pity

id kinda like recoiling weapons myself, since i decided to mod some large caliber single barrel guns to use as weapon models. i don't exactly like the idea of them being static. i figure if missiles "pop out" when they reload, then it shouldnt be too hard to make guns pop back when you fire them. it you want something else all together, be specific and i can tell you if ive done it or not.
Title: Re: request: animation on firing
Post by: Spoon on July 27, 2009, 12:40:41 pm
Quote
id kinda like recoiling weapons myself, since i decided to mod some large caliber single barrel guns to use as weapon models. i don't exactly like the idea of them being static. i figure if missiles "pop out" when they reload, then it shouldnt be too hard to make guns pop back when you fire them. it you want something else all together, be specific and i can tell you if ive done it or not.
I'd like to have recoil for a hand held weapon, so all it would need is a 'fire button pressed' kind of trigger that would rotate a subsystem up and down to simulate the recoil effect. And a like wise effect/trigger for swaying legs/arms when strafing and increasing speed.
That's all really 
Title: Re: request: animation on firing
Post by: Nuke on July 27, 2009, 01:28:39 pm
so you wan to turn freespace into a battletech style game? would be cool. i had been actually contemplating a way to do some simple ik in fs with scripted submodel animation. you can getinfo like the amount of lateral thrust the player is applying and adjust the animation accordingly. pretty much any of the game axes can be captured in this sort of way. scripting also has an orientation interpolating function that works quite well to smooth things out.

for a mech you could set up the arms as turrets, since mechs use actuators for that purpose anyway, and then write a script that calls fire_turret on them. you can then use the stock animation code to create the recoil animation. multipart turrets are very scriptable when it comes right down to it. as my freespacelancer (http://www.youtube.com/watch?v=sGdIfbUSlQM) and trackir turret control (http://www.youtube.com/watch?v=rlo2hHlNIZk) and other videos (http://www.youtube.com/watch?v=yvqOrDJUyCU) on youtube would attest. i intend to lump many of those features together in cockpit demo 3, which will also be very moddable (without any scripting knowledge).
Title: Re: request: animation on firing
Post by: Spoon on July 27, 2009, 01:50:55 pm
Quote
so you wan to turn freespace into a battletech style game?
That's more or less the idea, though it's more gundam inspired then battletech

Quote
as my freespacelancer and trackir turret control and other videos on youtube would attest. i intend to lump many of those features together in cockpit demo 3, which will also be very moddable (without any scripting knowledge).
Wow you really did some crazy magic there  :eek2:

Quote
for a mech you could set up the arms as turrets, since mechs use actuators for that purpose anyway, and then write a script that calls fire_turret on them. you can then use the stock animation code to create the recoil animation. multipart turrets are very scriptable when it comes right down to it
ah, this sounds beyond me. For one, I don't really understand on how making the arms turrets and then calling fire_turret with script on them is going to give a recoil effect when a primary weapon is fired?
Title: Re: request: animation on firing
Post by: Bobboau on July 27, 2009, 08:58:24 pm
"that would be a good idea, since i seem to be writing c whenever i hit a scripting roadblock. if you can atleast point me in the right direction in the code that would be good too."

look in modelanim.h. assuming the basic file structure hasn't changed seance my copy was checked out.
there are some spartan instructions there.
basically just do everything that TRIGGER_TYPE_TURRET_FIRING does, except do the function call in the ship fire weapon function.
Title: Re: request: animation on firing
Post by: Nuke on July 27, 2009, 08:58:25 pm
well the recoil effect would use the animation code. the recoil would affect the elbow and sholder joint which would rotate quickly in opposite directions to simulate the recoil. there would be a second invisible arm with the same joints which is a side facing turret. the base rotation joint is the sholder, while the "arms" joint is in the wrist near the firing point. this weapon is locked so the ai cant fire it. to fire it you have to use script, you call fireTurrret() and triggerAnimation() to go figure, fire the turret and run the recoil animation. now the animation needs to complete before the weapon can be fired again. might work for battletech, not sure about gundam though. beams and guns maybe, but if you want one of those energy swords, well i dont know how that would work.
Title: Re: request: animation on firing
Post by: Spoon on July 29, 2009, 07:34:13 pm
Sounds like too much work/effort/magic for me at this time.
Thanks for thinking with me though!