Modding, Mission Design, and Coding > FRED Academy
Question on Variables
Akalabeth Angel:
Okay, for a mission I'm making (for FA academy). What I'm doing is I'm giving a ship several possible waypoint paths depending on the situation. So for each possibility, I have an event. But in order to ensure that other events aren't introduced after the first correct one I'm trying to use a variable.
Basically, one of the conditions of the events going off is that a numeric variable has value < 1. Then when an event works, the value is supposed to be increased by 1 (from 0 to 1), therefore, invalidating the other events.
I was just wondering if my code was cool:
conditional:
--op
Sesquipedalian:
--- Quote ---Originally posted by Akalabeth Angel
conditional:
--op
Akalabeth Angel:
--- Quote ---1) The blue part is unnecessary. Instead of using the + sexp, change the data type to a number, and enter 1.
--- End quote ---
I don't quite follow here, I tried to "replace data" when fixed on the op + bit and it when I entered 1 it just moved me down a line. What do I press to get to where you're talking about.
karajorma:
--- Quote ---Originally posted by Akalabeth Angel
Okay, for a mission I'm making (for FA academy). What I'm doing is I'm giving a ship several possible waypoint paths depending on the situation. So for each possibility, I have an event. But in order to ensure that other events aren't introduced after the first correct one I'm trying to use a variable.
--- End quote ---
I always get a special thrill when I see people using variables ;) Glad to see you're being brave and trying them out. They aren't really that hard but a lot of people are scared of them.
--- Quote ---Originally posted by Akalabeth Angel
Basically, one of the conditions of the events going off is that a numeric variable has value < 1. Then when an event works, the value is supposed to be increased by 1 (from 0 to 1), therefore, invalidating the other events.
--- End quote ---
Sounds like a fair plan although I'm a little confused as to why you're using a variable for this rather than simply checking if the event is true or not.
--- Quote ---Originally posted by Akalabeth Angel
I was just wondering if my code was cool:
conditional:
--op
Akalabeth Angel:
--- Quote ---Sounds like a fair plan although I'm a little confused as to why you're using a variable for this rather than simply checking if the event is true or not.
--- End quote ---
Because the ship has four possible paths, so either I use one variable or three Sexps. Seems the first is the more efficient. I don't have time right now but I'll check it out in abit.
Navigation
[0] Message Index
[#] Next page
Go to full version