Author Topic: Collecting FRED tricks  (Read 5773 times)

0 Members and 1 Guest are viewing this topic.

Collecting FRED tricks
It occurred to me recently that there doesn't seem to be a place to share simple FRED tricks - there's the wiki tutorial section, aye, but not everything warrants an entire tutorial page, and an easily-scrolled-through list can't hurt, either. With that in mind, here are a couple of mine. Post your own!




Un****ing support ships in escort missions

Ah, we've all had that experience - the NTF/Vasudans/Shivans/random anime bull****/whatever attack on the GTCv Primary Objective has slackened off, and it's a great time to rearm, except the support ship is 6432653464 kilometers in some useless direction because the AI doesn't know to follow you. Let's fix that.

Code: [Select]
( when-argument
   ( any-of "Support 1" "Support 2" "Support 3" "Support 4" "Support 5" )
   ( is-in-mission "<argument>" )
   ( add-goal "<argument>" ( ai-guard "GTCv Primary Objective" 20 )  )
   ( invalidate-argument "<argument>" )
)

As soon as a support ship hits the field, we give it a low priority guard order on the most important friendly ship. (This could also be an installation or the player, depending on the type of mission.) This guard order won't interfere with its ability to rearm things, as those are issued at a higher priority, and once its done rearming, the highest priority order will be the guard order once again.



script-eval-block and <argument>

This one's a little hypothetical, but, put simply, if one argument to script-eval-block is just <argument>, it'll be replaced like any other. This can be used quite nicely with Axem's in-mission jump script:

Code: [Select]
( when-argument
  ( any-of "Alpha 1" "Alpha 2" "Alpha 3" "Alpha 4" "Support 1" )
  ( < ( hits-left "<argument>" ) 40 )
  ( script-eval-block ( "IMJump:To('" "<argument>" "', '" "<argument>" " runs away')" )
  ( invalidate-argument "<argument>" )
)

Pay attention to the quotes!



Guardianing the player's comms

This isn't so much a trick as something I've been wishing would become standard practice ever since BtA did it. Guardianing the player's comm system at 1% is almost completely mechanically irrelevant (it does mean the player will eventually regain the ability to issue orders even without a support ship, but eh), and saves the frustration of arbitrarily missing out on plot points.

 

Offline 0rph3u5

  • 211
  • Someone should label the Future: Assembly Required
    • Steam
    • Twitter
Re: Collecting FRED tricks
Randomly placed random props

currently working on a better version of this - 0rph3u5, 4/13/2019

Hidden Text: Show
Sometimes you just need an extra layer of props lying around in mission which is just nice to have but not essential to mission - abandoned cargo containers, adrift fighters, random sensor blips or maybe an odd discarded "warhead" (not a secondary but a "ship" with the model and stats of a torpedo; please consult your modeler if it works for you). Because it is always a pain to come up with a random distribution on your own and to handcraft it, how about letting the engine to do heavy lifting?

(You might want the player to face away from where this happening for the first second of the mission or block their view. Using this on large objects is not recommended as it will be quite noticeable.)

This takes care of the initial random distribution and orientation:


Taken from an acutal missions, the dimensions of the box in which you want to distribute the objects as well as the number of objects can be adjusted to your needs.

And this makes sure stuff doesn't crash into things right away or is placed into other ships:


The distance for the inital check should be scaled to your needs. Re-orienting an object isn't strictly neccessary.



ps. And now we wait how long it takes for karajorma to tell me that I am using the argument-part wrong :)
« Last Edit: April 13, 2019, 06:14:12 am by 0rph3u5 »
"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

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

"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

"...because they are not Dragons."

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Collecting FRED tricks
The argument part is fine. I'd suggest setting the interval time to zero though. It's unlikely but otherwise you could see an object bouncing about every second until it finally comes to rest in some empty space where it isn't near anything else. Setting it to zero means the event would be checked every frame rather than every second, which means that you might possibly get a tiny glitch in the first second of the mission at worst.
« Last Edit: May 03, 2017, 12:42:49 am by karajorma »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 
Re: Collecting FRED tricks
And you can hide that glitch by starting a mission with a short fade-in effect. I've definitely saw something like that effect somewhere out there, it looked pretty nice.
Mito [PL] - Today at 8:52 PM
I was supposed to make a short presentation about basics of optical fibers and here I am, listening to Eurobeat while reading about quantum cryptography.

 

Offline Axem

  • Administrator
  • 211
Re: Collecting FRED tricks
This looks like a good thread to sticky.

I wish I had some that came to mind. After using FRED for so long, things are less "tricks" and more "this is obviously how its done #humblebrag" :cool:

I'll have to go over my old missions and see if there's anything sort of generic enough that might apply to other people...

 

Offline JSRNerdo

  • 29
  • King of Destroyer
Re: Collecting FRED tricks
Everyone and I mean EVERYONE needs an invisible, untargetable blip of a ship. You can use it for anything! Let the player give it orders to simulate commanding whole fleets or actual capships using query-order! Use it for in-front-of-ship and near-ship warpins! Cameras! Everything!
AKA [`_`]
Inferno: It's the I in Inferno / It's the beam spam delight / Risin' up to a shock jump arrivaaaaaal
Between The Ashes: Look just a really cool and neat thing, OK?
Dimesional Eclipse: High speed anime girlies blowing **** up gets me excited
The Last Stand: A very episodic capship command mini-campaign
Breakthrough: A pretty standard but not really capship command mission

 

Offline JSRNerdo

  • 29
  • King of Destroyer
Re: Collecting FRED tricks
Oh! I also recommend using a decent text editor (i use notepad++ since MJN made the awesome fs2 syntax for it) and you can edit a mission by hand, with the text editor! Very easy for mass find-replaces or copy/pasting, or other stuff that'd be tedious to do in FRED.
AKA [`_`]
Inferno: It's the I in Inferno / It's the beam spam delight / Risin' up to a shock jump arrivaaaaaal
Between The Ashes: Look just a really cool and neat thing, OK?
Dimesional Eclipse: High speed anime girlies blowing **** up gets me excited
The Last Stand: A very episodic capship command mini-campaign
Breakthrough: A pretty standard but not really capship command mission

 
Re: Collecting FRED tricks
Access to support ships is controlled by IFF. If you want the enemy to call for support, and are okay with the player not having access to it, you can use the Hostile IFF for the player's team and Friendly for the enemy.

 

Offline 0rph3u5

  • 211
  • Someone should label the Future: Assembly Required
    • Steam
    • Twitter
Re: Collecting FRED tricks
PSA from the RNGpocalypse:

Do not end an event with the modification of "string"-variable via  modify-variable. Some versions of FRED2 then don't draw the required quotation marks, in the text output, around the string to set the variable to (basically treating it like a number), which then gives you a nasty error message.

Adding a dummy  do-nothing added to the event will prevent this from happening.


When modifing a "string"-type variable via modify-variable, don't just enter data into second argument (aka what you want to set your variable to). It will cause an error message upon saving.

Making sure that you use "Replace Data" -> "string" on the argument will prevent this from happening. Do not just try to enter data into the field before doing this, the engine puts a "number" field there by default and then doesn't automatically know the difference.
« Last Edit: April 16, 2019, 08:28:12 am by 0rph3u5 »
"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

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

"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

"...because they are not Dragons."

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Collecting FRED tricks
Wait, what?

That definitely sounds like a bug rather than something you should be teaching people to do.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline 0rph3u5

  • 211
  • Someone should label the Future: Assembly Required
    • Steam
    • Twitter
Re: Collecting FRED tricks
Wait, what?

That definitely sounds like a bug rather than something you should be teaching people to do.

Yes, sounds like it. However it is more user error than a bug, as I have come to realize after 5 days of dealing with it.
Corrected the post above.
"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

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

"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

"...because they are not Dragons."

 

Offline DefCynodont119

  • 29
  • I should put something witty here- but not this. .
    • Steam
Re: Collecting FRED tricks
Keep your event list organized and clear.


Rather then make a bunch of return to base objectives, you can make one and chain it to an event named something like "Mission RTB State" or something and have that event become true once any of your contextual ending events becomes true.

This makes it much easier to keep track of your mission's win/fail events and diagnose "unending mission" issues.
My gift from Freespace to Cities Skylines:  http://steamcommunity.com/sharedfiles/filedetails/?id=639891299

  

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
Re: Collecting FRED tricks
If you do that, you'll never have to worry about missing "You have left the area without authorization..." debriefings. Simply add "is-event-false-delay" 0 <RTB event name> as the stage's prerequisite. For the rest of the stages, use "is-event-true-delay" 0 <RTB event name> to make sure no miscellaneous stages will appear if the player deserts.
My community contributions - Get my campaigns from here.

"Truth" is the opinion of the majority which it can enforce on the minority. Members of the minority have two choices: join the bandwagon or think. Those who do not fall into line will be brutally crushed.
The tools to maintain order are: lies, double standards, and hypocrisy. The most powerful and the most insidious of them is hypocrisy