Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: pyro_854 on December 13, 2009, 10:50:18 pm

Title: sexp help
Post by: pyro_854 on December 13, 2009, 10:50:18 pm
Are there any good tutorials that explain how this works? I've done a little scripting for Neverwinter Nights and Oblivion, but this sexp thing confuses me. I can't seem to get any thing to go where I want it to. I'm not sure I like this "point and click scripting", meby I just have to get used to the interface.
Title: Re: sexp help
Post by: FUBAR-BDHR on December 13, 2009, 11:13:34 pm
Did you do the walk through? 
Title: Re: sexp help
Post by: pyro_854 on December 14, 2009, 12:04:39 am
Are you talking about the "FRED docs" that come with the editor? I read that a few times but it still confuses me. Is there a different tutorial that explains the interface a little better?
Title: Re: sexp help
Post by: FUBAR-BDHR on December 14, 2009, 12:33:51 am
http://www.hard-light.net/wiki/index.php/Portal:FRED

Check that out if you haven't already. 

The way I learned was by opening missions you have played and are familiar with and seeing how it was done. 
Title: Re: sexp help
Post by: pyro_854 on December 14, 2009, 01:38:26 am
I'm sorry but your link didn't help, all I could find was a "reference for sexps" (a very good reference, I'll be using that later, thanks)

I'll check out some missions from "derelict", I've been playing that and I'm very impressed with the quality. I'll post in a few days if I'm still lost.

I guess I'm just gonna have to play with the interface until I "get it", but right now I'm having problems making my Shivan comm node scannable. I opened the ship editor and found my comm node. Than I clicked the Misc button and found a box marked "scannable" so I checked it, but I can't scan it in game. I tried adding cargo but it still didn't work.
Title: Re: sexp help
Post by: Spoon on December 14, 2009, 04:44:31 am
The best way to learn these things imho is to have some kind of goal/purpose you want to achieve. And then ask things a bit more specific. Just throwing up your hands and saying "I don't get it!" makes it hard for us to help you.

And as Fubar already suggested, you can open up missions (get a .vp opening program from the wiki) and use those as examples.
Title: Re: sexp help
Post by: headdie on December 14, 2009, 05:56:19 am
ok try this, please don't be offended if you already know this but i am taking things to the very basics to make sure everything is covered

events in Freespace are instructions to the FS engine to run a defined script (usualy hard coded into the engine) using the values supplies withing the sexp.

most of the event editor is driven with the right mouse button over the line you want to change and selecting the option you want from the subsequent drop menus

now say I have a fighter called alpha and  I want an event to happen that say when alpha is disabled to repair its engines to 50%

the event would looks something like in the picture below to explain I have hit the new event button and got a blank event

next to the blue dot is the name of the event, right click on that line and select edit data to change it

next is the word "When" - this is a condition which sets up how the game handles logic checks on the event and you wont want to change it to begin with though there are advantages with events that occur often

next is the line where by we define what event in game triggers the event in this case "Is-Disabled-Delay", this tells the game we are checking for a ship with all its engines knocked out and the two values after are 0 which is the delay after the ship is disabled to make the event true, the second is the name in FRED of the ship you want to check for the ship being disabled.

Next is the event you want to happen as a result in this case "repair-subsystem" which will set a subsystem to a value you define. so the first value is the ship Alpha the next is the sub system <engines> and finally the value in percent 50%.

the next blue dot denotes the next event (in this case a default event)

[attachment deleted by admin]
Title: Re: sexp help
Post by: FreeSpaceFreak on December 14, 2009, 09:14:00 am
In the FREDdocs, follow the advanced walkthrough. Takes a while, but definitely worth it.
Title: Re: sexp help
Post by: pyro_854 on December 14, 2009, 01:12:26 pm
Thank you headdie, that was by far the best explanation of the interface I've found yet. I think I know what I was doing wrong, I was simply right clicking on the wrong things.

Like I said before I only have a little scripting experience with text based scripting. I just couldn't wrap my brain around this point and click thing, but I think I get it now. Thanks for the help.

Also, I'm not "just trowing up my hands and saying 'I don't get it'" I think I made it clear that I was having problems understanding the interface... that seems specific enough to ask for help. I do have a goal/purpose I want to achieve but what good is asking "how do I make the enemy call for reinforcements when the player is detected... but only if the primary objective is not complete" when I have no idea how to operate the scripting engine?

"To ask a question you must know at least 60% of the answer."  - Albert Einstein

Any ideas on my "scannable shivan comm node" problem I mentioned in my last post? Or should I just start a new thread?
Title: Re: sexp help
Post by: Goober5000 on December 14, 2009, 03:41:05 pm
Make sure the "cargo known" box isn't checked.

As for your sexps, make sure you're using the right operator.  A lot of FREDders (including me) initially got confused when they tried to set up something like

Code: [Select]
when
--hits-left
----Alpha 1
----50
--do-something

when it should really be

Code: [Select]
when
--<
----hits-left
------Alpha 1
----50
--do-something
Title: Re: sexp help
Post by: 0rph3u5 on December 14, 2009, 03:55:18 pm
Aren't shivans comm nodes unscannable for some reason?  - something with a shiptype-flag they have in the tables?

EDIT: well with this tbm it should work... just place it in your mod-folder under data/tables (if things still dont add up cross-check the tbm with the ships.tbl you use)
otherwise I should work as decibed above

[attachment deleted by admin]
Title: Re: sexp help
Post by: Spoon on December 14, 2009, 04:17:15 pm
As far as I know you cannot even do
Code: [Select]
when
--hits-left
----Alpha 1
----50
--do-something
without a logical <, > or = sexp in fred. hits-left will be greyed out in FRED.
And yeah, at me to the list of people being confused about that part.
Title: Re: sexp help
Post by: pyro_854 on December 15, 2009, 02:42:48 am
I just got Dragon Age: Origins, so I'm gonna take a little break from FREDing... however I did find time to check out 0rph3u5's suggestion, thanks. I replaced the comm node with a cargo pod and it works fine that way. It's a little odd... don't you scan these comm nodes in the main campaign? I'll take a look a your tbm file, I would prefer to make the modifications myself so I know what's  going on.

Also, thanks goober, I probably would have back in a week with a similar problem. I'll keep an eye out for missing operators.
Title: Re: sexp help
Post by: ReeNoiP on December 27, 2009, 11:31:06 am
I just got Dragon Age: Origins, so I'm gonna take a little break from FREDing... however I did find time to check out 0rph3u5's suggestion, thanks. I replaced the comm node with a cargo pod and it works fine that way. It's a little odd... don't you scan these comm nodes in the main campaign? I'll take a look a your tbm file, I would prefer to make the modifications myself so I know what's  going on.

Also, thanks goober, I probably would have back in a week with a similar problem. I'll keep an eye out for missing operators.

I think you scanned the crystal part as a subsystem rather than the "check cargo scan". But if you get a VP extractor (like QuickVP) you can have a look at the retail mission in root_fs2.vp. This is generally usefull when you want to have a look at how something is done.