Author Topic: iff_defs.tbl and a very special combat scenario  (Read 4975 times)

0 Members and 2 Guests are viewing this topic.

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
iff_defs.tbl and a very special combat scenario
HLP, I've come to bargain.

I have a certain mission scenario which requires me to introduce new IFFs via iff_defs.tbl. While the introduction per se is not strictly ciritical to make the mission work - I could just use the standard IFFs along with the change-iff-colour, protect-ship/beam-protect-ship/turret-protect-ship etc etc to make an inferior version work - it is very improtant that it is just so for narrative reasons. The inferior version would also have way more sources for possible bugs than I like (coming from me that means something).

One big problem is that I currently have no device capable of running FS_Open (I can make FRED work but that's about it), so I cannot do my usual thing and just trial and error mercilessly until the engine gives me what I want (even if how I did it is technically using a bug).

The particulars of the scenario are as follows:

The mission requires several non-friendly and non-hostile transports to interact with a friendly ship of significant displacement which is not able to defend itself. The player is tasked with defending said ships alongside another non-friendly/non-hostile cruiser to defend both from attacking hostiles.

There are added story points to this I will not go into at this point but they make it neccessary for the both transports and cruiser to have different attitudes towards the use of their turrets and not be folded into the "friendly" IFF.

The new IFFs are defined in an IFF_defs.tbl as follows (except for the names, those are much more handy in actual .tbl):
Code: [Select]
$IFF Name: IFF_1
$Color: ( 255, 0, 255 )
$Attacks: ( "Hostile" "Neutral" "Traitor" )
+Sees Friendly As: ( 0, 0, 255 )
+Sees Hostile As: ( 255, 0, 0 )
+Sees Neutral As: ( 255, 0, 0 )
+Sees Traitor As: ( 255, 0, 0 )
$Flags: ( "exempt from all teams at war" "orders hidden" )

$IFF Name: IFF 2
$Color: ( 255, 255, 255 )
$Attacks: ( )
+Sees Friendly As: ( 0, 0, 255 )
+Sees Hostile As: ( 0, 0, 255 )
+Sees Neutral As: ( 0, 0, 255 )
+Sees Traitor As: ( 255, 0, 0 )
$Flags: ( "exempt from all teams at war" "orders shown" )
(there is also a new "True Neutral"-IFF in the .tbl, which is blue to everyone and attacks only the "Traitor"-IFF. It only exists to reduce the use of the "Unknown" IFF in the campaign.)

Two questions remain at his point:

1. Does an ship with IFF_2, that doesn't attack aynthing by default, still defend against bombs fired by ships?

2. Does a ship with either IFF_1 or IFF_2 contribute to defense of a IFF "Friendly" (or IFF_2) ship against the bombs?

If no to either of those what do I need to add to do so? (I already looked as ai.tbl and ai_profiles.tbl but came up short of an answer)


ps. I am also out of contact for the next weeks...
« Last Edit: April 16, 2017, 02:15:44 pm by 0rph3u5 »
"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Re: iff_defs.tbl and a very special combat scenario
As best I can determine...

1) No, it does not.  It looks like bombs have to be on a team that the ship attacks (as defined by iff_defs) for the ship to shoot down that bomb.

2) For ship A to defend ship B against ship C's bombs, a) C has to be on a team that A attacks, and b) C and A cannot be the same team.

3) If you're out of contact, it will be difficult to help you solve the problem.

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: iff_defs.tbl and a very special combat scenario
If you're out of contact, it will be difficult to help you solve the problem.

I am back ... Sometimes you just got to go to that special mental space to be creative consistently and sometimes silence is a way to go there.



In the meantime I looked over weapons.tbl for a subsitute but to no result...

Would there be a "minimally invasive" way for feature request here?
"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Re: iff_defs.tbl and a very special combat scenario
I would suggest seeing if there's any way to "fake it" using what already exists.  There are a lot of ways to tweak and adjust things in the code.

I'm also not exactly sure what you're trying to accomplish, which makes it difficult to conceive of how one would change the code.

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: iff_defs.tbl and a very special combat scenario
I would suggest seeing if there's any way to "fake it" using what already exists.

Right now I am using turret-set-target-order and ship-turret-set-target-order but as I understand it that doesn't disable the targeting of ships, as I need it for IFF_2. (IFF_1 appearnetly will work as intended)

I would use turret-set-target-priorities too if I knew what it does. There is no documentation in the wiki on it.



I'm also not exactly sure what you're trying to accomplish

Spoiler:
It's for mission 11 of The Lost Generation - Ashcroft. Basically what I am trying to accomplish is to display different attitudes towards the ongoing conflict.

"IFF_1" is called "Unclear" in the original table, and is reserved the GTC Agrippa which is engaged in the rescue of crew members from the now-derelict NTD Vasa - aiding the player. It is kept on a seperate IFF to allow the player to freely attack it if they don't trust the motives on display (triggering a event chain that turns the Agrippa to IFF Neutral like all other GTVA) but to have it help in the defense of Vasa and the medical ships against other GTVA elements.

"IFF_2" is called "Medical" in the original table, and is reserved for three transports (1 Argo, 2 Elysiums) which facilitate the rescue of survivors from the destroyer. They are on seperate IFF to simulate that there is actually a "ius in bello"-regime these ships still observe which allows them to act in self-defense but not engage.
(that IFF "Medical" can also be freely targted would be cool and sly reference that someone removed the BETAK-conform-programming from the NTF's IFF computers)

If that sounds complicated and messy - that's the intention too - it is not first mission that deals with divided loyalities in either faction.

 (EDIT: actually it is quite a substatial theme to many missions of the second act - and I don't want to do the same problematic bid Blue Planet: War in Heaven does, i.e. maintaining visiually the division between "us vs them" - though the whole thing might come crashing down due to the depiction of Vasudans in the campaign at several occasions ... but that's a story for after the campaign has been released and it can be discussed with the community)
« Last Edit: April 27, 2017, 10:13:20 am by 0rph3u5 »
"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: iff_defs.tbl and a very special combat scenario
I would use turret-set-target-priorities too if I knew what it does. There is no documentation in the wiki on it.
It does nothing unless you've defined some target priority groups.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: iff_defs.tbl and a very special combat scenario
I would use turret-set-target-priorities too if I knew what it does. There is no documentation in the wiki on it.
It does nothing unless you've defined some target priority groups.

Thanks, thats the piece I've been missing ... still not what I am looking for, as far as I can tell right now

The reference to objecttypes.tbl gave me another idea ... let me do some research over weekend if it is actually possible (looking at weapons.tbl and dublicate weapons again)
"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."

  
Re: iff_defs.tbl and a very special combat scenario
So "IFF_2" is supposed to only attack bombs and strikecraft targeting it? You could create a "Targeting_IFF_2" IFF that's identical to the regular hostile (or whatever) IFF, except that "IFF_2" attacks it, with a little script that changes any strikecraft or bombs targeting "IFF_2" to that IFF,

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: iff_defs.tbl and a very special combat scenario
So "IFF_2" is supposed to only attack bombs and strikecraft targeting it? You could create a "Targeting_IFF_2" IFF that's identical to the regular hostile (or whatever) IFF, except that "IFF_2" attacks it, with a little script that changes any strikecraft or bombs targeting "IFF_2" to that IFF,

Only Bombs, not Strikecraft.

The solution you prupose is close to the emergency work-around I've in consideration (making IFF_2 attack Neutral by default and blob turet-protect all bombers, taking into account that then the IFF_1 cruiser does less than it should for no appearent reason)

Also, I am not sure if you can even change the IFF missiles, even with scripts.



The other possibility looked into was using dublicates of the turret weapons with the "bomber+"-flag and variants of the bombers without the "bomber"-flag ... however that doesn't suppress the AI from firing the turrets at the technically-not-bombers and may change the target priorities of AI wingmen...

I haven't made a new objecttype for not-bombers yet and have to look at SCP-SEXPs which could save me the trouble with the dublicate entries if they do what I think they do
« Last Edit: April 30, 2017, 04:50:56 pm by 0rph3u5 »
"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: iff_defs.tbl and a very special combat scenario
Also, I am not sure if you can even change the IFF missiles, even with scripts.
You can; Weapon.Team is its IFF value, and can be set as well as read.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 
Re: iff_defs.tbl and a very special combat scenario
Well! OP, I can pass along a script whenever you like.

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: iff_defs.tbl and a very special combat scenario
Also, I am not sure if you can even change the IFF missiles, even with scripts.
You can; Weapon.Team is its IFF value, and can be set as well as read.

Oh... another thing learned. Thank you.

OP, I can pass along a script whenever you like.

You have the needed access already, do it at your leisure.

And please post it to the Scripting Board as well, so it can be found when someone else needs it.



I in the meantime will make an additional "Warhead"-IFF to make it work.

EDIT: So here is the current chart

[attachment stolen by Russian hackers]
« Last Edit: May 01, 2017, 10:01:38 am by 0rph3u5 »
"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: iff_defs.tbl and a very special combat scenario
Well! OP, I can pass along a script whenever you like.

Is this still comming, or should I start bothering other people? - I really want to get that mission of the ground...
"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."

 
Re: iff_defs.tbl and a very special combat scenario
Sorry, sorry, busy, busy, **** everything, try this:

Code: [Select]
#Conditional Hooks

$Application: FS2_Open

$On Game Init: [

IFF_Hack = {}

IFF_Hack.From = "Hostile"
IFF_Hack.To = "Hostile#SpecialTarget"
IFF_Hack.Trigger = "IFF_2"

function IFF_Hack:OnFrame()
if self.Enabled then
local numWeapons = #mn.Weapons
for i=1, numWeapons do
local weapon = mn.Weapons[i]
if weapon and weapon:isValid() and weapon.Team.Name == self.From then
local target = weapon.Target
if target and target:isValid() and target.Team.Name == self.Trigger then
weapon.Team = mn.Teams[self.To]
end
end
end
end
end

function IFF_Hack:Enable()
self.Enabled = true
end

function IFF_Hack:Disable()
self.Enabled = false
end

]

$State: GS_STATE_GAME_PLAY
$On Frame: [
IFF_Hack:OnFrame()
]

$On Gameplay Start: [
IFF_Hack:Disable()
]

#End

You'll need to switch the value of IFF_Hack.Trigger and probably IFF_Hack.To, and call IFF_Hack:Enable() at the start of missions that use it.
« Last Edit: May 13, 2017, 10:02:27 am by xenocartographer »

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: iff_defs.tbl and a very special combat scenario
Thank you. I will see that I get it entered into the mod during the weekend and see if it works.
"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: iff_defs.tbl and a very special combat scenario
Small hick-up as IFF_defs.tbl is capped at 10 entries - so Neutral-True had to go :(

Just so I have a right, with the clear names for the IFFs it should be like this?
Code: [Select]
IFF_Hack.From = "Neutral"
IFF_Hack.To = "Warhead"
IFF_Hack.Trigger = "Medical"

and before I start agonizing tomorrow why this doesn't work:

Code: [Select]
$Formula: ( when
   ( has-time-elapsed 0 )
   ( script-eval "IFF_Hack:Enable()" )
)
+Name: activate script
+Repeat Count: 1
+Interval: 1

... is all that is required? (I need to take the time off to get into the ins and outs once the campaign is done, right now there is no time to learn new techniques)



EDIT: I am getting an error when starting a mission (not the one that calls for the script) ... I will try to work it out but anyone got a smart idea?

Hidden Text: Show
LUA ERROR: [string "xeno-sct.tbm - On Gameplay Start"]:1: attempt to call method 'Disable' (a nil value)

------------------------------------------------------------------
ADE Debug:
------------------------------------------------------------------
Name:      (null)
Name of:   (null)
Function type:   (null)
Defined on:   0
Upvalues:   0

Source:      (null)
Short source:   
Current line:   0
- Function line:   0
------------------------------------------------------------------


------------------------------------------------------------------

stack traceback:
   [C]: in function 'Disable'
   [string "xeno-sct.tbm - On Gameplay Start"]:1: in main chunk
------------------------------------------------------------------

------------------------------------------------------------------
« Last Edit: May 13, 2017, 08:34:12 am by 0rph3u5 »
"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."

 
Re: iff_defs.tbl and a very special combat scenario
FFS. My bad, I'd typo'd the function name as "Disabled". Try now.

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: iff_defs.tbl and a very special combat scenario
Error message resolved. Thank you.
"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."