March 14, 2010, 11:37:07 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
   Home   Help Login Register  
Pages: [1] 2   Go Down
  Print  
Author Topic: Quick FREDing question  (Read 11561 times)
0 Members and 1 Guest are viewing this topic.
Blitzerland
29

Offline Offline

Posts: 585


WWW
« on: April 23, 2005, 10:22:54 am »

This should be a fairly simple request, but I've been having trouble FREDing it.

I have six transports. If five survive, command sends a certain message. If three survive, another message. Less than that, another message.

I've been fiddling with this for awhile, and can't get it to work. Percent-ships destroyed doesn't work, neither does percent-ships departed, because it keeps calling multiple sexps.

*five ships survive sexp called*

Sexp called, but because five departed, it also implies that three departed.

*three ships survive sexp called*

Next I tried using this:

And
 
 -Percent-ships-destroyed-or-departed
 -100
 -(ship list)

 -Percent-ships-destroyed
 -50
 -(ship list)
 

Didn't work. Still calls muliple sexps. As soon as the "three ships departed" message plays, the "five ships departed" message follows it.
« Last Edit: April 23, 2005, 10:25:25 am by 1278 » Logged
Blaise Russel
Campaign King
29

Offline Offline

Posts: 721


WWW
« Reply #1 on: April 23, 2005, 10:30:55 am »

Sounds like a job for variables!
Logged

karajorma
Robin Hood
Administrator
214

Offline Offline

Posts: 23,150



WWW
« Reply #2 on: April 23, 2005, 10:31:12 am »

Event 1
when
-and
-Conditions that make it time to check who survived
-percentage-ships-destroyed
-83
-send-message
--Only one ship survived


Event 2
when
-and
-Conditions that make it time to check who survived +1 second
-percentage-ships-destroyed
--50
-is-event-false
--Event 1
-send-message
--Only three ships survived

Event 3
when
-and
-Conditions that make it time to check who survived +2 seconds
-percentage-ships-destroyed
--0
-is-event-false
--Event 2
-send-message
--5 ships survived

That way the 3 ships survive event doesn't play if the 5 ships survived event is true.

If you're doing this in combat reverse the percentages and use percentage-ships-departed instead.
« Last Edit: April 23, 2005, 10:40:28 am by 340 » Logged

Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]
Nuclear1
Drunked
211

Offline Offline

Posts: 2,411


« Reply #3 on: April 23, 2005, 10:33:00 am »

Variables are your friend.

Make a new Variable in the Events section named "Safe Transports" or such. When each transport departs, use "modify-variable" and then add +1.

Set events:
-when
-SafeTransports
-=
-3

That's the cue for the "3 safe" message. To avoid confusion, use another variable for "ships destroyed", using a similar process as above. When the variable for "ships destroyed" equals 2, the "safe transports" variable will go off as if only 3 transports survived (which I assume you want).
Logged

Quote
Captain Zelnick - Don't do it, old warrior!  You still have so much to live for!

Tanaka - Like what?  My race is dead.  My world is an airless rock.  And I've seen all of my FunRoms at least a hundred times.  My life is over.  I have already picked out a nice asteroid to smash into, so, if you don't mind, I'll just go and kill myself.  Unless, you want to annihilate me yourself?
<Erik> i liked inferno because it had big ships
<Erik> 8D
<Erik> i was like WOOHOO BIG SHIPS
<Erik> ...and then i realised they were stupid
karajorma
Robin Hood
Administrator
214

Offline Offline

Posts: 23,150



WWW
« Reply #4 on: April 23, 2005, 10:43:05 am »

Or you can use variable like the other two suggested Big grin
Logged

Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]
Blaise Russel
Campaign King
29

Offline Offline

Posts: 721


WWW
« Reply #5 on: April 23, 2005, 10:51:07 am »

But they're not quite as elegant as Kara's suggestion.

*suitably awed*
Logged

karajorma
Robin Hood
Administrator
214

Offline Offline

Posts: 23,150



WWW
« Reply #6 on: April 23, 2005, 11:44:05 am »

You're awed by that? I thought that a fairly simple suggestion.

This is some of the stuff I'm more pleased with Big grin
Logged

Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]
Blaise Russel
Campaign King
29

Offline Offline

Posts: 721


WWW
« Reply #7 on: April 23, 2005, 12:20:39 pm »

Well, 'awe' may be hyperbole, but it's something that didn't occur to me at all, and I would have gone for a solution that uses three times as many events, so...
Logged

Hippo
Darth water-horse
211

Offline Offline

Posts: 2,911

Grazing.


WWW
« Reply #8 on: April 23, 2005, 12:21:14 pm »

Is it just me, or was almost this exact scenario covered int he walkthrough, except with docking transports?
Logged

VBB Survivor -- 387 Posts -- July 3 2001 - April 12 2002
VWBB Survivor -- 100 Posts -- July 10 2002 - July 10 2004

AHTW
Blitzerland
29

Offline Offline

Posts: 585


WWW
« Reply #9 on: April 23, 2005, 01:14:03 pm »

No, you looney.

Anyways, thanks for the help, all. I think I've got it now.
Logged
karajorma
Robin Hood
Administrator
214

Offline Offline

Posts: 23,150



WWW
« Reply #10 on: April 23, 2005, 02:19:43 pm »

Quote
Originally posted by Blaise Russel
Well, 'awe' may be hyperbole, but it's something that didn't occur to me at all, and I would have gone for a solution that uses three times as many events, so...


I do worry about that whenever I post a solution. FRED is getting so powerful these days that I wonder if I'm missing a really easy short cut somewhere Big grin
Logged

Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]
Night Hammer
I Can't FRED
29

Offline Offline

Posts: 935

You'll shoot your eye out...


« Reply #11 on: April 23, 2005, 02:30:59 pm »

id go with kara's suggestion, those variables creep me out:p
Logged

Stop... Hammertime
karajorma
Robin Hood
Administrator
214

Offline Offline

Posts: 23,150



WWW
« Reply #12 on: April 23, 2005, 05:33:28 pm »

I've never understood why variables scare so many people. I was using them in the first mission I ever made straight after doing the walkthrough

It was only when I got online and visited the VBB that I learned that variables were meant to be something I was supposed to be scared of for years Big grin
Logged

Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]
Hippo
Darth water-horse
211

Offline Offline

Posts: 2,911

Grazing.


WWW
« Reply #13 on: April 23, 2005, 05:42:19 pm »

I tend to avoid them, just of old habit... My first experience was when i put a space in a variabl name, and managed to destroy the mission...

I prefer to make long, drawn out events... I think for 2 reasons: One, because I enjoy thinking it through and making it work. And two, because i think its easier to debug. I'll compare the second statement to another situation: You are new to a campaign. You 'inherit' a half done mission from someone else. You have the plotline, but have to spend quite some time picking it apart, seeing how everthing was done, and either change your building style to use whats there, or redo everything to fit your standards. Most times its easier to just start over, and build it in a way that you know exactly whats going on. I choose to use long events, because that way i know exactly what is making things work, and often times, not work...

I'm pretty sure most people would use variables if they had to, but personal preference might make them avoid it...
Logged

VBB Survivor -- 387 Posts -- July 3 2001 - April 12 2002
VWBB Survivor -- 100 Posts -- July 10 2002 - July 10 2004

AHTW
karajorma
Robin Hood
Administrator
214

Offline Offline

Posts: 23,150



WWW
« Reply #14 on: April 23, 2005, 06:00:49 pm »

Thing is that there are several things that can only be done with variables.

Don't use them and you are imposing severe limits on what you can do with FRED (and those limits are getting larger as I think of new things I can do with them almost every time I open FRED)
Logged

Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]
Hippo
Darth water-horse
211

Offline Offline

Posts: 2,911

Grazing.


WWW
« Reply #15 on: April 23, 2005, 06:06:06 pm »

True, which is when i will use them. But 90% of the time, when there's something that can be done with a variable, it can be done with regular SEXP's... You also have to figure, that I like many others learned to FRED on FRED1, so its like giving someone an extra option, that they've already learned to live without in most cases.
Logged

VBB Survivor -- 387 Posts -- July 3 2001 - April 12 2002
VWBB Survivor -- 100 Posts -- July 10 2002 - July 10 2004

AHTW
Night Hammer
I Can't FRED
29

Offline Offline

Posts: 935

You'll shoot your eye out...


« Reply #16 on: April 23, 2005, 06:08:09 pm »

yeah ill use them if need be, but for the most aprt ill try another route
Logged

Stop... Hammertime
Trivial Psychic
211

Offline Offline

Posts: 3,558

Snoop Junkie


« Reply #17 on: April 23, 2005, 07:38:04 pm »

I could condense it all down to one event, one variable, and one message, if the latest version of FSO is used.

variable = convoyships, default value of 0

message: convoy destroyed

"We've lost $convoyships of our transports!"

event name
-every-time-argument
--any-of
---Ship 1
---Ship 2
---Ship 3
--is-destroyed-delay
---< argument >
---0
--modify-variable
---convoyships(0)
---+
----convoyships(0)
----1
--send-message
---#command
---high
---convoy destroyed
Logged

The Trivial Psychic Strikes Again!
karajorma
Robin Hood
Administrator
214

Offline Offline

Posts: 23,150



WWW
« Reply #18 on: April 24, 2005, 03:27:15 am »

True TP but there are two problems with that.

1) Due to a bug in the way messages are sent the message will just keep repeating ""We've lost 1 of our transports!". The variable $convoyships is resolved into a string the first time the message is used. From then on the string won't change no matter how many times you call it or change the underlying variable.
 Goober's aware of this bug and said he's trying to think of ways to solve it (If he hasn't already! Big grin )

2) The message would be rather repeatative. The methods suggested above would allow you to have a different message for each outcome.

That said it's a nice use of every-time-argument
Logged

Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]
Hippo
Darth water-horse
211

Offline Offline

Posts: 2,911

Grazing.


WWW
« Reply #19 on: April 24, 2005, 06:41:24 am »

yeah, combine that with send random message, and its really good
Logged

VBB Survivor -- 387 Posts -- July 3 2001 - April 12 2002
VWBB Survivor -- 100 Posts -- July 10 2002 - July 10 2004

AHTW
Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!