Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: FreeSpaceFreak on December 16, 2010, 03:00:49 am

Title: Turret-set-target-priorities
Post by: FreeSpaceFreak on December 16, 2010, 03:00:49 am
It's not on the Wiki yet, so - what exactly does it do? Can you have ship names in the list of strings, and will the turret then target the ships in the order listed? Or is it something else?
Title: Re: Turret-set-target-priorities
Post by: headdie on December 16, 2010, 03:27:39 am
If I remember right it sets the priorities based on types so bombs, bombers, fighters, cruisers, etc


teach me to open my mouth before checking
Title: Re: Turret-set-target-priorities
Post by: FUBAR-BDHR on December 16, 2010, 03:36:51 am
Wrong.  You are thinking of a different sexp

It sets target priority groups for that turret.  You have to have groups defined in object types.  It works the same way as setting priority groups on a turret via table. 
Title: Re: Turret-set-target-priorities
Post by: FreeSpaceFreak on December 16, 2010, 11:46:23 am
Ah... What I'm trying to do is have a destroyer attack another one, but there are some escorts in between. The idea is that the destroyers battle each other (no beams, so no fire-beam SEXP), and leave it to the player to take out the escorts. Currently, the friendly destroyer fires first on the escorts (presumably because they're closer by).
This is one of the cases where a fire-turret SEXP would be handy, I guess, or can this already be done somehow?
Title: Re: Turret-set-target-priorities
Post by: General Battuta on December 16, 2010, 11:47:45 am
Ah... What I'm trying to do is have a destroyer attack another one, but there are some escorts in between. The idea is that the destroyers battle each other (no beams, so no fire-beam SEXP), and leave it to the player to take out the escorts. Currently, the friendly destroyer fires first on the escorts (presumably because they're closer by). Can this be done somehow?
This is one of the cases where a fire-turret SEXP would be handy, I guess.

I've had this plan to fake fire-turret. Here's what I want you to try, tell me if it works:

Set the appropriate guns on the friendly destroyer to turret-tagged-only.

Tag the enemy destroyer with tag-ship.

Simultaneously change the enemy destroyer's target color back to red with the appropriate SEXP (change-iff-color?)

Turret target priority only lets you pick between ships, bombs and asteriods.
Title: Re: Turret-set-target-priorities
Post by: FreeSpaceFreak on December 16, 2010, 02:12:45 pm

I've had this plan to fake fire-turret. Here's what I want you to try, tell me if it works:

Set the appropriate guns on the friendly destroyer to turret-tagged-only.

Tag the enemy destroyer with tag-ship.

Simultaneously change the enemy destroyer's target color back to red with the appropriate SEXP (change-iff-color?)

Hmm, that almost works, except that the Demon is still yellow. Apparently the tagged status overrides the IFF colour.
Title: Re: Turret-set-target-priorities
Post by: General Battuta on December 16, 2010, 02:13:53 pm

I've had this plan to fake fire-turret. Here's what I want you to try, tell me if it works:

Set the appropriate guns on the friendly destroyer to turret-tagged-only.

Tag the enemy destroyer with tag-ship.

Simultaneously change the enemy destroyer's target color back to red with the appropriate SEXP (change-iff-color?)
Hmm, that almost works, except that the Demon is still yellow.

Balls. Put the IFF color thing on an every-time. Does that help?
Title: Re: Turret-set-target-priorities
Post by: FreeSpaceFreak on December 16, 2010, 03:13:29 pm
Nope, it doesn't. Still yellow.

Pic to ensure I'm doing it right:

(http://img844.imageshack.us/img844/2998/tempi.gif)
Title: Re: Turret-set-target-priorities
Post by: General Battuta on December 16, 2010, 03:15:30 pm
I forget what each of the arguments do, so I can't be sure.

I suspect TAG may override the change-iff-color. :(
Title: Re: Turret-set-target-priorities
Post by: FUBAR-BDHR on December 16, 2010, 03:25:00 pm
Set up target priority groups.  It's not that hard and makes what you are trying to do very easy. 
Title: Re: Turret-set-target-priorities
Post by: General Battuta on December 16, 2010, 03:25:50 pm
Set up target priority groups.  It's not that hard and makes what you are trying to do very easy.

I have seen it done, but unfortunately it can't be done in FRED alone, which is inelegant.
Title: Re: Turret-set-target-priorities
Post by: FUBAR-BDHR on December 16, 2010, 03:29:04 pm
I've thought of adding that ability.  Not sure how hard it would be. 
Title: Re: Turret-set-target-priorities
Post by: FreeSpaceFreak on December 16, 2010, 03:48:15 pm
Okay, so I make an -obt.tbm like this, and then I can use turret-set-target-priorities with arguments "capital", "corvette", "cruiser" etc.?

Code: [Select]
#Ship Types

$Name:                  cruiser
+nocreate

$Name:                  corvette
+nocreate

$Name:                  capital
+nocreate

#End

(Oh hey look, code tags have a select button now :) )
Title: Re: Turret-set-target-priorities
Post by: FUBAR-BDHR on December 16, 2010, 04:24:07 pm
Not quite right.  More like this:

Code: [Select]
#Target Priorities

$Name: FighterCraft

$Name: Frigate

$Name: Vette

$Name: StrikeCarrier

$Name: Stations

$Name: SmallShips

$Name: MediumShips

$Name: LargeShips

#End

#Ship types

$Name: Fighter
+nocreate
$Target Priority Groups: (
"FighterCraft"
"SmallShips" )


Continue with other types.  Then if you want to have a turret shoot at only the ships in frigate class then you just set target priorities to frigate.  It will ignore all other types.  You can also change the group for a specific ship.  This has never been tested but theoretically you could have a target priority group with nothing in it by default and assign a ship to it in mission.  I do not know if this would work though. 
Title: Re: Turret-set-target-priorities
Post by: Spicious on December 17, 2010, 07:18:57 am
I wrote a sexp that did what you want probably years ago now but no one cared and it never got committed.
Title: Re: Turret-set-target-priorities
Post by: General Battuta on December 17, 2010, 07:21:56 am
I wrote a sexp that did what you want probably years ago now but no one cared and it never got committed.

I CARE I CARE

(http://www.lymanite.com/images/warcraft/orly_owls/i/large/I%20Care.jpg)
Title: Re: Turret-set-target-priorities
Post by: Angelus on December 17, 2010, 07:35:22 am
I wrote a sexp that did what you want probably years ago now but no one cared and it never got committed.

I CARE I CARE

(http://www.lymanite.com/images/warcraft/orly_owls/i/large/I%20Care.jpg)

+1
Title: Re: Turret-set-target-priorities
Post by: Mobius on December 17, 2010, 02:24:00 pm
Have you tried level 1 TAGging (choose the type of tagging via SEXP)? From what I could experience, it works without marking tagged ships with yellow brackets.
Title: Re: Turret-set-target-priorities
Post by: FreeSpaceFreak on December 17, 2010, 03:23:04 pm
Continue with other types.  Then if you want to have a turret shoot at only the ships in frigate class then you just set target priorities to frigate.  It will ignore all other types.  You can also change the group for a specific ship.  This has never been tested but theoretically you could have a target priority group with nothing in it by default and assign a ship to it in mission.  I do not know if this would work though.
Ahm, umm, there doesn't seem to be a SEXP for assigning a ship to a target priority group, is there?

I wrote a sexp that did what you want probably years ago now but no one cared and it never got committed.
Heck, that sure would make things a whole lot easier. Especially now that there are quite some mods that have non-beam anti-cap weapons and therefore can't nicely script their battles like fire-beam can. Do you happen to have the code lying around somewhere? People care now :nod:

Have you tried level 1 TAGging (choose the type of tagging via SEXP)? From what I could experience, it works without marking tagged ships with yellow brackets.
It is tagged level 1, but shows up as yellow. Changing the it to tag level 3, the hostile destroyer shows up red, without even needing the change-IFF-colour. So this is a step in the right direction.

Edit: However, the turrets are simply not firing now. Those that aren't slaved to the turret-tagged-specific work just fine, so it's got to be something in the SEXPs.
Title: Re: Turret-set-target-priorities
Post by: FUBAR-BDHR on December 17, 2010, 03:26:15 pm
Yes there is a sexp for setting the target priority group of a ship.

OK maybe there isn't which is weird because I remember writing it. 
Title: Re: Turret-set-target-priorities
Post by: FreeSpaceFreak on December 20, 2010, 10:44:52 am
Update: I made an -obt.tbm like this, and I could choose the "capital" group in the SEXP. It works beautifully now, thanks FUBAR.
For resetting the priorities, does it make any difference if you use the SEXP with a "true" third argument and an empty list, or a "false" third argument?

Code: [Select]
#Target Priorities

$Name: capital

#End

#Ship types

$Name: capital
+nocreate
$Target Priority Groups:("capital")

#End
Title: Re: Turret-set-target-priorities
Post by: FUBAR-BDHR on December 20, 2010, 03:32:50 pm
Reset sets the list back to what the turret is in the tables.  A blank list removes target priorities so turrets target as if there were no target priorities.  Resetting a turret that doesn't have target priorities tabled or giving that turret a blank list will both result in no target priorities.