help finishing a puzzle script please.
#1
Posté 12 décembre 2010 - 08:31
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
#2
Posté 13 décembre 2010 - 04:14
Good luck.
#3
Posté 13 décembre 2010 - 03:34
just let me know if anyone wants this.
thanks
EDIT:
before this latest problem, the puzzle did work.... up to a point, it was actually useable, the colors did change, but there was a problem with the order. that was the last thing the scripter was fixing. i appologize for being so vage, but the script was done and has been sitting for about 3-5 months now. finally got caught up on other stuff and need this now.
thanks again.
Modifié par zero-feeling, 13 décembre 2010 - 03:39 .
#4
Posté 13 décembre 2010 - 10:23
Also, you call GetNextObjectInArea() two times for each time around your loops. That should make you skip an object each time around the loop. I'm pretty sure that isn't what you want.
If you can describe the puzzle in detail. People may be more able to help you fix it.
Modifié par Mudeye, 13 décembre 2010 - 10:24 .
#5
Posté 14 décembre 2010 - 01:09
when the player enters the room, the placeables spawn, all WPs have been raised 0.20 from the ground and they show the colors how they should be now. (had been raised to .1 with no success)
placeables include: 4 color coded statues, corrisponding to the colors on the rune plates and 16 rune plates of each color. (blue, green, red, yellow)
one final placeable, a chest appears when the puzzle is finished.
basicly the player needs to take all the colors of one kind and seperate them to thier own quarter, 16 to each quarter of the puzzle. the colors of the plates are supposed to change in order, clockwise, to ad a bit of difficulty. this might be where the puzzle becomes undoable, but i haven't gotten far enough in the prosses to figure that out.
once the player gets all 16 runes of one color, that color gets locked down, and there will only be three colors rotating the player has to deal with. once a color if finished it's no longer supposed to be in the cycle. to show the color has been locked down, a beam is supposed to shoot from every plate to it's corrisponding statue and the statue should glow that color.
once all 4 colors are finished, the chest spawns, you get the reward, and your done.
hope that explains what the puzzle is meant to do, and maybe it can be fixed easier now
thanks
#6
Posté 15 décembre 2010 - 06:19
i can send anyone the area all set up for you...
thanks
Modifié par zero-feeling, 15 décembre 2010 - 06:20 .
#7
Posté 15 décembre 2010 - 09:10
-420
#8
Posté 15 décembre 2010 - 11:55
thats the current problem. any suggestions? could it have something to do with the part where it locks the colors? could it be doing this too soon?
thanks
#9
Posté 16 décembre 2010 - 01:04
-420
#10
Posté 16 décembre 2010 - 03:26
if it's not too much trouble, possibly a bit of explination to what section in that monster your refering to?
thanks
#11
Posté 16 décembre 2010 - 04:22
[b]object oObject = GetFirstObjectInArea();[/b]
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))
To here:
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;
[b]object oObject = GetFirstObjectInArea();[/b]
while(GetIsObjectValid(oObject))
#12
Posté 16 décembre 2010 - 05:49
still no change from before. the colors are bright and briliant, but not changing.
thanks
#13
Posté 16 décembre 2010 - 06:30
Alright, then my next guess is that the existing light VFX needs to be removed before the new one is applied. That will mean cycling through all the existing effects on the object and removing the glow before changing to a new color. This is best done by using a specific object to apply the effect then checking for the effect's creator.zero-feeling wrote...
ok, moved the line.
still no change from before. the colors are bright and briliant, but not changing.
thanks
It's getting late but I'd be happy to go into more detail on this tomorrow.
-420
#14
Posté 17 décembre 2010 - 11:04
420 wrote...
It's getting late but I'd be happy to go into more detail on this tomorrow.
-420
ready when you are. the sooner this puzzle works, the better.
#15
Posté 19 décembre 2010 - 02:01
thanks
#16
Posté 22 décembre 2010 - 11:58
#17
Posté 22 décembre 2010 - 06:39
Sorry about that, I completely forgot.zero-feeling wrote...
one more go at this.... bump.
You'll want to do something like this before applying the visual effect:
effect eRemove = GetFirstEffect(OBJECT_SELF);
while(GetIsEffectValid(eRemove))
{
if(GetEffectCreator(eRemove) == OBJECT_SELF) RemoveEffect(OBJECT_SELF, eRemove);
eRemove = GetNextEffect(OBJECT_SELF);
}
-420
#18
Posté 23 décembre 2010 - 07:32
effect eRemove = GetFirstEffect(OBJECT_SELF);
while(GetIsEffectValid(eRemove))
{
if(GetEffectCreator(eRemove) == OBJECT_SELF) RemoveEffect(OBJECT_SELF, eRemove);
eRemove = GetNextEffect(OBJECT_SELF);
}
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);
}
#19
Posté 23 décembre 2010 - 07:39
#20
Posté 24 décembre 2010 - 12:33
TR
#21
Posté 24 décembre 2010 - 08:50
#22
Posté 24 décembre 2010 - 12:40
Dropbox is a free tool that gives you access to a free amount of web storage (like a tiny 2 gig hard drive). Best of all it allows you to share stuff with other people. Another great thing is that they only require the absolute minimum of information from you to get it. To check it out just go here.
They also have a scheme whereby if you send someone to sign up for it via a special link, both you and the person signing up to it get an extra 250 meg of storage each. For example if you were to sign up for it via this link, both you and I would get the extra space.
TR
Modifié par Tarot Redhand, 24 décembre 2010 - 12:43 .
#23
Posté 25 décembre 2010 - 09:40
#24
Posté 25 décembre 2010 - 04:16
zero-feeling wrote...
got a dropbox... thanks for telling me about it. will be adding the mod to it for future help i guess
Also dont forget that you can always upload files to your project.
#25
Posté 25 décembre 2010 - 10:31
zero-feeling wrote...
got a dropbox... thanks for telling me about it. will be adding the mod to it for future help i guess
You're welcome. Also don't forget you can update any file that is in any folder under your main dropbox folder simply by overwriting it as long as you are connected to the internet.
TR





Retour en haut







