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.
Too many Instructions??
Débuté par
Ulo Ironbeard
, déc. 03 2010 03:44
#1
Posté 03 décembre 2010 - 03:44
#2
Posté 03 décembre 2010 - 03:48
Sorry about not posting the code in a separate window... its been a while and I apparently have forgotten how
#3
Posté 03 décembre 2010 - 04:07
These forums have crappy script tags. However, the tag to show script is [ code ] and [ /code ] without the spaces.
Try editing your loops a little bit to make them enclosed, ie:
oPC = GetFirstPC();
while(GetIsObjectValid(oPC) == TRUE)
{
//Fade to Black
FadeToBlack(oPC, FADE_SPEED_SLOW);
oPC = GetNextPC();
} // This is the addition to close the loop
And:
//Fade From Black and laugh
oPC = GetFirstPC(); // Added to reset oPC to First PC
while(GetIsObjectValid(oPC) == TRUE)
{ // Added to open the loop
FadeFromBlack(oPC, FADE_SPEED_SLOW);
AssignCommand(oPC,PlaySound("vs_nx2mephm_haha"));
oPC = GetNextPC();
} // Added to close the loop
Also, my tutorial linked in sig below has a section on using loops.
Try editing your loops a little bit to make them enclosed, ie:
oPC = GetFirstPC();
while(GetIsObjectValid(oPC) == TRUE)
{
//Fade to Black
FadeToBlack(oPC, FADE_SPEED_SLOW);
oPC = GetNextPC();
} // This is the addition to close the loop
And:
//Fade From Black and laugh
oPC = GetFirstPC(); // Added to reset oPC to First PC
while(GetIsObjectValid(oPC) == TRUE)
{ // Added to open the loop
FadeFromBlack(oPC, FADE_SPEED_SLOW);
AssignCommand(oPC,PlaySound("vs_nx2mephm_haha"));
oPC = GetNextPC();
} // Added to close the loop
Also, my tutorial linked in sig below has a section on using loops.
Modifié par _Knightmare_, 03 décembre 2010 - 04:18 .
#4
Posté 03 décembre 2010 - 04:25
Thanks for the quick reply - I'll check it out and let you know if it does the trick. I'll also look at your tutorial.
#5
Posté 04 décembre 2010 - 02:38
Thanks for the lesson on loop opening and closing. I think I got it.
#6
Posté 04 décembre 2010 - 03:14
NP, happy to help. As always, return if you have any more questions we might be able to help with.
Happy building!
Happy building!
#7
Posté 08 décembre 2010 - 02:21
Wonderful to see we all have the same problems, I was wondering being an old nwn scripter, and avoiding* Script script_name, OID 80000000, Tag: ERROR: TOO MANY INSTRUCTIONS * by changing my code so a PC/NPC does not have to run to many do,while,for,switch case statements. I always use { } even when I dont realy have to so code is consistant and its just a good habit. Befor i ramble on my Questions is this...
Is there any info on whats likely to cause the ERROR: TOO MANY INSTRUCTIONS, and any info that might tell me what the OID 80000000 is
The reason I ask is it always seems when I have a PC/NPC and sometimes other object execute a script or use a include that has (do,while,for,switch case statements) I get that dang...
* Script script_name, OID 80000000, Tag: ERROR: TOO MANY INSTRUCTIONS *
is this cause by the (do,while,for,switch case statements), or a loss in system memory because sometimes a server reset fixes prob.
Is there any info on whats likely to cause the ERROR: TOO MANY INSTRUCTIONS, and any info that might tell me what the OID 80000000 is
The reason I ask is it always seems when I have a PC/NPC and sometimes other object execute a script or use a include that has (do,while,for,switch case statements) I get that dang...
* Script script_name, OID 80000000, Tag: ERROR: TOO MANY INSTRUCTIONS *
is this cause by the (do,while,for,switch case statements), or a loss in system memory because sometimes a server reset fixes prob.
#8
Posté 08 décembre 2010 - 03:07
OID is an Object ID. It will only really mean something to you if you ever dig into the guts of the engine.
The TOO MANY INSTRUCTIONS is caused by having too many commands happen in a script. The most likely cause is a loop that never terminates. NWN placed a limit on the number of instructions to keep any one script from locking up the game by never ending.
EDIT: Here is a Link to Funkys better explanation.
The TOO MANY INSTRUCTIONS is caused by having too many commands happen in a script. The most likely cause is a loop that never terminates. NWN placed a limit on the number of instructions to keep any one script from locking up the game by never ending.
EDIT: Here is a Link to Funkys better explanation.
Modifié par Lightfoot8, 08 décembre 2010 - 03:11 .





Retour en haut






