Tutorial - Conditional Arguments - FreeSpace Wiki.pdf

(2167 KB) Pobierz
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Tutorial - Conditional Arguments - FreeSpace Wiki
12-08-14 11:14
Tutorial - Conditional Arguments
From FreeSpace Wiki
So you're here to have an argument? That's just down the hall. Room 12A.
And you're here to learn about conditional arguments? Well just sit right down!
Contents
ARGUMENTS!
God's gift to FREDders everywhere.
So just what is an conditional argument? Basically it is a type of sexp that allows the game to choose from a
list of pre-defined arguments and use one, a few, or all of them like a normal sexp. Still confused? Well let's
fix that.
We're going to make a quick scenario that will let us showcase every type of conditional argument.
FYI: I'm just going to call them arguments from this point. It's just easier for me.
Base Scenario:
We have 5 ships! Alpha Wing, comprised of 4 Perseus-class fighters and an Elysium transport, named
Omega 1. No hostiles or anything. This is just our sandbox right now.
http://www.hard-light.net/wiki/index.php?title=Tutorial_-_Conditional_Arguments&printable=yes
Page 1 of 37
875144087.011.png 875144087.012.png 875144087.013.png 875144087.014.png 875144087.001.png 875144087.002.png 875144087.003.png 875144087.004.png 875144087.005.png 875144087.006.png
 
Tutorial - Conditional Arguments - FreeSpace Wiki
12-08-14 11:14
So we're going to set up a sexp system that will make each of these fighters warp out if they get below 30%
health. Normally this would require 4 very similar sexps. But we're going to do it in ONE. First though, let's
set up some events to make all of our ships go to 25% health.
http://www.hard-light.net/wiki/index.php?title=Tutorial_-_Conditional_Arguments&printable=yes
Page 2 of 37
875144087.007.png
Tutorial - Conditional Arguments - FreeSpace Wiki
12-08-14 11:14
Simple huh?
Key-pressed is in the training category.
Ok, let's make this work.
any-of (and the basics of arguments)
Any-of is the simplest argument conditional and probably the most common one you will use. Like the name
http://www.hard-light.net/wiki/index.php?title=Tutorial_-_Conditional_Arguments&printable=yes
Page 3 of 37
875144087.008.png
Tutorial - Conditional Arguments - FreeSpace Wiki
12-08-14 11:14
suggests, the sexp will be evaluated once ANY of the arguments can pass the conditions we set.
So first, let's change this when to a when-argument. Right click on the "when", go to "Replace Operator",
then "Conditionals", and finally "when-argument". You can see there's some other operators such as
"everytime-argument" and a bunch of grayed out operators. We will get to those later. So now you should
have something like the below.
http://www.hard-light.net/wiki/index.php?title=Tutorial_-_Conditional_Arguments&printable=yes
Page 4 of 37
875144087.009.png
Tutorial - Conditional Arguments - FreeSpace Wiki
12-08-14 11:14
Let's change the event name to "Retreat when hurt". Now click on "<any data>" and edit it to be Alpha 2.
http://www.hard-light.net/wiki/index.php?title=Tutorial_-_Conditional_Arguments&printable=yes
Page 5 of 37
875144087.010.png
Zgłoś jeśli naruszono regulamin