Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Axem on August 29, 2004, 10:09:24 pm

Title: Fun with Variables...
Post by: Axem on August 29, 2004, 10:09:24 pm
'Elo, here's a diddly of a pickle for anyone. In a upcoming mini-campaign I'm working on, I want a portion of a mission to be random. Depending on some variable generated, I want a different ship to appear.

Eg:
If the variable is 1, send a Fenris
if 2, send an Orion
if 3, send a Deimos

However, Fred doesn't use if statements like that. Any ideas how to acheive something like this? :confused:

I give you a cooooookie... ;)
Title: Fun with Variables...
Post by: Singh on August 29, 2004, 10:23:07 pm
assign a random number to a variable. Then set the arrival cue of the fenris to come in if the variable is 1; the orion to come in if its two and the Diemos to come in if its 3.
Title: Fun with Variables...
Post by: Axem on August 29, 2004, 10:31:41 pm
But how? rand only effects an existing number. I thought about going...

event name
- true
- +
-- rand
--- 1
--- 3
-- variable(0)

However, Fred won't let me use the + operator by itself.
Title: Fun with Variables...
Post by: Spicious on August 30, 2004, 02:07:44 am
Try this:

when
-true
-modify-variable
--variable(0)
--rand
---1
---3
Title: Fun with Variables...
Post by: Axem on August 30, 2004, 06:44:48 am
Yes... of course... :nervous:

I blame Fred for hiding the modify variable sexp in the special group...