Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: mjn.mixael on May 17, 2012, 11:33:29 am
-
So, I've been working with Admiral MS on his fantastic shipsave script to iron out some bugs. One thing that stands out is how the script destroys ships if necessary. The script will move the ship far away and use self-destruct (which we might change to ship-vaporize).
However, in cases like this we were thinking how it would be helpful to have a way to tell FSO when to not create debris or debris shards at all. Because this script has the potential to do a lot of things all at once, we are trying to minimize the amount of work FSO has to to during that time. (We use ship-vanish if the ship doesn't need to register as destroyed or departed.)
I was talking with Goober and a few ideas came out that I thought were worth discussing. What are the thoughts on...
1: Doing a distance check and if the destroyed ship is so far from the player/camera to not create the debris?
2: Adding an optional flag to self-destruct (or ship-vaporize) to not create debris or debris shards?
-
I like the second idea more. Even far-off debris may have an impact on the battlefield; Sathanases that have been blown up should register.
-
I also like the second idea. It could also be used whenever there's a story or balance related reason for ship not leaving debris. In general, it seems both very practical and a better solution performance-wise.
-
Doesn't the "vaporize on death" (or something) flag already kinda do that? IIRC, it makes the ship just disappear on destruction, no explosions or debris. So basically, you'd just have the script set the 'vaporize on death' flag on (not sure if that's possible mid-mission?) and then selfdestruct.
-
I'm pretty sure LUA scripting can't access most of the settings in the ship editor and these are usually unchangeable in-mission. So obviously I don't want a ship to have a vaporize flag when it's somwhere in the mission and may explode. It's even a problem to blow up a ship with LUA scripting and have the game register it as destroyed without the self-destruct sexp - ship:kill(ship) fails to do that despite its description telling me it should and setting hull to 0 hitpoints left doesn't kill it.
So to me the best solution seems to be self-destruct with an additional flag especially cause it can be used in Fred as well.
-
or fixing the lua function
-
Vaporized ships don't "just disappear". They still go through a (shorter) death roll, they still have explosions, and they still create debris. It's just tiny shards instead of chunks.
-
I'm pretty sure LUA scripting can't access most of the settings in the ship editor and these are usually unchangeable in-mission. So obviously I don't want a ship to have a vaporize flag when it's somwhere in the mission and may explode. It's even a problem to blow up a ship with LUA scripting and have the game register it as destroyed without the self-destruct sexp - ship:kill(ship) fails to do that despite its description telling me it should and setting hull to 0 hitpoints left doesn't kill it.
So to me the best solution seems to be self-destruct with an additional flag especially cause it can be used in Fred as well.
Guardian until the right moment?
-
Guardian until the right moment?
I have no idea why and where guardian should help.
There are some other uses for a no-debris flag as well besides the script and considering that vaporize still creates debris I think its a good idea to add this function.
-
I have no idea why and where guardian should help.
It sounded you were trying to get around a ship exploding at the wrong time when you said:
So obviously I don't want a ship to have a vaporize flag when it's somwhere in the mission and may explode.
I think I just misunderstood. NVM
-
:bump:
Can I make this an official request? I could really use the ability to have an optional flag with self-destruct or ship-vaporize (doesn't matter which one) to not create ship debris or explosion effects at all. Just make the ship disappear and count it as destroyed.
-
Along with that, I have discovered that Scroll needs a way to turn off subsystems without "destroying" them (playing the explosion and sound effect).
-
you mean like to make the modelled subsystem disappear with out going boom?
-
Yep.
-
So here is my version of a no-debris shipflag including a sexp to set it and the code changes to fast forward through destruction so it looks like ship vanish.
Feedback is very much appreciated cause this is my first time changing some code that is actually relevant for the whole game. The names of the variables and functions might be misleading as well so if they should be changed tell me.
-
That's a good effort, but I really don't think a flag is appropriate for this. Ship-vanish isn't implemented using a flag, for example. It would be better, and simpler, to just make this a sexp in the vein of self-destruct, maybe called "destruct-no-debris". Instead of fast-forwarding through the destruction code, it would be better to just call the remove-ship-from-mission code and set the mission log entry.
-
My first idea how to do this was to copy the ship-vanish SEXP, rename it and add the mission log entries.
Why I wanted to do it different is I wanted to get it to work in multiplayer and I thought that someone might want to use that option on ships that have been regularly destroyed during gameplay.
If it is unlikely that my first patch gets accepted, here is another patch for a new SEXP called ship-vanish-destroyed to do the job (ship_vanish_destroyed.patch). It has the same disadvantages of ship-vanish like vanishing all docked ships, removing the dots in the wingmen status hud gauge and not working in multiplayer. That's the reason the sexp should be named ship-vanish-xxx.
During testing I got an assertion related to builtin-messages and I was able to reproduce it even with the normal ship-vanish sexp under the same conditions. I made an additional patch to fix that (ship_vanish.patch).
[attachment removed and sold on the black market]
-
the second patch won't work because it does things like remove the wingman dots instead of marking destroyed. the flag was better.
-
Are you often on IRC, Admiral MS? We could work through an implementation on Saturday.
-
Whenever I'm at home, IRC is usually running. Saturday could be fine depending on your time-zone (I am in CET) and when you do have time. My nickname is "Ams".
-
Made a new patch that adds destroy-instantly and destroy-subsys-instantly sexps to destroy things without sound and explosion effect. Again I'm open for feedback if someone can review my patch.
[attachment removed and sold on the black market]
-
I've only skimmed it so far, but I don't like the idea of copying do_subobj_destroyed_stuff, especially since it's a big function. Can you instead modify do_subobj_destroyed_stuff with a no_explosion parameter, and just skip the things associated with the special effects?
-
Can you instead modify do_subobj_destroyed_stuff with a no_explosion parameter, and just skip the things associated with the special effects?
Did that, the new patch is attached to my post.
[attachment removed and sold on the black market]
-
Well done. :yes: I just did a code review and a playtest, and it passed with flying colors. :)
Committed in r9145.