Gameplay::setWeatherTypeOverTime: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
This function transitions the weather from one weather type to another over the specified amount of time <u>in seconds</u>.
For example, it is now EXTRASUNNY. The weather is now transitioning to THUNDER over 60 minutes. Rain will slowly start and clouds will slowly form over the time of 1 hour, rather than it being instant like [[World::weather]]
You only have to specify the <i>new</i> weather.


==Syntax==
==Syntax==
Line 7: Line 12:
===Return value===
===Return value===
*'''Undefined'''
*'''Undefined'''
==Example==
==Example==  
<syntaxhighlight lang="javascript">
This example will call the client-side event 'transitionWeather' for the every player, to synchronise the weather. This gradually transitions the weather over x seconds, <u>not milliseconds</u>.
// todo
 
</syntaxhighlight>
{{ClientsideCode|
<pre>
//newWeather - string, any of weather  /  timeTaken - time taken to transition from old weather to new weather in seconds
 
mp.events.add('transitionWeather', (newWeather, timeTaken) => {
    mp.game.gameplay.setWeatherTypeOverTime(newWeather, timeTaken);
});
</pre>
}}
 
 
{{ServersideCode|
<pre>
//In a setweather command for example with params 'params.weather' and 'params.time'
 
mp.players.forEach((player) => {
    player.call('transitionWeather', [params.weather, params.time])
});
</pre>
}}
 
==See also==
==See also==
{{Gameplay_s_function_c}}
{{Gameplay_functions_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 09:59, 22 July 2024

This function transitions the weather from one weather type to another over the specified amount of time in seconds.

For example, it is now EXTRASUNNY. The weather is now transitioning to THUNDER over 60 minutes. Rain will slowly start and clouds will slowly form over the time of 1 hour, rather than it being instant like World::weather

You only have to specify the new weather.

Syntax

mp.game.gameplay.setWeatherTypeOverTime(weatherType, time);

Required Arguments

  • weatherType: String
  • time: float

Return value

  • Undefined

Example

This example will call the client-side event 'transitionWeather' for the every player, to synchronise the weather. This gradually transitions the weather over x seconds, not milliseconds.

Client-Side
//newWeather - string, any of weather  /  timeTaken - time taken to transition from old weather to new weather in seconds

mp.events.add('transitionWeather', (newWeather, timeTaken) => {
    mp.game.gameplay.setWeatherTypeOverTime(newWeather, timeTaken);
});


Server-Side
//In a setweather command for example with params 'params.weather' and 'params.time'

mp.players.forEach((player) => {
    player.call('transitionWeather', [params.weather, params.time])
});

See also