UW2_PRC8/_module/nss/do_bench_vfx.nss
Jaysyn904 5197ad9a4d Initial upload
Initial upload
2023-09-25 20:24:01 -04:00

164 lines
6.7 KiB
Plaintext

//Script Name:
//////////////////////////////////////////
//Created By: Genisys (Guile)
//Created On: 8/13/08
/////////////////////////////////////////////////////////////////////
/* Create Your Own Placeable Object Visual Effect (FXs)
////////////////////////////////////////////////////////////////////
IMPORTANT: This script must go in the OnHeartbeat
event of an object which is NOT static! (Making it Plot is Recommended)
NOTE: You can only apply 1 effect to an object with THIS script.
NOTE: While, you can apply a lot of various effects to just about
any object, any effect which applies the effect directly to the object,
like Auras / Stone Skin / etc.., Cannot go on an invisible object.
(Won't show, cause it's invisible! hehe.. :P) Also, some effects may
not look right on an object, and some instant effects may not show up
if they are small the object is too big! So consider the effect and
the object it's going on FIRST!
IMPORTANT: You MUST use VFX_DUR_ Constants for ALL Permanent and
Temporary Effects, Instant FXs are all of the other constants,
like VFX_FNF / VFX_COM_ / or VFX_IMP
VFX_BEAM_ & VFX_EYES_ Constants CANNOT be used in this script, sorry.
You can creatively make a lot of different things, the visual effects
make placeables appear magical, and the instant visual effects could
make some objects more meaningful, or be used for cutscenes, all in all
this script can add A LOT of flash an pizzazz to ANY module.
NOTE: however, this script fires every 6 seconds, SO, you don't
want to use a lot of placebles in a module with VFXs on them, or
the game play could be slowed (causing lag) considerably, depending
upon just how many of these things you had placed in the module.
I have seen some module with gobs of them, and the lag was a little
noticeable, while others had too many and lagg was quite sever in some
areas. Do NOT use more than 10 of these per area, I don't recommend you
use more than 100 in a module, they really lose impact on a Player
when every area has 10 of them. :/
*/
/////////////////////////////////////////////////////////////////////
//////////IMPORTANT SETTINGS////////////////////////////////////////
//Set this to 1 for Permanent Effects
//Set this to 2 for a Temporary VFXs (Duration Required)
//Set this to 3 for Instant FXs (These are applied every 3 seconds infinitely)
const int nFX = 1; //Default = 1 PERMANENT (VFX_DUR_ ONLY!)
//This determines how long the Temporary FXs last(in Seconds)
const float fDur = 300.0;// the range = 1.0 - 1200.0 (20 Minutes MAXIMUM!)
//(USE PERMANENT if you want to go over 20 minutes)
//This determines how many times you wish to run the Instant VFXs
//every Heartbeat-(6 Seconds) ****USE ONLY 1 - 7****
//NOTE: 7 = Randomly Fires ONCE every Heartbeat(Inconsistency is nice)
const int nTimes = 2; //Default = 2 (once every 3 seconds)
//The tab "Constants" to the right will help you find the VFX_
//Replace the VFX_DUR below with the one you choose.
const int nConstant = VFX_DUR_PROT_SHADOW_ARMOR;
///////////////////////////////////////////////////////////////////
///////WARNING: DON'T TOUCH ANYTHING BELOW THIS LINE!!!////////////
//////////////////////////////////////////////////////////////////
//Main Script
void main()
{
object oSelf = OBJECT_SELF;
//If we are using Permanent Effects..
if(nFX==1)
{
//If the FX has been applied stop here..
if(GetLocalInt(oSelf, "FX_ACTIVE")==1)
{return;}
//If not then, lets apply the Permanent visual effect
else
{
SetLocalInt(oSelf, "FX_ACTIVE", 1);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(nConstant), oSelf);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_AURA_PULSE_CYAN_BLUE), oSelf);
}
}
//If we are doing Temporary VFX (one time only)
else if(nFX ==2)
{
//If the FX has been applied stop here..
if(GetLocalInt(oSelf, "FX_ACTIVE")==1)
{return;}
//If not then, lets apply the visual effect
else
{
SetLocalInt(oSelf, "FX_ACTIVE", 1);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(nConstant), oSelf, fDur);
}
}
//If we are doing Instant effects..
else if(nFX ==3)
{
//2 X / Heartbeat
if(nTimes == 2)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf);
DelayCommand(3.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf));
}
//3X / Heartbeat
else if(nTimes == 3)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf);
DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf));
DelayCommand(4.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf));
}
//4X / Heartbeat
else if(nTimes == 4)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf);
DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf));
DelayCommand(3.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf));
DelayCommand(4.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf));
}
//5X / Heartbeat
else if(nTimes == 5)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf);
DelayCommand(1.25, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf));
DelayCommand(2.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf));
DelayCommand(3.75, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf));
DelayCommand(5.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf));
}
//6X / Heartbeat
else if(nTimes == 6)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf);
DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf));
DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf));
DelayCommand(3.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf));
DelayCommand(4.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf));
DelayCommand(5.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf));
}
//1 Randomly Timed Effect / Heartbeat
else if(nTimes == 7)
{
int nDice = d6(1);
float fRandom = IntToFloat(nDice);
DelayCommand(fRandom, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf));
}
//All other instances = 1 time / heartbeat!
else
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(nConstant), oSelf);
}
}
//Main Script End
}