Hard Light Productions Forums

General FreeSpace => FreeSpace Discussion => Topic started by: r0nin on May 31, 2002, 11:30:35 pm

Title: Blatantly stupid FRED2 question...
Post by: r0nin on May 31, 2002, 11:30:35 pm
As embarrasing as it is to ask, I have a ridiculously simple question about SEXPs in FRED2.  Once a sexp has been activated (ie. has returned true) is there anyway to reset the sexp?

I have a function that needs to be called every time a player presses a certain key.  I really don't want to have to code a new key control, and the "key-pressed" sexp would be perfect (as I already have made a cusom sexp to call the function), except for one thing.  I press the key, the function is called, and the sexp becomes true/inactive/erased and cannot be used again.

Any solutions?
Title: Blatantly stupid FRED2 question...
Post by: vadar_1 on May 31, 2002, 11:40:59 pm
key-pressed is usually the only reason to use an event more then once... and looping would be the only way, but key-pressed loops dont work too well.... sorry
Title: Blatantly stupid FRED2 question...
Post by: NotDefault on June 01, 2002, 02:44:03 am
What is with all the self-deprecation? :confused:

As for your question, I have no idea, unfortunately. :(
Title: Blatantly stupid FRED2 question...
Post by: Stunaep on June 01, 2002, 03:57:55 am
the only way I could think of doing that is by chained events. That would take a hell of a lot of events though, so that may not be a good idea.
Title: Blatantly stupid FRED2 question...
Post by: karajorma on June 01, 2002, 07:13:23 am
I had a play around in FRED and I couldn`t get it to work either. What are you trying to do anyway? There might be a better way than key-pressed loops.
Title: Blatantly stupid FRED2 question...
Post by: r0nin on June 01, 2002, 08:15:48 am
Quote
Originally posted by karajorma
I had a play around in FRED and I couldn`t get it to work either. What are you trying to do anyway? There might be a better way than key-pressed loops.


Well, I was trying to help out the guys at the Robotech mod.  They have one mode of the transformable ship drawn in the pof for the turret01 subsystem as it normally is, and one mode for turret01 destroyed.  I haven't had any problem coding the change between the two modes (triggered by a keypress and sexps), but getting it to operate based on keypresses would have been easier than coding a new control.  Looks like I'll have to try that...
Title: Blatantly stupid FRED2 question...
Post by: Hippo on June 01, 2002, 11:14:04 am
make a chained event that has a chain delay of 5 or so, and change do-nothing to key-reset. then you can change TRUE in the chained part to not- then something so they can't use it after something has happened...
Title: Blatantly stupid FRED2 question...
Post by: r0nin on June 01, 2002, 12:18:51 pm
Quote
Originally posted by Hippo
make a chained event that has a chain delay of 5 or so, and change do-nothing to key-reset. then you can change TRUE in the chained part to not- then something so they can't use it after something has happened...


Maybe I misunderstand what you are telling me to do, but this didn't work for me.

I chain a key-reset event to the original transform event, and after transforming once, I can't do it again.  Exactly what should your key-reset event be chained to?
Title: Blatantly stupid FRED2 question...
Post by: karajorma on June 01, 2002, 12:21:35 pm
Hippo I`m having real trouble figuring out what you`re on about but if you`re suggesting something like this

Event 1 (repeat 900 times, 2 second interval)
-When
--Key-Pressed
----1
--Do-Something


Event 2 (chained to 1, repeat 900 times, 1 second interval)
-When
--True
--Reset-Key
---1

I tried that already. What happens is that the game endlessly repeats the Do-Something. I did get it once to stop endless repeating but the second you hit 1 again it starts again. What's really strange is that I`ve never been able to replicate this again!
Title: Blatantly stupid FRED2 question...
Post by: Hippo on June 03, 2002, 01:40:34 pm
oh well, it works for me...
Title: Blatantly stupid FRED2 question...
Post by: karajorma on June 03, 2002, 04:53:56 pm
Obviously this is like the whole

Has-Arrived
-Ship
--0

thing. Maybe it works for some people but not for others. If that's the case you can`t use it in a campaign.
Title: Blatantly stupid FRED2 question...
Post by: Stunaep on June 04, 2002, 07:31:58 am
Perhaps removing the 900 repeat count??? on event 1.
Title: Blatantly stupid FRED2 question...
Post by: karajorma on June 04, 2002, 10:16:57 am
If I remove the repeat count on event 1 it would work. ONCE! :)

Since the desired result is for the player to be able to transform at will that wouldn`t be much use at all.

Hippo. If you`ve got it to work could you make it available for download? I'd like to see if you`ve done something different from me.

Edit: Freespace is very weird when it comes to looped events. Here's an example that I came across once.


Make a mission with two events like this

Event 1 (repeat 100 times, delay 1 second)
When
-True
-Modify Variable
--VariableName
--Rand
---1
---3

Event 2 (Repeat 100 times, delay 1 second)
When
- =
--VariableName
--1
-Send Message

You would think that would result in a message being sent an average of every 3 seconds at random intervals. In fact 2/3 of the time you run the mission nothing happens. The other 1/3 of restarts results in the message being sent 100 times. The random function is only calculated once. In each further loop the number just stays the same as it was in the last loop.

 Probably something similar is hapening here.
Title: Blatantly stupid FRED2 question...
Post by: Hippo on June 04, 2002, 02:08:13 pm
I'll find it and e-mail it, who would like it?
Title: Blatantly stupid FRED2 question...
Post by: karajorma on June 04, 2002, 02:38:10 pm
Send it to [email protected]