Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: ReeNoiP on February 06, 2010, 04:30:28 pm

Title: Kamikaze and IFF trouble
Post by: ReeNoiP on February 06, 2010, 04:30:28 pm
I am trying to have a couple of ships do a kamikaze run. They have to seem friendly to the player (and their targets to avoid death by beamfire) until they are scanned.

The problem is having them target the right ships. As far as I understand, the kamikaze order makes the ship kamikaze its target as the order is given.

Since they are friendly when the order is given, I can't select targets by ordering them to attack and then giving the order. I tried ordering them to dock->kamikaze instead, but it doesn't seem to work. A "set shipname target" sexp would be nice, but I can't find anything like that.

Am I missing something about how the kamikaze sexp works? Or is there some trick I can use the pull this off?
Title: Re: Kamikaze and IFF trouble
Post by: Angelus on February 06, 2010, 04:32:59 pm
Try the change-iff SEXP
Title: Re: Kamikaze and IFF trouble
Post by: ReeNoiP on February 06, 2010, 04:36:32 pm
Yeah, that takes care of the IFF change after the scan, but not the kamikaze problem.
Title: Re: Kamikaze and IFF trouble
Post by: Angelus on February 06, 2010, 04:39:26 pm
Then try this

when
      op is-cargo-known-delay
              <a value that fits your needs>
               list of ships
 
      op change-iff
               <hostile>
               list of ships
  
      op kamikaze
              <damage>
              list of ships
Title: Re: Kamikaze and IFF trouble
Post by: FUBAR-BDHR on February 06, 2010, 04:41:54 pm
When scanned
change-iff
add goal attack ship
kamikaze


The attack goal just needs to be after the change iff in the event.
Title: Re: Kamikaze and IFF trouble
Post by: ReeNoiP on February 06, 2010, 04:50:02 pm
Problem is they should still do the kamikaze even if they aren't scanned/turned hostile.

I guess I could work around it by having them turn hostile after they get close and explain it in-mission. Come to think of it, that would probably make more sense anyway  :nervous:.
Title: Re: Kamikaze and IFF trouble
Post by: Goober5000 on February 07, 2010, 01:17:32 am
This is an ideal situation for iff_defs.tbl.  Make a new IFF entry that's identical to Hostile, except that it isn't seen as hostile by Friendly and Friendly doesn't attack it.
Title: Re: Kamikaze and IFF trouble
Post by: Snail on February 07, 2010, 06:23:29 am
This is an ideal situation for iff_defs.tbl.  Make a new IFF entry that's identical to Hostile, except that it isn't seen as hostile by Friendly and Friendly doesn't attack it.
That was what I was going to say.
Title: Re: Kamikaze and IFF trouble
Post by: ReeNoiP on February 17, 2010, 11:40:22 am
I have been trying to use this iff_defs table:

Code: [Select]
#IFFs
   
;; Every iff_defs.tbl must contain a Traitor entry.  Traitors attack
;; one another (required by the dogfighting code) but it is up to you
;; to decide who attacks the traitor or whom else the traitor attacks.
$Traitor IFF: Traitor
   
;------------------------
; Friendly
;------------------------
$IFF Name: Friendly
$Color: ( 0, 255, 0 )
$Attacks: ( "Hostile" "Neutral" "Traitor" )
$Flags: ( "support allowed" )
$Default Ship Flags: ( "cargo-known" )
   
;------------------------
; Hostile
;------------------------
$IFF Name: Hostile
$Color: ( 255, 0, 0 )
$Attacks: ( "Friendly" "Neutral" "Traitor" )
+Sees Friendly As: ( 255, 0, 0 )
+Sees Hostile As: ( 0, 255, 0 )

;------------------------
; Neutral
;------------------------
$IFF Name: Neutral
$Color: ( 255, 0, 0 )
$Attacks: ( "Friendly" "Traitor" )
+Sees Friendly As: ( 255, 0, 0 )
+Sees Hostile As: ( 0, 255, 0 )
+Sees Neutral As: ( 0, 255, 0 )
 
;------------------------
; Unknown
;------------------------
$IFF Name: Unknown
$Color: ( 255, 0, 255 )
$Attacks: ( "Hostile" )
+Sees Neutral As: ( 0, 255, 0 )
+Sees Traitor As: ( 0, 255, 0 )
$Flags: ( "exempt from all teams at war" )

;------------------------
; Traitor
;------------------------
$IFF Name: Traitor
$Color: ( 255, 0, 0 )
$Attacks: ( "Friendly" "Hostile" "Neutral" "Traitor" )
+Sees Friendly As: ( 255, 0, 0 )

;------------------------
; Sneaky
;------------------------
$IFF Name: Sneaky
$Color: ( 0, 255, 0 )
$Attacks: ( "Friendly" "Neutral" "Traitor" )
+Sees Friendly As: ( 255, 0, 0 )
+Sees Hostile As: ( 0, 255, 0 )
 
#End

Setting the transports iff to "Sneaky". Problem is, it still appears as hostile (red, attacked by friendly) when they arrive. Also the Kamikaze is activated using this sexp:
Code: [Select]
$Formula: ( when
   ( <
      ( distance
         "GTT Fawkes"
         "GTC Vigilant"
      )
      1000
   )
   ( kamikaze 0 "GTT Fawkes" )
   ( add-goal
      "GTEP Dartmouth"
      ( ai-undock 89 )
   )
)
+Name: Fawkes kamikaze
+Repeat Count: 1
+Interval: 1
+Team: 0

But the transport just attacks (flies around the cruiser), so the kamikaze must not be activated.
Title: Re: Kamikaze and IFF trouble
Post by: Goober5000 on February 17, 2010, 03:25:46 pm
Okay, Mantis it and attach the mission and the table.
Title: Re: Kamikaze and IFF trouble
Post by: FUBAR-BDHR on February 17, 2010, 03:42:04 pm
Try changing the Kamikaze event to when has arrived delay and the distance check.  Kamikaze ships attacking are probably seen as hostile no matter what.