Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Test Builds => Topic started by: WMCoolmon on May 21, 2006, 03:45:20 pm

Title: Intrasystem Warping: 20% Less Hassle Than Before!
Post by: WMCoolmon on May 21, 2006, 03:45:20 pm
Through the use of the scripting system, ships can now be warped out without leaving the mission. Basically, once they warp out, they are put into a limbo state.

Attached is an example of how you can use this, using the script-eval SEXP to access the scripting system, along with the scripting.tbl file needed to define the functions used in the example. ("mn.getShipByName('Alpha 2'):warpOut(false)" is a bit long for FRED)

Also, for testing, I added a debug console command; 'warp'. 'warp true Enemy' will warp in the ship called "Enemy", while 'warp false Enemy' will temp-warp it out. Leaving out the name will use the player ship's target instead.

IMPORTANT: When using scripting functions with script-eval, do not ever use double quotation marks ("); always use single quotation marks('). If you use double quotation marks, you will royally screw up your SEXP tree.

Example files:
http://fs2source.warpcore.org/temp/wmc/intrasystem/scripting.tbl
http://fs2source.warpcore.org/temp/wmc/intrasystem/intrasystem.gif

The build:
http://fs2source.warpcore.org/exes/latest/C21052006.zip
Title: Re: Intrasystem Warping: 20% Less Hassle Than Before!
Post by: karajorma on May 21, 2006, 04:01:05 pm
Very nice.

Since I can't see the code yet though, how are ships in limbo handled by the code? What SEXPs can you use with them? Are they treated as vanished or departed for the duration that they're gone?
Title: Re: Intrasystem Warping: 20% Less Hassle Than Before!
Post by: WMCoolmon on May 21, 2006, 04:29:51 pm
'vanishing' a ship is the same as killing it or making it a depart, in the sense of comparing it to the limbo.

Basically, ships are still present - they just aren't drawn, don't move, and the AI doesn't think etc. So SEXPs can still be used on them, probably all of them. All I did was create a limbo flag and modify the various places in the code where it needed to be checked for, plus modify the warpout functions so that you can specify a false warpout.

They do add a departure event to the mission log, though. I did this because I figured that there might be circumstances where the FREDder wanted to do an intrasystem warp, but wanted it to look like the ship had left for good. For the same reason, the ship is removed from the escort list.

The wingman gauge does show faux-departed ships; I figured that allies would be able to tell what their other ships were doing.
Title: Re: Intrasystem Warping: 20% Less Hassle Than Before!
Post by: karajorma on May 21, 2006, 05:16:30 pm
Fair enough. Definitely gets my thumbs up :yes:
Title: Re: Intrasystem Warping: 20% Less Hassle Than Before!
Post by: Axem on May 21, 2006, 05:20:45 pm
So then could this also be used to make a ship pop into a hangar for a bit (say for repairs, rearming), then come on out again?
Title: Re: Intrasystem Warping: 20% Less Hassle Than Before!
Post by: Goober5000 on May 21, 2006, 06:13:40 pm
While this sounds very cool, we're supposed to be in a code freeze. :p Where are your five fixed bugs?
Title: Re: Intrasystem Warping: 20% Less Hassle Than Before!
Post by: Ransom on May 21, 2006, 09:20:16 pm
Wow, this is incredibly useful. Until now I've been doing it in a really hackish manner, this'll make my life a lot easier.
Title: Re: Intrasystem Warping: 20% Less Hassle Than Before!
Post by: WMCoolmon on May 21, 2006, 10:20:48 pm
While this sounds very cool, we're supposed to be in a code freeze. :p Where are your five fixed bugs?

I really don't want to fix bugs, I haven't committed anything to CVS, and this was already in my codetree before the five bugs rule came about. Nagging me about fixing bugs - which I'm rarely very good at, unless it's very obvious and/or in my own code, is not the best way to motivate me to do something that I already don't want to do. :)
Title: Re: Intrasystem Warping: 20% Less Hassle Than Before!
Post by: Trivial Psychic on May 21, 2006, 11:53:11 pm
What be these 5 bugs?
Title: Re: Intrasystem Warping: 20% Less Hassle Than Before!
Post by: WMCoolmon on May 22, 2006, 02:57:18 am
Goober, phreak, and I were required to fix five bugs before our next feature commit (Goober already has done that, I believe) to reduce the number of bugs in mantis. And phreak hasn't been active since that was instated, I believe. Taylor has been a bugfixing machine, and karajorma has been helping out, but I still don't really relish the thought of squinting at lines of code on a computer screen to track down a bug, that I don't even know if it's valid anymore, or if I can even reproduce.

OTOH, it's not like never bugfixing is going to give a product that anyone wants to use, so I feel a bit obligated to do so, if I want to commit features. So I am not happy about it at all, but I do feel obligated to abide by it.
Title: Re: Intrasystem Warping: 20% Less Hassle Than Before!
Post by: CP5670 on May 22, 2006, 01:32:38 pm
It would be nice if someone could get around to my support ship bug. I just checked in the karajorma 5/17 version and it's still a problem. It takes a little work to produce but occurs pretty consistently.

Anyway, this is a cool feature. It should make this simpler than the old way of doing it (using the duplicate ship with some screwy ASCII character that FS2 doesn't recognize in its name :D). I need to give it a try some time.
Title: Re: Intrasystem Warping: 20% Less Hassle Than Before!
Post by: Ransom on August 05, 2006, 03:14:03 pm
Was this ever committed?
Title: Re: Intrasystem Warping: 20% Less Hassle Than Before!
Post by: karajorma on August 05, 2006, 05:09:04 pm
Yep.

To the main CVS branch, not the 3.6.9 one.
Title: Re: Intrasystem Warping: 20% Less Hassle Than Before!
Post by: Ransom on August 06, 2006, 09:12:20 am
EDIT: That's right FS2, abruptly start working as soon as I give up and make a post about it.

There's another problem now. It seems once the ship's warped back in, SEXPs no longer affect it and any messages in its name will be delivered by Command as though it was still departed.
Title: Re: Intrasystem Warping: 20% Less Hassle Than Before!
Post by: karajorma on August 07, 2006, 03:02:47 am
Now that IS odd. Because I know you can affect ships which were spawned using the Ship-Create SEXP and that should be less likely to work than this. Mantis the problem and I'll take a look at it if Goober or WMC don't.
Title: Re: Intrasystem Warping: 20% Less Hassle Than Before!
Post by: Ransom on August 07, 2006, 01:52:40 pm
Done. (http://lore.maxgaming.net/~scp/mantis/bug_view_page.php?bug_id=0001023)

The mission I attached there uses two SEXPs I know don't work, but I haven't really used it much yet so I'm not sure how many SEXPs aren't cooperating. Apparently some do work, as I discovered when I used self-destruct for the purposes of the test mission.