Hi all - While testing some scripts concerning visual effects on a LAN I ran across something I have not seen before. Heres what I'm trying to do:
I'm working with two different areas at one time. The first area is where the action is taking place - a PC is trying to destroy a crystal floating above a tower. With each hit there are visual and sound effects. The second area is the town where the tower is, and the crystal is visible floating overthe tower, and PC's in the area can see the crystal being attacked, and its final destruction. Once the crystal explodes, screens in both areas are supposed to fade to black, then fade back from black to show environmental changes caused by the crystals destruction.
The bulk of the scripts work fine - you can see the visuals and hear sound effects from both the host and client machines, and both fade to black. However, the host machine remains black while the client machine fades back from black like its supposed to. The client machine displayed the following messages:
Script bm_q3_effects, OID 80000000, Tag: ERROR: TOO MANY INSTRUCTIONS
Script bm_q3_crysdeath, OID 800059a5, Tag: ZEP_CRYSTAL001, ERROR: TOO MANY INSTRUCTIONS.
Here are the two scripts in question:
/nwscript
#include "aps_include"
void main()
{
object oMod = GetModule();
object oPC;
object oArea1 = GetObjectByTag("S_sequim");
object oArea2 = GetObjectByTag("S_trsr1");
object oArea3 = GetObjectByTag("S_trsr2");
object oArea4 = GetObjectByTag("S_trnr1_sequimout");
object oArea5 = GetObjectByTag("S_sequimtowerroof");
oPC = GetFirstPC();
while(GetIsObjectValid(oPC) == TRUE)
{
//Fade to Black
FadeToBlack(oPC, FADE_SPEED_SLOW);
oPC = GetNextPC();
//Change Fog Color
SetFogColor(FOG_TYPE_ALL, FOG_COLOR_BLACK, oArea1);
SetFogColor(FOG_TYPE_ALL, FOG_COLOR_BLACK, oArea2);
SetFogColor(FOG_TYPE_ALL, FOG_COLOR_BLACK, oArea3);
SetFogColor(FOG_TYPE_ALL, FOG_COLOR_BLACK, oArea4);
SetFogColor(FOG_TYPE_ALL, FOG_COLOR_BLACK, oArea5);
// Remove Skybox's
SetSkyBox(SKYBOX_NONE, oArea1);
SetSkyBox(SKYBOX_NONE, oArea2);
SetSkyBox(SKYBOX_NONE, oArea3);
SetSkyBox(SKYBOX_NONE, oArea4);
SetSkyBox(SKYBOX_NONE, oArea5);
//Change Music
MusicBackgroundChangeDay(oArea1, 52);
MusicBackgroundChangeDay(oArea2, 52);
MusicBackgroundChangeDay(oArea3, 52);
MusicBackgroundChangeDay(oArea4, 52);
MusicBackgroundChangeDay(oArea5, 52);
MusicBackgroundChangeNight(oArea1, 52);
MusicBackgroundChangeNight(oArea2, 52);
MusicBackgroundChangeNight(oArea3, 52);
MusicBackgroundChangeNight(oArea4, 52);
MusicBackgroundChangeNight(oArea5, 52);
// Write to DB
SetPersistentInt(oMod, "SequimState", 0);
//Fade From Black and laugh
while(GetIsObjectValid(oPC) == TRUE)
FadeFromBlack(oPC, FADE_SPEED_SLOW);
AssignCommand(oPC,PlaySound("vs_nx2mephm_haha"));
oPC = GetNextPC();
}
}
/nwscript
void main()
{
object oMod = GetModule();
// Sequim areas affected
object oArea1 = GetObjectByTag("S_sequim");
object oArea2 = GetObjectByTag("S_sequimtowerroof");
object oArea3 = GetObjectByTag("S_sequimmayor");
object oArea4 = GetObjectByTag("M_sequimshops");
object oArea5 = GetObjectByTag("S_sequimtower");
object oArea6 = GetObjectByTag("S_sleepdragonpub");
// Objects and Locations
object oCrystal = OBJECT_SELF;
location lCrystal = GetLocation(oCrystal);
object oSeqCrystal = GetObjectByTag("seqbluecrystal");
location lSeqCrystal = GetLocation (oSeqCrystal);
object oShaft = GetObjectByTag("ShaftofLightBlue");
object oSound = GetObjectByTag("DarkLampSound");
object oSparkle = GetObjectByTag("seqsparksblue");
location lSparkle = GetLocation(oSparkle);
object oWay1 = GetObjectByTag("WP_crystal_drop");
location lWay1 = GetLocation(oWay1);
object oWay2 = GetObjectByTag("WP_EscapePortal");
location lWay2 = GetLocation(oWay2);
// Visual Effects
effect eVis1 = EffectVisualEffect(VFX_FNF_SOUND_BURST);
effect eVis2 = EffectVisualEffect(VFX_FNF_STRIKE_HOLY);
effect eVis3 = EffectVisualEffect(VFX_FNF_SCREEN_BUMP);
// Explosion on Tower Roof
DestroyObject(oCrystal);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis1, lCrystal);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis2, lCrystal);
// Explosion as seen in Sequim outside of Tower
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis1, lSeqCrystal);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis2, lSeqCrystal);
// Shake areas in Sequim rocked by the blast
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis3, oArea1);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis3, oArea2);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis3, oArea3);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis3, oArea4);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis3, oArea5);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis3, oArea6);
// Destroy Crystals
DestroyObject(oSeqCrystal);
DestroyObject(oShaft);
DestroyObject(oSparkle);
SoundObjectStop(oSound);
// Create smoke where crystal was
CreateObject(OBJECT_TYPE_PLACEABLE,"evilsmoke", lSparkle, TRUE);
CreateObject(OBJECT_TYPE_PLACEABLE,"ZEP_SMOKEA", lSparkle, TRUE);
CreateObject(OBJECT_TYPE_PLACEABLE,"evilsmoke", lCrystal, TRUE);
CreateObject(OBJECT_TYPE_PLACEABLE,"ZEP_SMOKEA", lCrystal, TRUE);
// Create the quest item and escape portal
CreateObject(OBJECT_TYPE_ITEM, "bm_q3_item", lWay1, TRUE);
CreateObject(OBJECT_TYPE_PLACEABLE, "portal_seqtower", lWay2, TRUE);
// Darkness falls over Sequim
ExecuteScript("bm_q3_effects", oMod);
}
/nwscript
I suspect my problem lies with the while loop - I'm not really comfortable with their use. Any suggestions?
Thanks in advance.