Home   Help Search Login Register  

Author Topic: random time and weather script  (Read 1072 times)

0 Members and 1 Guest are viewing this topic.

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
random time and weather script
« on: 14 Jan 2006, 01:34:01 »
Hello,
I would like the time (0-24) to be different each time I press prieview. and also the weather, Could sombody make a script that does this or tell me how to start,

thanks

Durbs

  • Guest
Re:random time and weather script
« Reply #1 on: 14 Jan 2006, 04:42:30 »
i'm pretty sure there's random weather script in ed depot. As for random time.... ???

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:random time and weather script
« Reply #2 on: 14 Jan 2006, 08:48:06 »
No script is necessary. Just put somewhere in the game

0 setovercast (random 1);skiptime (random 24)

And that will make random weather and time. However if you want a more advanced script it will take a little more than that.
I like your approach, lets see your departure.
Download the New Flashlight Script!

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:random time and weather script
« Reply #3 on: 14 Jan 2006, 19:23:15 »
no, theres nothing in the ed depot for this.

but il try your method rujik

thanks

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:random time and weather script
« Reply #4 on: 15 Jan 2006, 14:08:55 »
Ref Rujiks post

this will only work in SP, and it will only set a starting weather


if you want an mp compatible system, the following is a basic system that will do the job
(I havent tested it, wrote it on the fly,  but it should work)


___EXPLANATION___
each weather setting is made up of 2 elements
( transformation time) - weathertype  (weather setting)
eg
0 setrain 1
will set the rain setting to maximum (range between 0 and 1) in 0 seconds
you then need to state what it will change too
eg
1800 setrain 0.5
(over a 30 minute period i want the rain to transform to half the maximum setting)
NB>> Rain is dependant on the amount of overcast, if there is insufficient, even though the rain is set to maximum, it wont rain)


In the system below, (The init.sqs is run on every machine)
Every machine (client and server) will have different values for the weather settings, however, the Server will transmit its settings, which will overwrite the value that the clients have, (thats what a public variable does)

When the server transmits the boolean tx_server, all the clients (and the server) will run the set weather settings using the server's values

Somethings to note
If you dont want maximum fog, or rain or overcast, reduce the
tx_Rn, tx_Re, tx_Cn, tx_Ce, txFn, tx_Fe to values less than 1. eg 0.5)

The system

MISSION EDITOR
Nothing, you dont even need to set the mission start time to midnightor  midday etc

Init.SQS
Quote
;; tx_Wtime needs to be set to the mission time limit, or the random time the weather has to change)
;; In this example i set it for 1 hour
   tx_Wtime = 3600

   tx_server = false
;; following is the skitime value that will give you a random start time over a 24 hour period)
   tx_skip = random 24

;;____________________________
;; rain setting at start (tx_Rn abbreviation for tx_RainNow)
   tx_Rn = random 1
;; rain setting at end of transformation time (tx_Re abbreviation for tx_RainEnd)
   tx_Re = random1
;; transformation time for Rain setting to change from tx_Rn to tx_Re (tx_Rt abbreviation for tx_Rain_transformation_time)
   tx_Rt = random tx_Wtime

;;____________________________
;; Cloud settings (Overcast)
   tx_Cn = random 1
   tx_Ce = random1
   tx_Ct = random tx_Wtime

;;____________________________
;; Fog settings
   tx_Fn = random 1
   tx_Fe = random1
   tx_Ft = random tx_Wtime

?(local server):{Publicvariable _x} foreach [tx_Skip, "tx_Rn", "tx_Re", "tx_Rt" ,tx_Cn", "tx_Ce", "tx_Ct" ,tx_Fn", "tx_Fe", "tx_Ft"]
~0.1
?(local server): tx_server = true; Publicvariable "tx_server"

;; the following @ statements, make sure that neither the server or the clients try to skiptime or setweather until exactly the same time
@ tx_server
;; make sure that the time elapsed from mission start (eg any ~ delays in the init.sqs previous to this are taken into account, eg if time delays add up to 1 second, then make the @time > 1.5 to give enough tiome for all clients to recieve the pv's
@time > 0.5

skiptime tx_Skip
0 setrain tx_Rn
tx_Rt setrain tx_Re

0 setOvercast tx_Cn
tx_Ct setrain tx_Ce

0 setFog tx_Fn
tx_Ft setrain tx_Fe


nb>>>
Follwing is just an idea, there are probably syntax errors all over it
you can then add a hint format statement to print on screen a weather forecast
using the values tx_Rn etc, and "if then" statements you can print out a nice hint message that would dynamically show the above weather variables something in the following way

Quote
_Metmessage = format ["___ MET FORECAST___"]

_FNmessage = " Nil"
If(tx_Fn > 0.2) then {_Fnmessage = "Now: Light"}
If(tx_Fn > 0.4) then {_Fnmessage = "Now: Moderate"}
If(tx_Fn > 0.7) then {_Fnmessage = "Now: Heavy"}

_FEmessage = "Nil"
If(tx_Fe > 0.2) then {_Femessage = "Later: Light"}
If(tx_Fe > 0.4) then {_Femessage = "Later: Moderate"}
If(tx_Fe > 0.7) then {_Femessage = "Later: Heavy"}

_Rnmessage = "Nil"
If(tx_Rn > 0.2) then {_Rnmessage = "Now: Light"}
If(tx_Rn > 0.4) then {_Fnmessage =  "Now: Moderate"}
If(tx_Rn > 0.7) then {_Rnmessage = "Now: Heavy"}

_Remessage = "Nil"
If(tx_Re > 0.2) then {_Remessage = "Later: Light"}
If(tx_Re > 0.4) then {_Remessage = "Later: Moderate"}
If(tx_Re > 0.7) then {_Remessage = "Later: Heavy"}


_Cnmessage = "Nil"
If(tx_Cn > 0.2) then {_Cnmessage = "Now: Light";  _Rnmessage = "Nil"}
If(tx_Cn > 0.4) then {_Cnmessage =  "Now: Moderate";   _Rnmessage = "Minimal"}
If(tx_Cn > 0.7) then {_Cnmessage = "Now: Heavy"}

_Cemessage = "Nil"
If(tx_Re > 0.2) then {_Cemessage = "Later: Light";   _Remessage = "Nil"}
If(tx_Re > 0.4) then {_Cemessage = "Later: Moderate";  _Remessage = "Minimal"}
If(tx_Re > 0.7) then {_Cemessage = "Later: Heavy"}

_FMessage = format ["\n\n     FOG    \n %1\n %2", _Fnmessage,_Femessage]
_RMessage = format ["\n\n     RAIN    \n %1\n %2", _Rnmessage,_Remessage]
_CMessage = format ["\n\n     CLOUD COVER    \n %1\n %2", _Cnmessage,_Cemessage]

_Metforecast = format ["%1 %2 %3 %4 %5", _Metmessage, _Fmessage,_Cmessage,_Rmessage]

hint _Metforecast


it will display something like


___ MET FORECAST___

           Fog:
Now    :Heavy
LATER : Nil

           Cloud Cover:
Now   : Minimal
LATER: Minimal

           RAIN:
Now    :Nil
LATER : Nil






Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:random time and weather script
« Reply #5 on: 16 Jan 2006, 05:06:50 »
wow terox! :o

I wish Dell customer support people were more like you.

thank you very much, i will try to implement that.