Skip to content

Effect Component (Effects)

Eric Mor edited this page Jun 15, 2023 · 2 revisions

The effect component is the most important one: it is used to access and play other components. It is possible to use the export command to make the effect available in the game; if an effect is not exported, it can only be used within the .pfx file.

effect is a block, meaning that it can have attributes inside and it's finished with the end keyword. Inside the effect you call components that have been previously defined in the .pfx file, using <component_type> <component_name>. Additionally, you can also use the options and attributes that are listed in this page.

For example, if you want to create a particles effect and use it in a creature part:

particles test_particles
	texture effect-star
	color (1, 0, 0) (0, 0, 1)
	alpha 0 1 1 1 0
	life 4
	rate 800 200 500 0 -loop 8.5
end

effect MyCustomEffect
	# Use the particles component we created; we can use transformations
	particles test_particles -scale 2.5
end

# Export it so it can be used outside the .pfx
export MyCustomEffect

Then in the .prop file you can invoke the exported effect:

keys modelEffects
	MyCustomEffect
end

Additionally, you can also import in the .pfx file an exported effect from other effect directories, using the import command:

import sfx
# Now you can use sfx_Asdasd like an 'effect'

It is also possible to export an effect with a different name; this can be useful if you want to give an effect multiple names:

export test_effect MyCustomEffect1
export test_effect MyCustomEffect2
export test_effect MyCustomEffect3

Available options

-flags <bitfield>


notifyMessageID <id>


screenSizeRange <float> <float>


-toggleButtonActivate <float>


-toggleButton <int>


-extendedLodWeights <float> <float> <float>


Attributes

lodDistances <float...> -focus <float> -facing <float> -distance <float>

Sets a range of distances for LODs. The arguments are the distances. It allows three extra options:

  • -focus <float>: Add in a term for how far off straight ahead of the camera the effect is
  • -facing <float>: Add in a term for how close to the centre the object is
  • -distance <float>: Add in a term for how far from the camera the effect is

seed <int>

Sets the random seed that is used for this effect. Fixing the random seed (theoretically) ensures the effect always looks the same every time is used, regardless of any random components.


Components

Random selection

It is possible to pick one component randomly from a list. This is done with the select block. By default, all components listed in the select block will have the same probabilty of being chosen; you can change that by specifiying a probabilty (between 0.0 and 1.0) to each individual component using the -prob <float> option.

effect MyEffect
	model screen_model  # This component is always in the effect
	# Only one of these will be selected
	select
		particles part1
		particles part2 -prob 0.5  # this will be selected more times
		particles part3
		particles part4
	end
end

Available options

Any of the options used in ArgScript Transforms.


-lodRange <int: begin> <int: end>

The values are in the [0, 255] range. It's also possible to use -lod <int: range>; this is equivalent to -lodRange 1 1+range

If this option is not specified, the default value is 1, 255.


-emitScaleBegin <float> -emitScaleEnd <float> -alphaScaleBegin <float> -alphaScaleEnd <float> -sizeScaleBegin <float> -sizeScaleEnd <float> -timeScale <float>


-emitScale <float...> -alphaScale <float...> -sizeScale <float...>


-ignoreLength -respectLength -ignoreParams -rigid


-flags <bitfield>


-flag <enum> <bool>

Sets an application flag, which are used to control when the effect component is displayed; this is not related to the flags option. For example, you can use this to ensure that a certain component is only displayed in the editor, or to create alternative effects depending on the game mode, etc

This option can be used more than once, to set more than one app flag. The possible values are:

  • kAppFlagDeepWater
  • kAppFlagShallowWater
  • kAppFlagLowerAtmosphere
  • kAppFlagUpperAtmosphere
  • kAppFlagEnglish
  • kAppFlagPlanetHasWater
  • kAppFlagFlagCinematics
  • kAppFlagCellGameMode
  • kAppFlagCreatureGameMode
  • kAppFlagTribeGameMode
  • kAppFlagGGEMode
  • kAppFlagCivGameMode
  • kAppFlagSpaceGameMode
  • kAppFlagAtmoLow
  • kAppFlagAtmoMed
  • kAppFlagAtmoHigh
  • kAppFlagEditorMode
  • kAppFlagSpaceGameOutOfUFO
  • kAppFlagSpaceGameGalaxyMode
  • kAppFlagSpaceGameSolarMode
  • kAppFlagSpaceGamePlanetMode
  • kAppFlagIsNight
  • kAppFlagIsRaining
  • kAppFlagWeatherIce
  • kAppFlagWeatherCold
  • kAppFlagWeatherWarm
  • kAppFlagWeatherHot
  • kAppFlagWeatherLava
Clone this wiki locally