Hard Light Productions Forums
Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: halcyony2k on August 20, 2013, 05:10:08 pm
-
I am adding ships into fred and leaving them in Hyperspace but I only want a 25 percent chance that they will show up. I am having trouble finding what I am looking for. I have been looking through the tutorials about the "Number-of", "Random-multiple" and "Random-of." Are these what people generally use to generate this type of behavior? Thanks.
-
There's a few ways you could do it. It depends on how you want the ships to show up. A 25% overall chance (25/100 tries you'll see fighters) or 4 different but equal possibilities.
The first one would just be when you're constructing the event to cue in the fighters, you could just go something like...
and
- (original condition)
- =
-- rand-mult
--- 1
--- 4
-- 1
But if you have 4 different sets of fighters, its still very similar. I would have an event that would use the rand-mult sexp to store a random number from 1 to 4 and put it in a variable. Then you can check that variable to see which should arrive.
That would be the simplest way anyway, using conditional arguments might be a little overkill... unless you want something like 4 random groups to show up one at a time but in a random order...
-
Does Freespace check this argument more than once? I added 4 Cains, and gave them the following.
and
-has-time-elapsed
--15
-=
--rand-multiple
---1
---4
--1
After 5 tries, all 4 jump in at the same time.
-
Don't use Rand-multiple. Use rand instead.
If you use rand-multiple the game will basically reroll the dice every frame. If you use rand on the other hand it will roll once and store that result. Which is what you want.