got a puzzle script here that dosn't quite work how it should, not even sure if it can work to be honest. the original scripter dropped off the face of the planet and i have no way to contact them to finish it... so after 3 months of waiting, it's up for the public to help me, if you can... it would be greatly appreciated.
the current problem is that the rune plates spawn below the floor a bit making them look as if they are colors other than what they should be. this might also be the reason the plates aren't useable as well, or that could be a whole new problem.
// puzzle OnEnter script
// place this on the OnEnter event of the area or on a trigger
// by: Yukiakari, 2010
int RandomColour()
{
int nInt = d4();
int nColour;
switch(nInt)
{
case 1: nColour = VFX_DUR_GLOW_BLUE;
break;
case 2: nColour = VFX_DUR_GLOW_RED;
break;
case 3: nColour = VFX_DUR_GLOW_YELLOW;
break;
case 4: nColour = VFX_DUR_GLOW_GREEN;
}
return nColour;
SendMessageToPC(GetFirstPC(), "Colour: " + IntToString(nColour));
}
void main()
{
object oPC = GetEnteringObject();
if(!GetIsPC(oPC)) return;
string s1 = "rune_switch"; // enter the ResRef HERE!!!
object oWP = GetFirstObjectInArea();
string sTag;
string sWP;
while(GetIsObjectValid(oWP))
{
sWP = GetTag(oWP);
// debug
//SendMessageToPC(GetFirstPC(), "WP Tag: " + sWP);
string sSub1 = GetSubString(sWP, 0,3);
// debug
//SendMessageToPC(GetFirstPC(), "SubString 1: " + sSub1);
string sSub2 = GetSubString(sWP, 3,2);
// debug
//SendMessageToPC(GetFirstPC(), "SubString 2: " + sSub2);
if(sSub1 == "WP_")
{
sTag = "PP_" + sSub2;
object oRune = CreateObject(OBJECT_TYPE_PLACEABLE, s1, GetLocation(oWP), FALSE, sTag);
int nColour = RandomColour();
DelayCommand(0.1, ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(nColour), oRune, 0.0));
SetLocalInt(oRune, "COLOUR", nColour);
// debug
//SendMessageToPC(GetFirstPC(), "Colour: " + IntToString(nColour));
//SendMessageToPC(GetFirstPC(), "COLOUR: " + IntToString(GetLocalInt(oRune, "COLOUR")));
//DestroyObject(oWP, 0.0);
oWP = GetNextObjectInArea();
}
oWP = GetNextObjectInArea();
}
}
this is the OnUsed script thats attached to the rune plates
// script that checks, if the puzzle has been solved and locks the colours
// OnUsed script for a lever
// by: Yukiakari, 2010
void main()
{
/*
Block
A: line <=4, row <=4 blueBlock
B: line <=4, row >=5 yellowBlock
C: line >=5, row <=4 greenBlock
D: line >=5, row >=5 red
*/
object oObject = GetFirstObjectInArea();
string sLine;
int nLine;
string sRow;
int nRow;
int nColour;
int nBlue = 0;
int nYellow = 0;
int nGreen = 0;
int nRed = 0;
int nSpell = SPELL_LIGHTNING_BOLT;
// WAYPOINT for the location (and facing) of the chest
object oWaypoint = GetObjectByTag ("SP_chest");
location lLocation = GetLocation (oWaypoint);
object oStatue;
while(GetIsObjectValid(oObject))
{
sLine = GetSubString(GetTag(oObject), 3,1);
nLine = StringToInt(sLine);
sRow = GetSubString(GetTag(oObject), 3,1);
nRow = StringToInt(sRow);
nColour = GetLocalInt(oObject, "COLOUR");
// BLUE
if((nLine <= 4) && (nRow <=4) && (nColour == VFX_DUR_GLOW_BLUE))
{
nBlue++;
oObject = GetNextObjectInArea();
}
// YELLOW
if((nLine <= 4) && (nRow >=5) && (nColour == VFX_DUR_GLOW_YELLOW))
{
nYellow++;
oObject = GetNextObjectInArea();
}
// GREEN
if( (nLine >=5) && (nRow <=4) && (nColour == VFX_DUR_GLOW_GREEN) )
{
nGreen++;
oObject = GetNextObjectInArea();
}
// RED
if((nLine >=5) || (nRow >=5) || (nColour == VFX_DUR_GLOW_RED))
{
nRed++;
oObject = GetNextObjectInArea();
}
oObject = GetNextObjectInArea();
}
//**************************************
// Lock the placeables
// BLUE
if(nBlue == 16)
{
oStatue = GetObjectByTag("ap_puzz_statue_b");
while(GetIsObjectValid(oObject))
{
if((nLine <= 4) && (nRow <=4) )
{
DeleteLocalInt(oObject, "COlOUR");
AssignCommand(oObject, ActionCastFakeSpellAtObject(nSpell, oStatue, PROJECTILE_PATH_TYPE_DEFAULT));
SetUseableFlag(oObject, FALSE);
oObject = GetNextObjectInArea();
}
oObject = GetNextObjectInArea();
}
// statue
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_GLOW_BLUE), oStatue, 0.0);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_ELECTRIC_EXPLOSION), oStatue, 0.0);
int nInt = GetLocalInt(OBJECT_SELF, "PUZZLE");
SetLocalInt(OBJECT_SELF, "PUZZLE", nInt+1);
}
if(nYellow == 16)
{
oStatue = GetObjectByTag("ap_puzz_statue_y");
while(GetIsObjectValid(oObject))
{
if((nLine <= 4) && (nRow >=5) )
{
DeleteLocalInt(oObject, "COlOUR");
AssignCommand(oObject, ActionCastFakeSpellAtObject(nSpell, oStatue, PROJECTILE_PATH_TYPE_DEFAULT));
SetUseableFlag(oObject, FALSE);
oObject = GetNextObjectInArea();
}
oObject = GetNextObjectInArea();
}
// statue
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_GLOW_YELLOW), oStatue, 0.0);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_ELECTRIC_EXPLOSION), oStatue, 0.0);
int nInt = GetLocalInt(OBJECT_SELF, "PUZZLE");
SetLocalInt(OBJECT_SELF, "PUZZLE", nInt+1);
}
if(nGreen == 16)
{
oStatue = GetObjectByTag("ap_puzz_statue_g");
while(GetIsObjectValid(oObject))
{
if((nLine <=5) && (nRow <=4) )
{
DeleteLocalInt(oObject, "COlOUR");
AssignCommand(oObject, ActionCastFakeSpellAtObject(nSpell, oStatue, PROJECTILE_PATH_TYPE_DEFAULT));
SetUseableFlag(oObject, FALSE);
oObject = GetNextObjectInArea();
}
oObject = GetNextObjectInArea();
}
// statue
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_GLOW_GREEN), oStatue, 0.0);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_ELECTRIC_EXPLOSION), oStatue, 0.0);
int nInt = GetLocalInt(OBJECT_SELF, "PUZZLE");
SetLocalInt(OBJECT_SELF, "PUZZLE", nInt+1);
}
if(nRed == 16)
{
oStatue = GetObjectByTag("ap_puzz_statue_r");
while(GetIsObjectValid(oObject))
{
if((nLine >=5) && (nRow >=5) )
{
DeleteLocalInt(oObject, "COlOUR");
AssignCommand(oObject, ActionCastFakeSpellAtObject(nSpell, oStatue, PROJECTILE_PATH_TYPE_DEFAULT));
SetUseableFlag(oObject, FALSE);
oObject = GetNextObjectInArea();
}
oObject = GetNextObjectInArea();
}
// statue
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_GLOW_RED), oStatue, 0.0);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_ELECTRIC_EXPLOSION), oStatue, 0.0);
int nInt = GetLocalInt(OBJECT_SELF, "PUZZLE");
SetLocalInt(OBJECT_SELF, "PUZZLE", nInt+1);
}
// finale, when all colours are finished
if(GetLocalInt(OBJECT_SELF, "PUZZLE") == 4)
{
// make lever unuseable
SetUseableFlag(OBJECT_SELF, FALSE);
// create chest
CreateObject(OBJECT_TYPE_PLACEABLE, "ap_puzz_chest", lLocation, FALSE, "");
// destroy statues
object oStatueBlue = GetObjectByTag("ap_puzz_statue_b");
object oStatueYellow = GetObjectByTag("ap_puzz_statue_y");
object oStatueGreen = GetObjectByTag("ap_puzz_statue_g");
object oStatueRed = GetObjectByTag("ap_puzz_statue_r");
SetPlotFlag(oStatueBlue, FALSE);
SetPlotFlag(oStatueYellow, FALSE);
SetPlotFlag(oStatueGreen, FALSE);
SetPlotFlag(oStatueRed, FALSE);
DelayCommand(5.0, ActionCastFakeSpellAtObject(SPELL_MAGIC_MISSILE, oStatueBlue, PROJECTILE_PATH_TYPE_DEFAULT));
DelayCommand(5.0, ActionCastFakeSpellAtObject(SPELL_MAGIC_MISSILE, oStatueYellow, PROJECTILE_PATH_TYPE_DEFAULT));
DelayCommand(5.0, ActionCastFakeSpellAtObject(SPELL_MAGIC_MISSILE, oStatueRed, PROJECTILE_PATH_TYPE_DEFAULT));
DelayCommand(5.0, ActionCastFakeSpellAtObject(SPELL_MAGIC_MISSILE, oStatueGreen, PROJECTILE_PATH_TYPE_DEFAULT));
DestroyObject(oStatueBlue, 6.0);
DestroyObject(oStatueYellow, 6.0);
DestroyObject(oStatueGreen, 6.0);
DestroyObject(oStatueRed, 6.0);
// VFX, sound, message, etc.....
}
}
thanks in advance