Jump to content
Sign in to follow this  
Psycho1

Random weather and time for mp map

Recommended Posts

I have three weather/time combos I'd like to have chosen at random for my MP map. Is it possible to do that? If you could choose the likelihood of a time/weather condition showing up that would be even better. I went to the OFP editing center and looked at their mission.sqm tutorial, but they don't mention if that's possible or not. I hope it is:) Kinda get tired of always playing in a nice, clear blue sky, hehe.

Share this post


Link to post
Share on other sites

I haven't tested this one by myself but you can try the following:

add to the "init.sqs" script:

; get a random real value from 0 to 3:

_randVal = random 3

; choose a weather

; sunny

?(_randVal <= 1):0 setOvercast 0

; cloudy

?((_randVal > 1) && (_randVal <= 2)):0.5 setOvercast 0

; stormy

?(_randVal > 2):1 setOvercast 0

exit

Hopefully that works! smile.gif

Share this post


Link to post
Share on other sites

Oh yes, and that daytime...

Make the mission start from 00wow.gif0 hours.

Add in "init.sqs" (before weather things if you don't want the time change the weather estimation):

; skips the time from 0 to 24 hours

skipTime (random 24)

Again, haven't tested this one!

Share this post


Link to post
Share on other sites

Another posibility for random weather :

(random 180) SetFog (random 1)

(random 180) SetOvercast (random 1)

I used random weather and starting time for couple of my missions. It works.

Share this post


Link to post
Share on other sites

Bart.Jan - your suggestion was nice, but it can

only be used in single-player, and Psycho1 wants

to use it in multi-player. The reason is, that the

random weather, like you are doing it, will be created

different (randomly) on each machine.

Psycho1: you could run a script, and let the script end,

if it's not the server, who runs it:

e.g: ?!(local Server): Goto "end"

use this as first line of your script, so it runs only, if it's

on server - don't forget to have the end subroutine too:

#end

exit

Now create your random values from this script, by putting

them into variables and using the publicvariable method,

to send them to clients.

This way, you could have a real random weather, not

depeding on only 3 possibilities.

hope this helps

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (DV Chris Death @ Mar. 07 2002,19:10)</td></tr><tr><td id="QUOTE">Bart.Jan - your suggestion was nice, but it can

only be used in single-player, and Psycho1 wants

to use it in multi-player. The reason is, that the

random weather, like you are doing it, will be created

different (randomly) on each machine.<span id='postcolor'>

I expected when script in MP is executed its results are generated on server and then send to clients. Weather and time should be same as on server are. Am I wrong ?

Share this post


Link to post
Share on other sites

Yes you are;

make a simple test, by using a script, which creates

a random value (use radio call - activation: repeatedly to

execute the script).

Create any random variable, and let it be displayed onto

screen.

Try it with more than 2 players (for some strange reason,

things may work right, if only 2 players are in the game,

different to playing with more than 2) - and then ask

them, what value they could see.

Share this post


Link to post
Share on other sites

I tried it your way Chartier and it didn't work:( I didn't get any errors though, but it would always be the same weather condition. I made sure to take out startweather and forecast weather before doing it too.

Chris, I'd be more than happy to do make my own script, but I don't know how just yet:( I'm not experienced enough with scripts right now to do something like that, could you give me a little help? Thx all for the help.

Share this post


Link to post
Share on other sites

Bart.Jan:

Is it so that setOvercast method has a syntax of:

time setOvercast overcast

instead of comref spec:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">overcast setOvercast time<span id='postcolor'>?

At least your example (random 180) SetOvercast (random 1) would make an impression of that. This would explain why my example didn't work...

Psycho1:

How about adding an "local Server" check as Chris mentioned to set random value and after that publishing the value to remote hosts with publicVariable -method?

I have to test this by myself also, this all is only speculation... I'll be back on that after weekend.

Share this post


Link to post
Share on other sites

Psycho1, look for Johan Gustavson's scripting manual. It's a great way to learn about scripting!

Share this post


Link to post
Share on other sites

chartier : I checked official comref manual and there are mistakes in setfog and setweather commands. I posted about this to Scripting reference topic in forum. There are possibly another mistakes in it (i read about some in other topic). Mainly I'm using Unofficial Operation Flashpoint Command Reference Manual Version 1.04 from ofpeditingcenter.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (RalphWiggum @ Mar. 08 2002,09:10)</td></tr><tr><td id="QUOTE">Psycho1, look for Johan Gustavson's scripting manual. It's a great way to learn about scripting!<span id='postcolor'>

I was thinking of looking at that before, but I forgot all about it. I'll go check it out tonight.

Share this post


Link to post
Share on other sites

Well, what you would need isn't really hard scripting

work. Just a simple script, which creates a random

value, and exits the script if it isn't executed by the

server.

You need a file called: xxx.sqs - (xxx is the name, you choose)

To execute this script from the game, just use:

this exec "xxx.sqs"

it's up to you, which way you are going to activate it, best

would be a repeating trigger (using some time-delay).

Now the script:

?!(local server): goto "end"

varx = random x

publicvariable "varx"

#end

exit

The first line decides now, wether the script should run on

this machine, or not. If it's the server, the script runs, if

it's a client, it goes to #end, where the script exits without

doing anything.

varx is only an example - use whatever non-reserved variable,

you want.

random x - x is any number you want

publicvariable "varx" - sends the changed value of varx to the

clients.

#end - is used to have a marker, where you can jump to by

using the goto "end" command.

exit - exits the script

! - means "not"

? condition: goto "xxx" - this is a classical if/then/else command - the question mark presents the "if", the : presents the "then", and if the condition isn't true then it's the server,

who runs the script, and it continues in normal way, ignoring

the goto command.

But i would also suggest, you go for a scripting tutorial, to

learn it from basics, and build your own logic's.

btw - this is a very easy script, and i'm also not a scripting

expert - so if anyone finds any mistakes i made, plz don't

blame me -

wink.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×