Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Cobra on March 02, 2009, 07:39:05 pm

Title: Setting ship-created IFF
Post by: Cobra on March 02, 2009, 07:39:05 pm
So I'm working on a mission and I want to have a radar blip appear on the radar by using the ship-create SEXP, but I don't want it to have a friendly IFF and I want it to be hidden from sensors. How would I go about doing that?
Title: Re: Setting ship-created IFF
Post by: FUBAR-BDHR on March 02, 2009, 08:02:14 pm
Ship-invisible is the most obvious.
Title: Re: Setting ship-created IFF
Post by: Cobra on March 02, 2009, 10:28:17 pm
But how do I set it if the ship was spawned from the ship-create SEXP?
Title: Re: Setting ship-created IFF
Post by: FUBAR-BDHR on March 02, 2009, 11:15:36 pm
Change-IFF to hostile or whatever right after you create it. 
Title: Re: Setting ship-created IFF
Post by: Enioch on March 04, 2009, 12:09:05 pm
But how do I set it if the ship was spawned from the ship-create SEXP?

I think that what he means is that the ship created by ship-create does not show up in the list of ships that the change-iff or the ship-invisible SEXPs can affect.  :rolleyes:

I'd like to hear the answer to that one. From what I know, there's no way to affect a ship created by ship-create. But I'm not a FREDder
Title: Re: Setting ship-created IFF
Post by: FreeSpaceFreak on March 04, 2009, 12:33:38 pm
Have it just come in without warp instead of using the SEXP? There's a checkbox for that underneath the arrival cue box. You can make its IFF hostile by default as well then.
Title: Re: Setting ship-created IFF
Post by: karajorma on March 04, 2009, 03:07:37 pm
I think that what he means is that the ship created by ship-create does not show up in the list of ships that the change-iff or the ship-invisible SEXPs can affect.  :rolleyes:

Yep, it won't. And there really isn't any method to make it show up. I suppose it might be possible to hack the entire SEXP system to make FRED detect the use of ship-create and add all the possible ships to the list but the second you do that someone's going to get the bright idea of creating ships using the names from a variable and it will all go to hell again. :)

Quote
I'd like to hear the answer to that one. From what I know, there's no way to affect a ship created by ship-create. But I'm not a FREDder

That on the other hand isn't true.

Use one of the argument SEXPs. Ships on the argument list aren't checked at start up and therefore don't fall into the same trap that trying to manually write the name of the ship into the SEXP causes. Once you do that you can use pretty much every single SEXP with something made using ship-create.
Title: Re: Setting ship-created IFF
Post by: Enioch on March 05, 2009, 02:45:20 am
That on the other hand isn't true.

Beg Pardon?  :confused: So, bottom line: there is no way to affect a ship-create created ship?
Title: Re: Setting ship-created IFF
Post by: Aardwolf on March 05, 2009, 03:08:38 am
I think he means you can affect it, just you have to manually edit in the name rather than select one from the list.
Title: Re: Setting ship-created IFF
Post by: karajorma on March 05, 2009, 05:00:19 am
That on the other hand isn't true.

Beg Pardon?  :confused: So, bottom line: there is no way to affect a ship-create created ship?

I thought I'd deleted that line. :D It must have been hiding off the bottom of the page. I edited it to show the way round it was originally. :D

I think he means you can affect it, just you have to manually edit in the name rather than select one from the list.

Not quite. You have to use when-argument or every-time-argument.

If you use those you can specify the name of the spawned ship on the list and then use <argument> in the SEXPs.

Both FRED and FS2 error check SEXPs on mission load. If they come across a ship name that isn't in the mission it's flagged as an error. When they come across <argument> however they assume you know what you're doing.
Title: Re: Setting ship-created IFF
Post by: Aardwolf on March 05, 2009, 07:17:36 pm
Oh, that's cool. Might be useful if I do more extensive FRED-ing at some point.
Title: Re: Setting ship-created IFF
Post by: Mpez on February 12, 2011, 10:49:37 am
I know this topic is ancient, but... could anyone post an example of using when-argument? I mean - what will the structure of the event using this sexp look like (I'm confused what to type in any-of = I probably don't understand how arguments work and an example would help)
Title: Re: Setting ship-created IFF
Post by: General Battuta on February 12, 2011, 11:09:18 am
Sec, got one

Code: [Select]
$Formula:
   ( when-argument
      ( in-sequence
         "Alastor#1"
         "Alastor#2"
         "Alastor#3"
         "Alastor#4"
         "Alastor#5"
         "Alastor#6"
         "Alastor#7"
         "Alastor#8"
         "Alastor#9"
         "Alastor#10"
         "Alastor#11"
         "Alastor#12"
         "Alastor#13"
         "Alastor#14"
         "Alastor#15"
         "Alastor#16"
         "Alastor#17"
         "Alastor#18"
         "Alastor#19"
         "Alastor#20"
         "Alastor#21"
         "Alastor#22"
         "Alastor#23"
         "Alastor#24"
         "Alastor#25"
         "Alastor#26"
         "Alastor#27"
         "Alastor#28"
         "Alastor#29"
         "Alastor#30"
         "Alastor#31"
         "Alastor#32"
         "Alastor#33"
         "Alastor#34"
         "Alastor#35"
         "Alastor#36"
         "Alastor#37"
         "Alastor#38"
         "Alastor#39"
         "Alastor#40"
         "Alastor#41"
         "Alastor#42"
         "Alastor#43"
         "Alastor#44"
         "Alastor#45"
         "Alastor#46"
         "Alastor#47"
         "Alastor#48"
         "Alastor#49"
         "Alastor#50"
         "Alastor#51"
         "Alastor#52"
         "Alastor#53"
         "Alastor#54"
         "Alastor#55"
         "Alastor#56"
         "Alastor#57"
         "Alastor#58"
         "Alastor#59"
         "Alastor#60"
      )
      ( true ) - note this event will always be true
      ( ship-create
         "<argument>"
         "GTSG Alastor"
         ( get-object-x "Gallant" "<none>" 0 )
         ( get-object-y "Gallant" "<none>" 0 )
         ( get-object-z
            "Gallant"
            "<none>"
            0
            0
            -200
         )
      )
      ( change-iff "Hostile" "<argument>" )
      ( turret-change-weapon
         "<argument>"
         "turret02a"
         "PDTerPulse"
         1
         0
      )
      ( turret-change-weapon
         "<argument>"
         "turret01a"
         "PDTerPulse"
         1
         0
      )
      ( change-ai-class
         "BALLS OF STEELE"
         "<argument>"
      )
      ( invalidate-argument "<argument>" )
      ( modify-variable
         @guncount[25]
         ( + @guncount[25] 1 )
      )
   )
)
+Name: gallant drops mines
+Repeat Count: -1
+Trigger Count: 60
+Interval: 15
+Team: 0

This event creates an Alastor turret with the first name on the argument list, then changes its IFF, changes its AI class and changes its weapons.

Next time it repeats, since the first <argument> has been invalidated, it will go to the next one on the list.
Title: Re: Setting ship-created IFF
Post by: General Battuta on February 12, 2011, 11:13:07 am
As a more general helpful example, let's say you want an event to fire when any one of the ships Battuta, FUBAR or Kara get near the ship Mpez.

You would create a when-argument that said

When
any-of
(manually type these in)
         Battuta
         FUBAR
         Kara

<
distance (argument) (Mpez)
2000

(do something)

Now let's say you want it to fire once for EACH SHIP. You need to add 'invalidate-argument' at the end of the SEXP. This says 'once the argument has been used once, it can never be used again'. Then give the event a trigger count of 3. It will trigger once for Battuta, once for FUBAR and once for Kara.

What you're typing in as arguments in this case are data entries that would be valid operators in the 'distance' status SEXP. Does that make sense?
Title: Re: Setting ship-created IFF
Post by: Mpez on February 12, 2011, 11:33:08 am
It works :) Now I understand, thank you.