Hard Light Productions Forums
Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: Black Wolf on September 28, 2011, 10:24:10 pm
-
Well, can they? I know they can be scripted, but I don't know any LUA at all, and for a few meshes I have planned a sexp based implementation would be immensely useful (And don't tell me to learn LUA, my brain isn't set up to program and I really don't have the time).
-
You can adjust rotating subsystems. Start them, stop them and adjust their speed and direction (clockwise, counter-clockwise). That may be it, though.
-
i think you can trigger one of the tabled animations with a sexp, if you can get the system to work that is. i usually just cheat and use scripting to change a submodel's orientation matrix.
-
You can trigger a tabled animation, yes. Unfortunately, you can't (yet) choose which one: every such animation the ship has will be triggered.
The Lua code to do it is as simple as this:
shiphandle:triggerAnimation("scripted", 0, true)
Use false instead of true if you want to play the animation(s) backwards.
The animation tabling needs these:
$animation: triggered
$type: scripted
And the subobject needs to have these props:
$special=subsystem
$triggered:
-
You can trigger a tabled animation, yes. Unfortunately, you can't (yet) choose which one: every such animation the ship has will be triggered.
The Lua code to do it is as simple as this:
shiphandle:triggerAnimation("scripted", 0, true)
Use false instead of true if you want to play the animation(s) backwards.
The animation tabling needs these:
$animation: triggered
$type: scripted
And the subobject needs to have these props:
$special=subsystem
$triggered:
Triggering everything isn't ideal, but it shouldn't be a gamebreaker either.
This part: shiphandle:triggerAnimation("scripted", 0, true)
I'm assuming goes into scripting.tbl, somehow? Or can it be done directly with script-eval?
Complete scripting novice here - I've only ever used it for gravity and that's about it. :nervous:
-
This part: shiphandle:triggerAnimation("scripted", 0, true)
I'm assuming goes into scripting.tbl, somehow? Or can it be done directly with script-eval?
Complete scripting novice here - I've only ever used it for gravity and that's about it. :nervous:
Yes, you can use script-eval, and probably what you should do if you're not comfortable with scripting.
Use this as your scripting.tbl, or as whatever-sct.tbm, or just add everything except the first and last line to an existing file:
#Conditional Hooks
$Application: FS2_Open
$On Game Init: [
trigger_anim = function(shipname)
mn.Ships[shipname]:triggerAnimation("scripted", 0, true)
end
trigger_anim_reverse = function(shipname)
mn.Ships[shipname]:triggerAnimation("scripted", 0, false)
end
]
#End
Then, you can call those functions with script-eval like this:
( script-eval "trigger_anim('Alpha 1')" )
Yes, the argument to give is literally "trigger_anim('Alpha 1')". It's a bit of a hassle, since if you don't want to hardcode the ship name in every call, you'll have to concatenate the argument string from "trigger_anim('", the ship's name and "')". I'm sure you can also pass the boolean value as a second argument instead of defining two functions somehow, but I haven't tested that.
-
Awesome. I will have a use for this very soon. Thanks heaps. :)
-
you should probably idiotproof those functions though. like make sure the ship handles are valid. this is why i really wish we could embed scripts in missions, so you could distribute scripted missions without needing any tables or mod directories.
-
this is why i really wish we could embed scripts in missions, so you could distribute scripted missions without needing any tables or mod directories.
:yes: from me
-
Would be amazing to see this being improved, though great that the current method's already posted. All I need now is a carrier with animated opening/closing doors and cutscenes will look much better to me. ;)