Gameplay::setWeatherTypeOverTime: Difference between revisions
(yay) |
|||
| (3 intermediate revisions by 2 users 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== | ||
<syntaxhighlight lang="javascript">gameplay.setWeatherTypeOverTime(weatherType, time);</syntaxhighlight> | <syntaxhighlight lang="javascript">mp.game.gameplay.setWeatherTypeOverTime(weatherType, time);</syntaxhighlight> | ||
=== Required Arguments === | === Required Arguments === | ||
*'''weatherType:''' String | *'''weatherType:''' String | ||
| Line 7: | Line 12: | ||
===Return value=== | ===Return value=== | ||
*'''Undefined''' | *'''Undefined''' | ||
==Example== | ==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, <u>not milliseconds</u>. | ||
</ | {{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_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
- mp.game.gameplay.getAllocatedStackSize
- mp.game.gameplay.getNumberOfFreeStacksOfThisSize
- mp.game.gameplay.setRandomSeed
- mp.game.gameplay.setTimeScale
- mp.game.gameplay.setMissionFlag
- mp.game.gameplay.getMissionFlag
- mp.game.gameplay.setRandomEventFlag
- mp.game.gameplay.getRandomEventFlag
- mp.game.gameplay.getGlobalCharBuffer
- mp.game.gameplay.hasResumedFromSuspend
- mp.game.gameplay.getBaseElementMetadata
- mp.game.gameplay.getPrevWeatherTypeHashName
- mp.game.gameplay.getNextWeatherTypeHashName
- mp.game.gameplay.isPrevWeatherType
- mp.game.gameplay.isNextWeatherType
- mp.game.gameplay.setWeatherTypePersist
- mp.game.gameplay.setWeatherTypeNowPersist
- mp.game.gameplay.setWeatherTypeNow
- mp.game.gameplay.setWeatherTypeOvertimePersist
- mp.game.gameplay.setRandomWeatherType
- mp.game.gameplay.clearWeatherTypePersist
- mp.game.gameplay.clearWeatherTypeOvertimePersist
- mp.game.gameplay.getWeatherTypeTransition
- mp.game.gameplay.setWeatherTypeTransition
- mp.game.gameplay.setOverrideWeather
- mp.game.gameplay.clearOverrideWeather
- mp.game.gameplay.waterOverrideSetShorewaveamplitude
- mp.game.gameplay.waterOverrideSetShorewaveminamplitude
- mp.game.gameplay.waterOverrideSetShorewavemaxamplitude
- mp.game.gameplay.waterOverrideSetOceannoiseminamplitude
- mp.game.gameplay.waterOverrideSetOceanwaveamplitude
- mp.game.gameplay.waterOverrideSetOceanwaveminamplitude
- mp.game.gameplay.waterOverrideSetOceanwavemaxamplitude
- mp.game.gameplay.waterOverrideSetRipplebumpiness
- mp.game.gameplay.waterOverrideSetRippleminbumpiness
- mp.game.gameplay.waterOverrideSetRipplemaxbumpiness
- mp.game.gameplay.waterOverrideSetRippledisturb
- mp.game.gameplay.waterOverrideSetStrength
- mp.game.gameplay.waterOverrideFadeIn
- mp.game.gameplay.waterOverrideFadeOut
- mp.game.gameplay.setWind
- mp.game.gameplay.setWindSpeed
- mp.game.gameplay.getWindSpeed
- mp.game.gameplay.setWindDirection
- mp.game.gameplay.getWindDirection
- mp.game.gameplay.setRainLevel
- mp.game.gameplay.getRainLevel
- mp.game.gameplay.setSnowLevel
- mp.game.gameplay.getSnowLevel
- mp.game.gameplay.forceLightningFlash
- mp.game.gameplay.preloadCloudHat
- mp.game.gameplay.loadCloudHat
- mp.game.gameplay.unloadCloudHat
- mp.game.gameplay.clearCloudHat
- mp.game.gameplay.setCloudHatOpacity
- mp.game.gameplay.getCloudHatOpacity
- mp.game.gameplay.getGameTimer
- mp.game.gameplay.getFrameTime
- mp.game.gameplay.getBenchmarkTime
- mp.game.gameplay.getFrameCount
- mp.game.gameplay.getRandomFloatInRange
- mp.game.gameplay.getRandomIntInRange
- mp.game.gameplay.getRandomIntInRange2
- mp.game.gameplay.getGroundZFor3dCoord
- mp.game.gameplay.getGroundZAndNormalFor3DCoord
- mp.game.gameplay.getGroundZFor3DCoord2
- mp.game.gameplay.asin
- mp.game.gameplay.acos
- mp.game.gameplay.tan
- mp.game.gameplay.atan
- mp.game.gameplay.atan2
- mp.game.gameplay.getDistanceBetweenCoords
- mp.game.gameplay.getAngleBetween2dVectors
- mp.game.gameplay.getAngleBetween2DVectors
- mp.game.gameplay.getHeadingFromVector2d
- mp.game.gameplay.getHeadingFromVector2D
- mp.game.gameplay.setBit
- mp.game.gameplay.clearBit
- mp.game.gameplay.getHashKey
- mp.game.gameplay.slerpNearQuaternion
- mp.game.gameplay.isAreaOccupied
- mp.game.gameplay.isPositionOccupied
- mp.game.gameplay.isPointObscuredByAMissionEntity
- mp.game.gameplay.clearArea
- mp.game.gameplay.clearAreaLeaveVehicleHealth
- mp.game.gameplay.clearAreaOfVehicles
- mp.game.gameplay.clearAngledAreaOfVehicles
- mp.game.gameplay.clearAreaOfObjects
- mp.game.gameplay.clearAreaOfPeds
- mp.game.gameplay.clearAreaOfCops
- mp.game.gameplay.clearAreaOfProjectiles
- mp.game.gameplay.setSaveMenuActive
- mp.game.gameplay.setCreditsActive
- mp.game.gameplay.haveCreditsReachedEnd
- mp.game.gameplay.terminateAllScriptsWithThisName
- mp.game.gameplay.networkSetScriptIsSafeForNetworkGame
- mp.game.gameplay.addHospitalRestart
- mp.game.gameplay.disableHospitalRestart
- mp.game.gameplay.addPoliceRestart
- mp.game.gameplay.disablePoliceRestart
- mp.game.gameplay.setRestartCustomPosition
- mp.game.gameplay.clearRestartCustomPosition
- mp.game.gameplay.pauseDeathArrestRestart
- mp.game.gameplay.ignoreNextRestart
- mp.game.gameplay.setFadeOutAfterDeath
- mp.game.gameplay.setFadeOutAfterArrest
- mp.game.gameplay.setFadeInAfterDeathArrest
- mp.game.gameplay.setFadeInAfterLoad
- mp.game.gameplay.registerSaveHouse
- mp.game.gameplay.setSaveHouse
- mp.game.gameplay.overrideSaveHouse
- mp.game.gameplay.doAutoSave
- mp.game.gameplay.getIsAutoSaveOff
- mp.game.gameplay.isAutoSaveInProgress
- mp.game.gameplay.beginReplayStats
- mp.game.gameplay.addReplayStatValue
- mp.game.gameplay.endReplayStats
- mp.game.gameplay.getReplayStatMissionType
- mp.game.gameplay.getReplayStatCount
- mp.game.gameplay.getReplayStatAtIndex
- mp.game.gameplay.clearReplayStats
- mp.game.gameplay.isMemoryCardInUse
- mp.game.gameplay.shootSingleBulletBetweenCoords
- mp.game.gameplay.shootSingleBulletBetweenCoordsIgnoreEntity
- mp.game.gameplay.shootSingleBulletBetweenCoordsIgnoreEntityNew
- mp.game.gameplay.getModelDimensions
- mp.game.gameplay.setFakeWantedLevel
- mp.game.gameplay.getFakeWantedLevel
- mp.game.gameplay.isBitSet
- mp.game.gameplay.usingMissionCreator
- mp.game.gameplay.allowMissionCreatorWarp
- mp.game.gameplay.setMinigameInProgress
- mp.game.gameplay.isMinigameInProgress
- mp.game.gameplay.isThisAMinigameScript
- mp.game.gameplay.isSniperInverted
- mp.game.gameplay.shouldUseMetricMeasurements
- mp.game.gameplay.getProfileSetting
- mp.game.gameplay.areStringsEqual
- mp.game.gameplay.compareStrings
- mp.game.gameplay.absi
- mp.game.gameplay.absf
- mp.game.gameplay.isSniperBulletInArea
- mp.game.gameplay.isProjectileInArea
- mp.game.gameplay.isProjectileTypeInArea
- mp.game.gameplay.isProjectileTypeInAngledArea
- mp.game.gameplay.isProjectileTypeWithinDistance
- mp.game.gameplay.getCoordsOfProjectileTypeInArea
- mp.game.gameplay.getCoordsOfProjectileTypeWithinDistance
- mp.game.gameplay.getProjectileNearPed
- mp.game.gameplay.isBulletInAngledArea
- mp.game.gameplay.isBulletInArea
- mp.game.gameplay.isBulletInBox
- mp.game.gameplay.hasBulletImpactedInArea
- mp.game.gameplay.hasBulletImpactedInBox
- mp.game.gameplay.isOrbisVersion
- mp.game.gameplay.isDurangoVersion
- mp.game.gameplay.isPcVersion
- mp.game.gameplay.isAussieVersion
- mp.game.gameplay.isStringNull
- mp.game.gameplay.isStringNullOrEmpty
- mp.game.gameplay.stringToInt
- mp.game.gameplay.setBitsInRange
- mp.game.gameplay.getBitsInRange
- mp.game.gameplay.addStuntJump
- mp.game.gameplay.addStuntJumpAngled
- mp.game.gameplay.deleteStuntJump
- mp.game.gameplay.enableStuntJumpSet
- mp.game.gameplay.disableStuntJumpSet
- mp.game.gameplay.setStuntJumpsCanTrigger
- mp.game.gameplay.isStuntJumpInProgress
- mp.game.gameplay.isStuntJumpMessageShowing
- mp.game.gameplay.getNumSuccessfulStuntJumps
- mp.game.gameplay.getTotalSuccessfulStuntJumps
- mp.game.gameplay.cancelStuntJump
- mp.game.gameplay.setGamePaused
- mp.game.gameplay.setThisScriptCanBePaused
- mp.game.gameplay.setThisScriptCanRemoveBlipsCreatedByAnyScript
- mp.game.gameplay.hasButtonCombinationJustBeenEntered
- mp.game.gameplay.hasCheatStringJustBeenEntered
- mp.game.gameplay.setInstancePriorityMode
- mp.game.gameplay.setInstancePriorityHint
- mp.game.gameplay.isFrontendFading
- mp.game.gameplay.populateNow
- mp.game.gameplay.getIndexOfCurrentLevel
- mp.game.gameplay.setGravityLevel
- mp.game.gameplay.getGravityLevel
- mp.game.gameplay.startSaveData
- mp.game.gameplay.stopSaveData
- mp.game.gameplay.getSizeOfSaveData
- mp.game.gameplay.registerIntToSave
- mp.game.gameplay.registerInt64ToSave
- mp.game.gameplay.registerEnumToSave
- mp.game.gameplay.registerFloatToSave
- mp.game.gameplay.registerBoolToSave
- mp.game.gameplay.registerTextLabelToSave
- mp.game.gameplay.registerTextLabelToSave2
- mp.game.gameplay.startSaveStructWithSize
- mp.game.gameplay.stopSaveStruct
- mp.game.gameplay.startSaveArrayWithSize
- mp.game.gameplay.stopSaveArray
- mp.game.gameplay.copyMemory
- mp.game.gameplay.enableDispatchService
- mp.game.gameplay.blockDispatchServiceResourceCreation
- mp.game.gameplay.getNumDispatchedUnitsForPlayer
- mp.game.gameplay.createIncident
- mp.game.gameplay.createIncidentWithEntity
- mp.game.gameplay.deleteIncident
- mp.game.gameplay.isIncidentValid
- mp.game.gameplay.setIncidentRequestedUnits
- mp.game.gameplay.setIncidentUnk
- mp.game.gameplay.findSpawnPointInDirection
- mp.game.gameplay.addPopMultiplierArea
- mp.game.gameplay.doesPopMultiplierAreaExist
- mp.game.gameplay.removePopMultiplierArea
- mp.game.gameplay.isPopMultiplierAreaUnk
- mp.game.gameplay.addPopMultiplierSphere
- mp.game.gameplay.doesPopMultiplierSphereExist
- mp.game.gameplay.removePopMultiplierSphere
- mp.game.gameplay.enableTennisMode
- mp.game.gameplay.isTennisMode
- mp.game.gameplay.playTennisSwingAnim
- mp.game.gameplay.getTennisSwingAnimComplete
- mp.game.gameplay.playTennisDiveAnim
- mp.game.gameplay.resetDispatchSpawnLocation
- mp.game.gameplay.setDispatchSpawnLocation
- mp.game.gameplay.resetDispatchIdealSpawnDistance
- mp.game.gameplay.setDispatchIdealSpawnDistance
- mp.game.gameplay.resetDispatchTimeBetweenSpawnAttempts
- mp.game.gameplay.setDispatchTimeBetweenSpawnAttempts
- mp.game.gameplay.setDispatchTimeBetweenSpawnAttemptsMultiplier
- mp.game.gameplay.addDispatchSpawnBlockingAngledArea
- mp.game.gameplay.addDispatchSpawnBlockingArea
- mp.game.gameplay.removeDispatchSpawnBlockingArea
- mp.game.gameplay.resetDispatchSpawnBlockingAreas
- mp.game.gameplay.addTacticalAnalysisPoint
- mp.game.gameplay.clearTacticalAnalysisPoints
- mp.game.gameplay.setRiotModeEnabled
- mp.game.gameplay.displayOnscreenKeyboardWithLongerInitialString
- mp.game.gameplay.displayOnscreenKeyboard
- mp.game.gameplay.updateOnscreenKeyboard
- mp.game.gameplay.getOnscreenKeyboardResult
- mp.game.gameplay.cancelOnscreenKeyboard
- mp.game.gameplay.nextOnscreenKeyboardResultWillDisplayUsingTheseFonts
- mp.game.gameplay.removeStealthKill
- mp.game.gameplay.setExplosiveAmmoThisFrame
- mp.game.gameplay.setFireAmmoThisFrame
- mp.game.gameplay.setExplosiveMeleeThisFrame
- mp.game.gameplay.setSuperJumpThisFrame
- mp.game.gameplay.setBeastModeActive
- mp.game.gameplay.setForcePlayerToJump
- mp.game.gameplay.areProfileSettingsValid
- mp.game.gameplay.forceGameStatePlaying
- mp.game.gameplay.scriptRaceInit
- mp.game.gameplay.scriptRaceShutdown
- mp.game.gameplay.scriptRaceGetPlayerSplitTime
- mp.game.gameplay.startBenchmarkRecording
- mp.game.gameplay.stopBenchmarkRecording
- mp.game.gameplay.resetBenchmarkRecording
- mp.game.gameplay.saveBenchmarkRecording
- mp.game.gameplay.uiIsSingleplayerPauseMenuActive
- mp.game.gameplay.landingMenuIsActive
- mp.game.gameplay.isCommandLineBenchmarkValueSet
- mp.game.gameplay.getBenchmarkIterationsFromCommandLine
- mp.game.gameplay.getBenchmarkPassFromCommandLine
- mp.game.gameplay.restartGame
- mp.game.gameplay.forceSocialClubUpdate
- mp.game.gameplay.hasAsyncInstallFinished
- mp.game.gameplay.cleanupAsyncInstall
- mp.game.gameplay.isInPowerSavingMode
- mp.game.gameplay.getPowerSavingModeDuration
- mp.game.gameplay.setPlayerIsInAnimalForm
- mp.game.gameplay.getIsPlayerInAnimalForm
- mp.game.gameplay.setPlayerRockstarEditorDisabled
- mp.game.gameplay.enableSnow
- mp.game.gameplay.getFreeStackSlotsCount
- mp.game.gameplay.setWeatherTypeOverTime
- mp.game.gameplay.setRainFxIntensity
- mp.game.gameplay.setCloudHatTransition
- mp.game.gameplay.clearAreaOfEverything
- mp.game.gameplay.disableAutomaticRespawn
- mp.game.gameplay.enableMpDlcMaps
- mp.game.gameplay.setUnkMapFlag
- mp.game.gameplay.startSaveStruct
- mp.game.gameplay.startSaveArray
- mp.game.gameplay.startPerformanceTimer