ParticleFxPlayer
Important: Synced particle fx are restricted by missing methods. For example it is not possible to set the color or alpha of a synced particle fx. If you want that you have to create the particle on each client individually.
Examples
Play particle fx on position for one second looped over network
---@type NssLibsParticleFxPlayerControllerApi
local pfx_api = exports.nss_libs:getParticleFxPlayerApi(GetCurrentResourceName())
---@type NssLibsParticleFxPlayerApi
local pfx_player = pfx_api.create()
local duration_in_ms = 1000 -- One second
local interval_in_ms = 100 -- 10 times per second
-- non-looped asset
local asset_dictionary = 'scr_crackpot'
local asset_name = 'scr_crackpot_tesla_fail'
-- false if non-looped asset: https://github.com/femga/rdr3_discoveries/blob/f729ba03f75a591ce5c841642dc873345242f612/graphics/ptfx/ptfx_assets_non_looped.lua
-- true looped asset: https://github.com/femga/rdr3_discoveries/blob/f729ba03f75a591ce5c841642dc873345242f612/graphics/ptfx/ptfx_assets_looped.lua
local is_looped_asset = false
-- Static interval
pfx_player
.setAsset(asset_dictionary, asset_name, is_looped_asset)
.setPosition(0.0, 0.0, 0.0)
.useNetwork()
.play(duration_in_ms, interval_in_ms)
-- Random interval
local random_interval = { 100, 500 } -- Random value between 100 and 500 ms each wait loop
pfx_player
.setAsset(asset_dictionary, asset_name, is_looped_asset)
.setPosition(0.0, 0.0, 0.0)
.useNetwork()
.play(duration_in_ms, random_interval)TODOs
Last updated
Was this helpful?