class VisualFX extends Vob (client-side)
Available since version: 0.3.2
This class represents visual effects such as spells, item decorators, and other that are defined in daedalus scripts.
Properties
string visName (read-only)
Represents the name of the visual effect that can be: pfx name, .tga, .3ds, .mds, .mms, .trl (polyStripe trails), ltn (polyStripe trails), .eqk (earthquake), .fov (screen blends or fov morphs), .scx (screen blends / fov morphs), .slw (slow motion).
string visSize_S (read-only)
Represents the the visual effect dimensions (Vec3) in string form.
float visAlpha (read-only)
Represents the the visual effect alpha.
string visAlphaBlendFunc (read-only)
Represents the the visual effect alpha blend func name, can be one of the following: "MAT_DEFAULT", "NONE", "BLEND", "ADD", "SUB", "MUL", "MUL2".
float visTexAniFPS (read-only)
Represents the the visual effect texture ani framerate per second (how fast animated textures are updated).
bool visTexAniIsLooping (read-only)
Represents the the visual effect texture ani framerate per second (how fast animated textures are updated).
string emTrjMode_S (read-only)
Note
Multiple trajectories can be saved in one string by saving splitted words between spaces, e.g: "TARGET SPLINE RANDOM".
Represents the the visual effect trajectory mode string, can be one of the following: "FIXED", "TARGET", "SPLINE", "LINE", "RANDOM", "FOLLOW", "MISSLE".
string emTrjOriginNode (read-only)
Represents the visual effect origin node name (from which model node the effect will start).
string emTrjTargetNode (read-only)
Represents the visual effect target node name (to which model node the effect will move).
float emTrjTargetRange (read-only)
Represents the visual effect target range in meters (how far the projectile spell can fly before disappearing).
float emTrjTargetAzi (read-only)
Represents the visual effect target azimuth rotation (visual effect rotation in degrees on X axis).
float emTrjTargetElev (read-only)
Represents the visual effect target elevation rotation (visual effect rotation in degrees on Y axis).
int emTrjNumKeys (read-only)
Note
This property only works for effects that have "TARGET RANDOM" set in emTrjMode_S.
Represents the visual effect minimum number of key positions that are generated randomly while initializing the effect.
int emTrjNumKeysVar (read-only)
Note
This property only works for effects that have "TARGET RANDOM" set in emTrjMode_S.
Note
Additional key positions won't be generated almost always, they have a very low chance of being generated, the game random function must return 1.0 to generate them.
Represents the visual effect additional random number of key positions that are generated randomly while initializing the effect.
float emTrjAngleElevVar (read-only)
Note
This property only works for effects that have "TARGET RANDOM" set in emTrjMode_S.
Represents the elevation rotation that will be used to generate key positions on random path (rotation in degrees on Y axis).
float emTrjAngleHeadVar (read-only)
Note
This property only works for effects that have "TARGET RANDOM" set in emTrjMode_S.
Represents the azimuth rotation that will be used to generate key positions on random path (rotation in degrees on X axis).
float emTrjKeyDistVar (read-only)
Note
This property only works for effects that have "TARGET RANDOM" set in emTrjMode_S.
Represents the distance that will multiplied by uniformed random value in range [0.0, 1.0] while generating every key position.
string emTrjLoopMode_S (read-only)
Represents the visual effect loop mode string, can be one of the following: "RESTART", "PINGPONG_ONCE", "PINGPONG", "HALT".
string emTrjEaseFunc_S (read-only)
Represents the visual effect easing function string, can be one of the following: "LINEAR", "SINE".
float emTrjEaseVel
Represents the visual effect easing velocity value.
float emTrjDynUpdateDelay
Represents the visual effect trajectory update delay in seconds (timestep between updating the visual effect location).
bool emTrjDynUpdateTargetOnly
Represents whether or not visual effect should track target (false) or not (true) .
string emFXCreate (read-only)
Represents the visual effect instance bound to another visual effect, e.g: DEMENTOR_FX has FOV_MORPH1 attached to it (both effects play at the same time).
string emFXInvestOrigin (read-only)
Represents the visual effect instance that gets played when caster npc invest a spell.
string emFXInvestTarget (read-only)
Represents the visual effect instance that gets played when invested spell gets played on target npc.
float emFXTriggerDelay (read-only)
Represents the visual effect initial delay in seconds after which the effect will be played.
bool emFXCreatedOwnTrj (read-only)
Represents if the visual effect child effects have their own trajectory (they are relative to the parent object).
string emActionCollDyn_S (read-only)
Note
Setting no flags will result in a effect that doesn't have dynamic collision enabled.
Note
Multiple collision actions can be saved in one string by saving splitted words between spaces, e.g: "COLLIDE CREATEONCE", also you can only set "CREATE" or "CREATEONCE", one excludes the other.
Represents the visual effect dynamic collision action, can be one of the following: "BOUNCE", "CREATE", "CREATEONCE", "COLLIDE".
string emActionCollStat_S (read-only)
Note
Setting no flags will result in a effect that doesn't have static collision enabled.
Note
Multiple collision actions can be saved in one string by saving splitted words between spaces, e.g: "COLLIDE CREATE CREATEQUAD".
Represents the visual effect static collision action, can be one of the following: "BOUNCE", "CREATE", "COLLIDE", "CREATEQUAD".
string emFXCollStat (read-only)
Note
emActionCollStat_S must contain "CREATE" string in order to create a static collision effect.
Represents the visual effect that will be triggered when static collision occurs.
string emFXCollDyn (read-only)
Note
emActionCollDyn_S must be set properly in order to create a dynamic collision effect.
Represents the visual effect that will be triggered when dynamic collision occurs.
string emFXCollDynPerc (read-only)
Represents the visual effect that will be applied on target npc if daedalus function C_CanNPCCollideWithSpell returns different value than COLL_DONOTHING.
string emFXCollStatAlign (read-only)
Represents if the visual effect should be aligned to hitted polygon, it must set to "COLLISIONNORMAL" if you want to have alignment with hitted poly.
string emFXCollDynAlign (read-only)
Represents if the visual effect should be aligned to hitted object, it must set to "COLLISIONNORMAL" if you want to have alignment with hitted poly.
float emFXLifeSpan
Represents how long the visual effect will be alive in seconds, -1 means that the effect will be played infinitely.
int emCheckCollision
Represents the visual effect collision detection mode, 0 -> no collision, 1 -> collision + damage, 2 -> collision without damage.
bool emAdjustShpToOrigin
Represents the property that adjusts child effect(s) size to a parent one.
float emInvestNextKeyDuration
Represents the visual effect next key duration.
float emFlyGravity
Represents the visual effect fly gravity applied per each frame.
string emSelfRotVel_S (read-only)
Represents the visual effect rotation vector that will be applied per frame for particle saved as string.
string lightPresetName (read-only)
Represents the light preset used by visual effect.
string sfxID (read-only)
Represents the sfx instance from daedalus scripts used while playing the visual effect.
bool sfxIsAmbient (read-only)
Represents the if used sfx by the visual effect is ambient sound.
bool sendAssessMagic (read-only)
Represents the if the visual effect is a spell that might set ZS_ function on specific npc.
float secsPerDamage
Represents the visual effect secs per damage ration, e.g: 0.5 will cause effect to deal two hits in one second, one hit will take take -1 hitpoints.
byte dScriptEnd
Represents the daedalus script end marker, unused by the game, can be utilized for storing metadata for visual effect object.
Vec3 visSize
Represents actual visual effect dimensions after script initalization.
int emTrjMode
Represents visual effect emitter trajectory mode flags. For more information see EmitterTrajectory constants.
int emActionCollDyn
Represents the visual effect dynamic action collision flags. For more information see ActionCollision constants.
int emActionCollStat
Represents the visual effect static action collision flags. For more information see ActionCollision constants.
Vec3 emSelfRotVel
Represents the visual effect rotation vector that will be applied per frame for particle.
int trjEaseFunc
Represents the visual effect easing function type. For more information see EaseFunc constants.
int emTrjLoopMode
Represents the visual effect trajectory loop mode. For more information see TrajectoryLoopMode constants.
int fxState
Represents the visual effect state. For more information see VisualFXState constants.
VisualFX& root (read-only)
Represents the root visual effect (top most) for current visual effect.
VisualFX& parent (read-only)
Represents the parent visual effect for current visual effect.
VisualFX& fxInvestOrigin (read-only)
Represents the invest origin effect for the visual effect.
VisualFX& fxInvestTarget (read-only)
Represents the invest target effect for the visual effect.
zarray& fxList (read-only)
Represents the array containing all visual effects for visual effect.
zarray& childList (read-only)
Represents the array containing all children visual effects for visual effect.
zarray& vobList (read-only)
Represents the array containing vobs that will be affected by the visual fx (will be populated when visual fx is multi target).
zarray& ignoreVobList (read-only)
Represents the array containing vobs that won't be affected by the visual fx. Useful if you want to make visual effect that won't target specific vobs.
zarray& allowedCollisionVobList (read-only)
Represents the array containing vobs that will be affected by the visual fx. Useful if you want to make visual effect that affect specific vobs.
zarray& collidedVobs (read-only)
Represents the array containing vobs that visual effect collided with.
float screenFXTime (read-only)
Represents the current screen fx elapsed time for visual fx in miliseconds.
int screenFXDir (read-only)
Represents the current screen fx direction for visual fx.
Vob& origin
Represents the origin vob for visual fx.
Vob& inflictor (read-only)
Represents the inflictor vob (e.g: npc that casted spell) for visual fx.
Vob& target (read-only)
Represents the target vob (e.g: npc that will be hit by the effect) for visual fx.
float lightRange (read-only)
Represents the visual fx light range.
int sfxHnd (read-only)
Represents the visual fx sound effect handle (id).
string fxName (read-only)
Represents the vfx name from daealus scripts.
float frameTime
Represents the current frame time in seconds for visual fx.
float collisionTime
Represents the collision time in seconds for visual fx (unused by the game, only resetted to 0 in some scenarios).
float deleteTime (read-only)
Represents the frame delete time in seconds for visual fx, after which visual effect will be disposed.
float damageTime (read-only)
Represents the frame damage time in seconds for visual fx (game uses it to compare with secsPerDamage field, if time is greater than this value, this field will be set to 0 and damage will be dealt).
int spellId (read-only)
Represents the daedalus symbol index of the spell casted by the item (applicable to runes & scrolls).
Vec3 targetPos (read-only)
Represents current position of the effect target in the world.
Vec3 lastTrjDir (read-only)
Represents the last known direction of visual effect trajectory.
Vec3 keySize (read-only)
Represents the initial size vector of the visual effect when the spell is cast.
Vec3 actSize (read-only)
Represents the current size vector of visual effect.
Vec3 castEndSize
Represents the final size vector of the visual effect when the spell is cast.
float nextLevelTime (read-only)
Represents the elapsed time since last spell invest.
float easeTime (read-only)
Represents the normalized progression of eased movement along a trajectory.
float age (read-only)
Represents elapsed time since object creation.
float trjUpdateTime (read-only)
Represents elapsed time since last trajectory update.
float emTrjDist (read-only)
Represents the current distance traveled along a predefined trajectory.
float trjSign (read-only)
Represents trajectory direction sign (either -1 or 1).
float levelTime
Represents the elapsed level time that affects visual scale in seconds.
float lifeSpanTimer (read-only)
Represents the elapsed time from when the effect was initialized.
float fxStartTime (read-only)
Represents start time for FOV effect.
float oldFovX (read-only)
Represents original camera fov x (before effect is applied).
float oldFovY (read-only)
Represents original camera fov y (before effect is applied).
bool collisionOccured (read-only)
Represents true when collision occured for visual effect, otherwise false.
bool showVisual
Represents true when visual effect is being displayed, otherwise false.
bool isChild (read-only)
Represents true when visual effect is a child of another object, otherwise false.
bool isDeleted (read-only)
Represents true when visual effect is removed from world, otherwise false.
bool initialized (read-only)
Represents true when visual effect is initialized, otherwise false.
bool shouldDelete (read-only)
Represents true when visual effect is meant to be deleted, otherwise false.
bool lightning
Represents true when visname_s of visual effect in daedalus has "LTN" in its instance, otherwise false.
bool fxInvestOriginInitialized (read-only)
Represents true when invest origin effect was initialized, otherwise false.
bool fxInvestTargetInitialized (read-only)
Represents true when invest target effect was initialized, otherwise false.
bool fxInvestStopped (read-only)
Represents true when visual effect casting is stopped otherwise false.
bool timeScaled
Represents true when visname_s of visual effect in daedalus has "SLW" in its instance, otherwise false.
bool fovMorph
Represents true when visname_s of visual effect in daedalus has "FOV" in its instance, otherwise false.
int level
Represents the level of visual effect.
int collisionCtr (read-only)
Note
This field is using only 5 bits.
Represents the occured collision amount in visual effect.
int queueSetLevel
Note
This field is using only 3 bits.
Represents the spell level of visual effect when home world is not set.
int damage (read-only)
Note
This field is using only 5 bits.
Represents the visual effect damage value.
int damageType
Represents the visual effect damage type.
int spellType (read-only)
Represents spell type: good = 0, neutral = 1, bad = 2.
int spellTargetTypes (read-only)
Represents spell target type. For more information see Target constants.
float savePpsValue
Represents the spell particle amount.
Vec2 saveVisSizeStart (read-only)
Represents visSizeStart field from particle emitter.
int ringPos (read-only)
Represents visual effect index from trans ring.
bool emTrjFollowHitLastCheck (read-only)
Note
Works only when emTrjMode_S is set to "FOLLOW".
Represents true when visual effect followed trajectory hit target, otherwise false.
bool isProjectile (read-only)
Represents true when visual effect is set to projectile (collider is set to projectile), otherwise false.
bool pfxMeshSetByVisualFX (read-only)
Reprents if visual effect size is set to particle emitter mesh.
bool allowMovement
Represents true when visual effect movment is enabled, otherwise false.
float sleepTimer
Represents sleep timer of visual effect.
Methods
getUserString
Represents the visual effect userstring, userstrings are used as a way to provide additional parameters to pass to game engine.
string getUserString()
Returns string:
getTransRing
Gets the visual effect trans ring vector.
Vec3 getTransRing()
Returns Vec3:
static createAndPlay
This method will create visual effect and play it.
VisualFX& createAndPlay(string instance, Vec3 originPosition, userpointer targetVob = null, int level = 1, float damage = 0, int damageType = 0., bool isProjectile = false)
Parameters:
stringinstance: visual effect instance from daedalus scripts.Vec3originPosition: the position from which effect will be played.userpointertargetVob: the target vob for the visual effect.intlevel: the visual effect level (e.g: MFX_FIREBALL_CAST_L[level]).floatdamage: the visual effect damage points.intdamageType: For more information see Damage constants.boolisProjectile:trueif visual effect should have projectile collider, otherwisefalse.
Returns VisualFX&:
the created visual effect.
static createAndPlay
This method will create visual effect and play it.
VisualFX& createAndPlay(string instance, userpointer originVob, userpointer targetVob = null, int level = 1, float damage = 0, int damageType = 0., bool isProjectile = false)
Parameters:
stringinstance: visual effect instance from daedalus scripts.userpointeroriginVob: the origin vob (caster) userpointer.userpointertargetVob: the target vob for the visual effect.intlevel: the visual effect level (e.g: MFX_FIREBALL_CAST_L[level]).floatdamage: the visual effect damage points.intdamageType: For more information see Damage constants.boolisProjectile:trueif visual effect should have projectile collider, otherwisefalse.
Returns VisualFX&:
the created visual effect.
static parseStrings
This method sets internal fields of visual fx by daedalus script fields.
void parseStrings()
static setupEmitterKeysByVisual
This method sets emitter keys for visual fx and it's childs.
void setupEmitterKeysByVisual()
static open
This method sets visual fx state to open.
void open()
static setOrigin
This method will set origin vob of the visual effect.
void setOrigin(userpointer originVob, bool recalcTrj = true)
Parameters:
userpointeroriginVob: the origin vob (caster) userpointer.boolrecalcTrj:trueif visual effect should recalculate it's trajectory.
static setTarget
This method will set target vob of the visual effect.
void setTarget(userpointer targetVob, bool recalcTrj = true)
Parameters:
userpointertargetVob: the target vob for the visual effect.boolrecalcTrj:trueif visual effect should recalculate it's trajectory.
static setTarget
This method will set target vob of the visual effect.
void setTarget(Vec3 targetPosition, bool recalcTrj = true)
Parameters:
Vec3targetPosition: The world position towards which the effect will be played.boolrecalcTrj:trueif visual effect should recalculate it's trajectory.
static setInflictor
This method will set inflictor vob of the visual effect.
void setInflictor(userpointer inflictorVob)
Parameters:
userpointerinflictorVob: the inflictor vob for the visual effect.
static init
This method will initialize a visual effect.
void init(userpointer originVob, Vec3 targetPosition)
Parameters:
userpointeroriginVob: the origin vob for the visual effect.Vec3targetPosition: The world position towards which the effect will be played.
static init
This method will initialize a visual effect.
void init(userpointer originVob, Vec3 targetPosition, userpointer the)
Parameters:
userpointeroriginVob: the origin vob for the visual effect.Vec3targetPosition: The world position towards which the effect will be played.userpointerthe: inflictor vob for the visual effect.
static investNext
This method increments spell level of visual fx.
void investNext()
static setLevel
This method will initialize a visual effect.
void setLevel(int level, bool force)
Parameters:
intlevel: of the visual effect.boolforce:trueif want to force effect state, otherwisefalse.
static cast
This method will change visual effect state to casted.
void cast()
static stop
This method will change visual effect state to stopped.
void stop(bool killAfterDone = true)
Parameters:
boolkillAfterDone:trueif want to kill efect, otherwisefalse.
static kill
This method destroys current visual fx effect.
void kill()
static canBeDeleted
This method checks if current visual fx can be deleted.
bool canBeDeleted()
Returns bool:
static isFinished
This method checks if current visual fx is finished.
bool isFinished()
Returns bool:
static isLooping
This method checks if current visual fx is finished.
bool isLooping()
Returns bool:
static setByScript
This method will change visual effect instance.
void setByScript(string instance)
Parameters:
stringinstance: visual effect instance from daedalus scripts.
static reset
This method returns true if the visual effect is looping, otherwise false.
void reset()
static setCollisionEnabled
This method will set visual effect collision.
void setCollisionEnabled(bool toggle)
Parameters:
booltoggle:trueif want to enable collision, otherwisefalse.
static canThisCollideWith
This method returns true if the given vob can collide with visual effect, otherwise false.
bool canThisCollideWith(userpointer vobPtr)
Parameters:
userpointervobPtr: the checked vob.
Returns bool:
static setVisualByString
This method will change visual effect.
void setVisualByString(string visual)
Parameters:
stringvisual: effect name.
static calcTrajectory
This method will calculate visual effect trajectory.
void calcTrajectory(bool updateTargetOnly = false)
Parameters:
boolupdateTargetOnly:trueif want to update only for target, otherwisefalse.
static collide
This method will set visual effect state to collided.
void collide(bool killAfterDone = true)
Parameters:
boolkillAfterDone:trueif want to destroy effect, otherwisefalse.
static checkDeletion
This method returns true if the visual effect should be deleted otherwise false.
bool checkDeletion()
Returns bool:
static createAndCastFX
This method will create visual effect and cast it.
void createAndCastFX(string instance, userpointer originVob, userpointer inflictorVob = null)
Parameters:
stringinstance: visual effect instance from daedalus scripts.userpointeroriginVob: the origin vob (caster) userpointer.userpointerinflictorVob: the inflictor vob for the visual effect.
static createAndCastFX
This method will create visual effect and cast it.
void createAndCastFX(string instance, Mat4 originMatrix)
Parameters:
stringinstance: visual effect instance from daedalus scripts.Mat4originMatrix: the origin 4x4 matrix.
static initEffect
This method initializes the visual effect.
void initEffect()
static endEffect
This method will end visual effect.
void endEffect(bool killAfterDone = true)
Parameters:
boolkillAfterDone:trueif want to destroy effect, otherwisefalse.
static cleanUpCriticalFX
This method cleans up sub effects of the visual fx.
void cleanUpCriticalFX()
Callbacks
No callbacks.