OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: IGWedge on 05 Oct 2006, 17:46:07

Title: Night Or Day Selector
Post by: IGWedge on 05 Oct 2006, 17:46:07
I am currently making a mission. I would like to be able for the player to have the choice of wether to play
at night, day, dawn or dusk. I am sure i have seen this in a mission before.

Any ideas. (Also would this work in MP?)

Many thanks

Wedge
Title: Re: Night Or Day Selector
Post by: JasonO on 05 Oct 2006, 18:23:27
Hi
Depending on the time you have already set at start of mission you can use the SkipTime (http://www.ofpec.com/COMREF/index.php?action=list&letter=s#skipTime) command.

Play around with the last number until you get what you want.

Once you have that in a script you could use Parameters (defined at the start of a mission in MP at the player team selection screen by the admin).
Title: Re: Night Or Day Selector
Post by: Warhawk67 on 05 Oct 2006, 18:55:15
You can try this:

Put this in your init file:
Quote
; SET SCENARIO CONDITIONS
; Using the value of "Param1", set by the admin using a slider in the scenario set-up screen),
; the following code sets the time and weather conditions for the scenario.

?(Param1 == 1) : goto "DuskClear"
?(Param1 == 2) : goto "NightClear"
?(Param1 == 3) : goto "DawnClear"
?(Param1 == 4) : goto "NoonClear"
?(Param1 == 5) : goto "DuskOvercast"
?(Param1 == 6) : goto "NightOvercast"
?(Param1 == 7) : goto "DawnOvercast"
?(Param1 == 8) : goto "NoonOvercast"
?(Param1 == 9) : goto "DuskStorm"
?(Param1 == 10) : goto "NightStorm"
?(Param1 == 11) : goto "DawnStorm"
?(Param1 == 12) : goto "NoonStorm"
?(Param1 == 13) : goto "DuskMist"
?(Param1 == 14) : goto "NightMist"
?(Param1 == 15) : goto "DawnMist"
?(Param1 == 16) : goto "NoonMist"
?(Param1 == 17) : goto "DuskFog"
?(Param1 == 18) : goto "NightFog"
?(Param1 == 19) : goto "DawnFog"
?(Param1 == 20) : goto "NoonFog"

#DuskClear
skiptime 17.5
0 setFog 0
0 setOvercast 0
goto "ConditionsSet"

#NightClear
skiptime 0
0 setFog 0
0 setOvercast 0
goto "ConditionsSet"

#DawnClear
skiptime 6.25
0 setFog 0
0 setOvercast 0
goto "ConditionsSet"

#NoonClear
skiptime 12
0 setFog 0
0 setOvercast 0
goto "ConditionsSet"

#DuskOvercast
skiptime 17.5
0 setFog 0.0
0 setOvercast 0.7
goto "ConditionsSet"

#NightOvercast
skiptime 0
0 setFog 0.0
0 setOvercast 0.7
goto "ConditionsSet"

#DawnOvercast
skiptime 6.25
0 setFog 0.0
0 setOvercast 0.7
goto "ConditionsSet"

#NoonOvercast
skiptime 12
0 setFog 0.0
0 setOvercast 0.7
goto "ConditionsSet"

#DuskStorm
skiptime 17.5
0 setFog 0.4
0 setOvercast 1.0
goto "ConditionsSet"

#NightStorm
skiptime 0
0 setFog 0.4
0 setOvercast 1.0
goto "ConditionsSet"

#DawnStorm
skiptime 6.25
0 setFog 0.4
0 setOvercast 1.0
goto "ConditionsSet"

#NoonStorm
skiptime 12
0 setFog 0.4
0 setOvercast 1.0
goto "ConditionsSet"

#DuskMist
skiptime 17.5
0 setFog 0.70
0 setOvercast 0.7
goto "ConditionsSet"

#NightMist
skiptime 0
0 setFog 0.70
0 setOvercast 0.7
goto "ConditionsSet"

#DawnMist
skiptime 6.25
0 setFog 0.70
0 setOvercast 0.7
goto "ConditionsSet"

#NoonMist
skiptime 12
0 setFog 0.70
0 setOvercast 0.7
goto "ConditionsSet"

#DuskFog
skiptime 17.5
0 setFog 0.97
0 setOvercast 0.7
goto "ConditionsSet"

#NightFog
skiptime 0
0 setFog 0.97
0 setOvercast 0.7
goto "ConditionsSet"

#DawnFog
skiptime 6.25
0 setFog 0.97
0 setOvercast 0.7
goto "ConditionsSet"

#NoonFog
skiptime 12
0 setFog 0.97
0 setOvercast 0.7
goto "ConditionsSet"

#ConditionsSet
;==============================================================================================
Then put this in your description.ext file:
Quote

// CONDITIONS SELECTOR
// The following code creates a slider in the scenario set-up screen that allows the admin to
// determine the time and weather conditions for the scenario. The selector sets the value of
// "Param1", which is used by a corresponding segment of code in the "init.sqs" file.

titleParam1 = "Conditions:";
valuesParam1[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
defValueParam1 = 3;
textsParam1[] = {"Dusk - Clear","Night - Clear","Dawn - Clear","Noon - Clear","Dusk - Overcast","Night - Overcast","Dawn - Overcast","Noon - Overcast","Dusk - Storm","Night - Storm","Dawn - Storm","Noon - Storm","Dusk - Mist","Night - Mist","Dawn - Mist","Noon - Mist","Dusk - Fog","Night - Fog","Dawn - Fog","Noon - Fog"};
//

Hope that helps.

Stout Hearts
|RE|Warhawk
Title: Re: Night Or Day Selector
Post by: IGWedge on 05 Oct 2006, 20:32:07
rgr

will try it out after footie practice :)

Thanks guys