Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: emi_100 on September 13, 2008, 12:10:04 am

Title: SEXP: every-time, how ...?
Post by: emi_100 on September 13, 2008, 12:10:04 am
Hi, people :)
I'm still freding doing my "Battle at.." campaign. Thing are start looking good..but I need some help.
I've made a cinematic with the following code:

°/track alpha
===== op- every-time
======| op- is-event-true -delay
======|  | cam1c
======|  | 0
======| op- set-camera-facing-object
========| Ship(alpha1) *VARIABLE*

°/ next ship
===== op- every-time-argument
======| op- any-of
======|  | alpha 1
======|  | alpha 2
======|  | alpha 3
======|  | alpha 4
======| op- not
======|  | op- is-destroy-delay
======|     | 0
======|     | <argument>
======| op- modify-variable
==========| Ship(alpha1) *VARIABLE*
==========| <argument>


ok. the cinematic work fine. But when it's finish the camera is too far from the player's ship.
This is the big problem. Is there a way to disable "every-time" SEXP after using it?
or is there a other solution?

Sorry for my bad english  :p
Thanks
 :)
Title: Re: SEXP: every-time, how ...?
Post by: FUBAR-BDHR on September 13, 2008, 12:21:20 am
Moved this from the TBP forum so assume the TBP release build of 3.6.9. 
Title: Re: SEXP: every-time, how ...?
Post by: karajorma on September 13, 2008, 02:06:42 am
I'm taking a look at this and to be honest I'm a little mystified at what you're trying to achieve here. Your next ship event is always going to end up with the variable holding the value Alpha 4 until Alpha 4 is destroyed because it will set the variable to Alpha 1, then Alpha 2, Alpha 3 and finally Alpha 4 before moving on to any other event.

However to answer the question I can understand, it is actually quite easy to disable an every-time(-argument) SEXP if you use a control variable like this

Do Something
every-time
- =
--VariableName[1]
--1
-do-stuff

Stop Doing it
-when
--Whatever
-modify-variable
--VariableName[1]
--0

The variable is now a switch that can turn the every-time SEXP event on and off. It's often common practice to include a modify-variable SEXP in the event so that it switches itself off after you've used it, like this.

Do Something
every-time
- =
--VariableName[1]
--1
-do-stuff
-modify-variable
--VariableName[1]
--0