Author Topic: distance-ship-subsystem sexp complete  (Read 2843 times)

0 Members and 1 Guest are viewing this topic.

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
distance-ship-subsystem sexp complete
The distance-ship-subsystem sexp has now been implemented.  Along with the end-mission sexp, this will allow Alpha 1 to realistically depart to ship fighterbays, without needing to jump out. :D This sexp not only works with fighterbays - it works with any ship subsystem.  So you can test how far a bomber is from a turret, or how far you are from the engines (causing your wingman to yell, "Watch out for the engine wash!") or whatever you want. :cool:

Some caveats apply, though.  Unfortunately for this sexp, all the Volition fighterbay subsystems seem to be located at the very tip of the fighterbay entrance on the model.  The sexp measures distance from the center of the subsystem.  When I was testing the sexp with a Typhon, I found that you needed to set the distance trigger to 50 meters or above in order to prevent Alpha 1 from sneaking into the hangar along the wall (as opposed to entering the bay perfectly centered in the tunnel).  This by itself is not a big problem, but since it causes the sexp to fire when Alpha 1 is 50 meters away in any direction, it can go off before Alpha 1 has even entered the bay.

I believe the solution to this is to create an additional hidden subsystem, called "fighterbay exit" or whatever, and place it further inside the tunnel.  Don't move the location of the existing fighterbay, because it's needed that way for bomb locks and so forth.  But use this hidden subsystem as the trigger for Alpha 1, so that the fighter will actually fly partway into the tunnel before the mission ends.

EDIT:
I just realized something.  You don't need to modify the model file at all (and I think this sexp won't work with hidden subsystems anyway).  All you need to do is triangulate Alpha 1's position with respect to the other subsystems on the ship.  So if you were departing into fighterbay 2 of GVD Typhon 1, your sexp would be

Code: [Select]
when
--and
----<
------distance-ship-subsystem
--------Alpha 1
--------GVD Typhon 1
--------fighterbay 2
------140
----<
------distance-ship-subsystem
--------Alpha 1
--------GVD Typhon 1
--------fighterbay 1
------620
--end-mission


It works, I tried it. :)
« Last Edit: December 12, 2002, 03:01:50 pm by 561 »

 

Offline Sesquipedalian

  • Atankharz'ythi
  • 211
distance-ship-subsystem sexp complete
Whoa, whoa, whoa.  I'm getting a conflict now between my last copy of sexp.h and the one you just commited, Goober.  I think you forgot to update before you commited.

Inquisitor, It's Rollback Time![/b][/i]

You'll have to update and then recommit after the rollback, Goober.
Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

The Scroll of Atankharzim | FS2 syntax highlighting

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
distance-ship-subsystem sexp complete
Hey, waitaminnit - I did update.  What conflict are you getting?

*700 posts*
« Last Edit: December 12, 2002, 01:35:04 pm by 561 »

 

Offline Sesquipedalian

  • Atankharz'ythi
  • 211
distance-ship-subsystem sexp complete
RCS file: /home/fs2source/cvsroot/fs2_open/code/parse/sexp.h,v
retrieving revision 2.4
retrieving revision 2.7
Merging differences between 2.4 and 2.7 into sexp.h
rcsmerge: warning: conflicts during merge
cvs server: conflicts found in sexp.h
C sexp.h

*****CVS exited normally with code 0*****


What did you do, exactly?
« Last Edit: December 12, 2002, 01:37:47 pm by 448 »
Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

The Scroll of Atankharzim | FS2 syntax highlighting

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
distance-ship-subsystem sexp complete
I think I know what the problem is. I renumbered about 5 sexp #defines in order to put distance-ship-subsystem right after distance. It was only 5 because there was already a missing number (I have no idea why) but I used that to my advantage.

Is this the conflict?

EDIT: And I fixed the CATAGORY misspelling too.
« Last Edit: December 12, 2002, 01:38:39 pm by 561 »

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
distance-ship-subsystem sexp complete
I just ran a DIFF on the versions.  Catagory->Category would be it.  Just delete your local copy of sexp.h and re-update.  It'll work fine. :)

 

Offline Sesquipedalian

  • Atankharz'ythi
  • 211
distance-ship-subsystem sexp complete
Quote
Originally posted by Goober5000
I just ran a DIFF on the versions.  Catagory->Category would be it.  Just delete your local copy of sexp.h and re-update.  It'll work fine. :)


I'm not sure that was a good idea.  As I recall, V was aware of the misspelling, but didn't change it because it affected code outside of sexp.h.

Quoting from daveb's SEXP Creation Guide:
Quote
The next set of #defines are the categories. Sadly, the word “catagory” (misspelled!) is used and managed to become a permanent fixture of the code. In any case, the OP_CATAGORY_* defines are used by Fred to break down sexpressions into manageable categories for ease of use by mission designers.

Altering the spelling will break Fred, and perhaps more.
Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

The Scroll of Atankharzim | FS2 syntax highlighting

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
distance-ship-subsystem sexp complete
I read that.  But I made sure to fix the misspelling in every file (Microsoft Visual Studio's Find In Files is A-1 SUPAR) so that there would be no conflicts.  I forgot about Fred2, yes, but Righteous1 completed the spelling fix in those files.  So as of now, the "catagory" misspelling has been fixed throughout the entire Freespace 2 codebase.  And I just ran another Find In Files to double-check. :)

 

Offline Sesquipedalian

  • Atankharz'ythi
  • 211
distance-ship-subsystem sexp complete
Okay then...
*Backs up his codebase, then updates*
Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

The Scroll of Atankharzim | FS2 syntax highlighting

  

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
distance-ship-subsystem sexp complete
I just realized something.  You don't need to modify the model file at all (and I think this sexp won't work with hidden subsystems anyway).  All you need to do is triangulate Alpha 1's position with respect to the other subsystems on the ship.  So if you were departing into fighterbay 2 of GVD Typhon 1, your sexp would be

Code: [Select]
when
--and
----<
------distance-ship-subsystem
--------Alpha 1
--------GVD Typhon 1
--------fighterbay 2
------140
----<
------distance-ship-subsystem
--------Alpha 1
--------GVD Typhon 1
--------fighterbay 1
------620
--end-mission


It works, I tried it. :)

My original post has been edited to reflect this.