EOB 2 Script, need help!
#1
Posté 19 juin 2013 - 04:02
I’ve been working on the Eye of the Beholder 2 project for a while now, and the mod is jsut about completed.
I’ve run into a problem with this script and I’m unable to figure out why it keeps failing. I was hoping someone here could look this over and fix it up so it works.
This is what it’s supposed to do.
You have all four horns; they have the Unique Spell cast on them so they can be used.
The first part of the script works fine, I get the message and the sound of the Horn being used and the pop up text.
I then also hear the sound being used for the Howl of the horn.
But I do not get the message “A hollow sound comes from the horn”.
It’s then supposed to go to the OpenWall section and check the variable. That it not happening from what I can see.
I cannot get the wall to disappear after all four horns have been used.
Would someone please take a look at this and fix it up for me? Its driving me crazy trying to get this working.
Thanks all, Appreciate any help I can get.
Here is the script.
#include "debug"
#include "nw_i0_tool"
void BlowHorn(string sHorn, string sMessage2);
void OpenWall();
object oActivatedItem = GetItemActivated();
object oPlayer = GetItemActivated();
void main()
{
ExecuteScript("eb_recall_oa", OBJECT_SELF);
if (GetTag(oActivatedItem) == "CreateFoodItem")
{
object oUser = GetItemActivator();
object oTarget = GetItemActivatedTarget();
location oLocation = GetItemActivatedTargetLocation();
effect eVis = EffectVisualEffect(VFX_IMP_HEAD_HEAL);
CreateItemOnObject("food001", oTarget);
CreateItemOnObject("food001", oTarget);
CreateItemOnObject("food001", oTarget);
CreateItemOnObject("food001", oTarget);
SendMessageToPC (oTarget, "Food Created");
AssignCommand(oTarget,PlaySound("sca_outholy01"));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
}
if(GetTag(oActivatedItem) == "NorthWind")
{
//debug("NorthWind");
object oTarget = GetItemActivatedTarget();
string sMessage = "You feel a cold draft from the north.";
AssignCommand(oTarget,PlaySound("as_wt_gustsoft1"));
BlowHorn(GetTag(oActivatedItem), sMessage);
OpenWall();
}
if(GetTag(oActivatedItem) == "SouthWind")
{
//debug("SouthWind");
object oTarget = GetItemActivatedTarget();
string sMessage = "You feel a warm breeze from the south.";
AssignCommand(oTarget,PlaySound("as_wt_gusforst1"));
BlowHorn(GetTag(oActivatedItem), sMessage);
OpenWall();
}
if(GetTag(oActivatedItem) == "EastWind")
{
//debug("EastWind");
object oTarget = GetItemActivatedTarget();
string sMessage = "You feel a slight breeze from the east.";
AssignCommand(oTarget,PlaySound("as_wt_gustgrass1"));
BlowHorn(GetTag(oActivatedItem), sMessage);
OpenWall();
}
if(GetTag(oActivatedItem) == "WestWind")
{
//debug("WestWind");
object oTarget = GetItemActivatedTarget();
string sMessage = "You feel a gust of wind from the west.";
AssignCommand(oTarget,PlaySound("as_wt_gustchasm1"));
BlowHorn(GetTag(oActivatedItem), sMessage);
OpenWall();
}
}
void OpenWall()
{
//object oWindWallWP = GetWaypointByTag("WP_FourWindWall");
debug("OpenWall");
object oPlayer = GetLastUsedBy();
if(GetLocalInt(oPlayer, "NorthWind") && GetLocalInt(oPlayer, "SouthWind") &&
GetLocalInt(oPlayer, "EastWind") && GetLocalInt(oPlayer, "WestWind"))
{
SetLocalInt(oPlayer, "WallIsOpen", 1);
//SetLocalInt(oPlayer(), sHorn, 1);
object UnlockedSound = GetNearestObjectByTag("WindRmvSnd");
object oObject1 = GetNearestObjectByTag("WindSeal1");
object oObject2 = GetNearestObjectByTag("WindSeal2");
object oObject3 = GetNearestObjectByTag("WindSeal3");
object oObject4 = GetNearestObjectByTag("WindSeal4");
object oObject5 = GetNearestObjectByTag("SealoftheFourWinds");
DestroyObject(oObject1, 0.0 );
DestroyObject(oObject2, 0.1 );
DestroyObject(oObject3, 0.2 );
DestroyObject(oObject4, 0.3 );
DestroyObject(oObject5, 0.5 );
SoundObjectPlay(UnlockedSound);
PlaySound("as_dr_stonvlgcl1");
FloatingTextStringOnCreature("The wall of the four winds has been removed.", oPlayer, FALSE);
AddJournalQuestEntry("TheFourHorns", 5, oPlayer);
RewardPartyXP(750, oPlayer, TRUE);
//DelayCommand(0.5, DestroyObject(OBJECT_SELF));
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SCREEN_SHAKE), OBJECT_SELF);
DestroyObject(UnlockedSound, 4.0 );
}
}
void BlowHorn(string sHorn, string sMessage2)
{
//debug("BlowHorn");
object oPC = GetItemActivator();
object oWindWallWP = GetWaypointByTag("WP_FourWindWall");
float fDistance = GetDistanceBetweenLocations(GetLocation(oPC), GetLocation(oWindWallWP));
if(fDistance < 5.0)
{
//debug("Distance = " + FloatToString(fDistance));
string sMessage1 = "A hollow sound comes from the horn.";
SetLocalInt(oPlayer, GetTag(oActivatedItem), 1);
SetLocalInt(GetLastUsedBy(), sHorn, 1);
// Insert Sound Effect here
// sff_howlmind
AssignCommand(GetItemActivator(), PlaySound("sff_howlmind"));
AssignCommand(GetItemActivator(), ActionSpeakString(sMessage1));
AssignCommand(GetItemActivator(), ActionSpeakString(sMessage2));
//DelayCommand(60.0, SetLocalInt(oWindWallWP, GetTag(oActivatedItem), 0));
}
}
#2
Posté 19 juin 2013 - 08:05
The problem with BlowHorn() is trickier. I suspect that the script is working correctly, but the second message gets spoken so soon after the first message that you don't get to see it on screen. Look in the chat window to see if it shows up there. If that's correct, try DelayCommand-ing the second SpeakString() or changing it to a FloatingTextStringOnCreature().
I cleaned this up a bit if you wanna try to use my edits. Not at a computer with the toolset right now, so I can't confirm whether it works, but it's a step in the right direction.
#include "debug"
#include "nw_i0_tool"
void BlowHorn(string sHorn, string sMessage, object oPC);
void OpenWall(object oPC);
void main()
{
object oPC = GetItemActivator();
object oItem = GetItemActivated();
object oTarget = GetItemActivatedTarget();
string sTag = GetTag(oItem);
ExecuteScript("eb_recall_oa", OBJECT_SELF);
if (sTag == "CreateFoodItem")
{
CreateItemOnObject("food001", oTarget);
CreateItemOnObject("food001", oTarget);
CreateItemOnObject("food001", oTarget);
CreateItemOnObject("food001", oTarget);
SendMessageToPC(oPC, "Food Created");
AssignCommand(oTarget, PlaySound("sca_outholy01"));
effect eVis = EffectVisualEffect(VFX_IMP_HEAD_HEAL);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
}
else if (sTag == "NorthWind")
{
//debug("NorthWind");
AssignCommand(oTarget, PlaySound("as_wt_gustsoft1"));
BlowHorn(sTag, "You feel a cold draft from the north.", oPC);
OpenWall(oPC);
}
else if (sTag == "SouthWind")
{
//debug("SouthWind");
AssignCommand(oTarget, PlaySound("as_wt_gusforst1"));
BlowHorn(sTag, "You feel a warm breeze from the south.", oPC);
OpenWall(oPC);
}
else if (sTag == "EastWind")
{
//debug("EastWind");
AssignCommand(oTarget, PlaySound("as_wt_gustgrass1"));
BlowHorn(sTag, "You feel a slight breeze from the east.", oPC);
OpenWall(oPC);
}
else if (sTag == "WestWind")
{
//debug("WestWind");
AssignCommand(oTarget, PlaySound("as_wt_gustchasm1"));
BlowHorn(sTag, "You feel a gust of wind from the west.", oPC);
OpenWall(oPC);
}
}
void OpenWall(object oPC)
{
//object oWindWallWP = GetWaypointByTag("WP_FourWindWall");
debug("OpenWall");
if (GetLocalInt(oPC, "NorthWind") && GetLocalInt(oPC, "SouthWind") &&
GetLocalInt(oPC, "EastWind") && GetLocalInt(oPC, "WestWind"))
{
SetLocalInt(oPC, "WallIsOpen", 1);
//SetLocalInt(oPC(), sHorn, 1);
object UnlockedSound = GetNearestObjectByTag("WindRmvSnd");
object oObject1 = GetNearestObjectByTag("WindSeal1");
object oObject2 = GetNearestObjectByTag("WindSeal2");
object oObject3 = GetNearestObjectByTag("WindSeal3");
object oObject4 = GetNearestObjectByTag("WindSeal4");
object oObject5 = GetNearestObjectByTag("SealoftheFourWinds");
DestroyObject(oObject1, 0.0);
DestroyObject(oObject2, 0.1);
DestroyObject(oObject3, 0.2);
DestroyObject(oObject4, 0.3);
DestroyObject(oObject5, 0.5);
SoundObjectPlay(UnlockedSound);
PlaySound("as_dr_stonvlgcl1");
FloatingTextStringOnCreature("The wall of the four winds has been removed.", oPC, FALSE);
AddJournalQuestEntry("TheFourHorns", 5, oPC);
RewardPartyXP(750, oPC, TRUE);
//DelayCommand(0.5, DestroyObject(OBJECT_SELF));
effect eVis = EffectVisualEffect(VFX_FNF_SCREEN_SHAKE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF);
DestroyObject(UnlockedSound, 4.0);
}
}
void BlowHorn(string sHorn, string sMessage, object oPC)
{
//debug("BlowHorn");
object oWindWallWP = GetWaypointByTag("WP_FourWindWall");
float fDistance = GetDistanceBetweenLocations(GetLocation(oPC), GetLocation(oWindWallWP));
if (fDistance < 5.0)
{
//debug("Distance = " + FloatToString(fDistance));
SetLocalInt(oPC, sHorn, 1);
// Insert Sound Effect here
// sff_howlmind
AssignCommand(oPC, PlaySound("sff_howlmind"));
FloatingTextStringOnCreature("A hollow sound comes from the horn.", oPC, FALSE);
FloatingTextStringOnCreature(sMessage, oPC, FALSE);
//DelayCommand(60.0, SetLocalInt(oWindWallWP, sHorn, 0));
}
}
Modifié par Squatting Monk, 20 juin 2013 - 07:44 .
#3
Posté 19 juin 2013 - 08:18
#4
Posté 19 juin 2013 - 09:38
Modifié par Dark, 19 juin 2013 - 09:39 .
#5
Posté 20 juin 2013 - 12:18
#6
Posté 20 juin 2013 - 01:04
Anyone seeing anything that might be causing it to need 5 uses?
Modifié par Dark, 20 juin 2013 - 01:05 .
#7
Posté 20 juin 2013 - 01:46
The code looks like it should work. Do you see the blowhorn message all 5 times? Does it matter which horn you use the 5th time?
Put a debug in OpenWall before the if that prints the value of all 4 of those variables. That should tell you something...
#8
Posté 20 juin 2013 - 03:24
As for that commented line for the delay command destroy Object Self. That can’t be used in this variation of the script. This script was modified from an OnDisturbd when I was using it to just place the items in the Seal to remove the wall once the fourth horn was placed inside. Ignore that line please.
Modifié par Dark, 20 juin 2013 - 03:29 .
#9
Posté 20 juin 2013 - 03:53
Yes, you keep saying that as if I'm not hearing you. The questions I asked were directly related to trying to help you debug that very problem.
Do you see the "OpenWall" debug output all 5 times?
#10
Posté 20 juin 2013 - 04:17
Looking over the mod, I’m wondering if the delay commands on the pop up text may also be causing this issue too?
Thank you for your help, I appreciate your feedback.
#11
Posté 20 juin 2013 - 05:22
Can you post your exact code when you get back to the toolset?
#12
Posté 20 juin 2013 - 06:26
And the only thing adding the delays did was allow the second pop up text to appear. I’m most likely going to remove that line. This script works, but it’s not exactly how it should work in terms of the player when the find the horn and use it. They get the wind sound and the text popping up. That should only occur when you are in range of the wall. Otherwise the sound of the horn should just happen not the wind blowing effect.
Here’s the code.
#include "debug"
#include "nw_i0_tool"
void BlowHorn(string sHorn, string sMessage, object oPC);
void OpenWall(object oPC);
void main()
{
object oPC = GetItemActivator();
object oItem = GetItemActivated();
object oTarget = GetItemActivatedTarget();
string sTag = GetTag(oItem);
ExecuteScript("eb_recall_oa", OBJECT_SELF);
if (sTag == "CreateFoodItem")
{
CreateItemOnObject("food001", oTarget);
CreateItemOnObject("food001", oTarget);
CreateItemOnObject("food001", oTarget);
CreateItemOnObject("food001", oTarget);
SendMessageToPC(oPC, "Food Created");
AssignCommand(oTarget, PlaySound("sca_outholy01"));
effect eVis = EffectVisualEffect(VFX_IMP_HEAD_HEAL);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
}
else if (sTag == "NorthWind")
{
//debug("NorthWind");
AssignCommand(oTarget, PlaySound("as_wt_gustsoft1"));
DelayCommand(2.5, BlowHorn(sTag, "You feel a cold draft from the north.", oPC));
OpenWall(oPC);
}
else if (sTag == "SouthWind")
{
//debug("SouthWind");
AssignCommand(oTarget, PlaySound("as_wt_gusforst1"));
DelayCommand(2.5, BlowHorn(sTag, "You feel a warm breeze from the south.", oPC));
OpenWall(oPC);
}
else if (sTag == "EastWind")
{
//debug("EastWind");
AssignCommand(oTarget, PlaySound("as_wt_gustgrass1"));
DelayCommand(2.5, BlowHorn(sTag, "You feel a slight breeze from the east.", oPC));
OpenWall(oPC);
}
else if (sTag == "WestWind")
{
//debug("WestWind");
AssignCommand(oTarget, PlaySound("as_wt_gustchasm1"));
DelayCommand(2.5, BlowHorn(sTag, "You feel a gust of wind from the west.", oPC));
OpenWall(oPC);
}
}
void OpenWall(object oPC)
{
object oWP = GetWaypointByTag("WP_FourWindWall");
debug("OpenWall");
if (GetLocalInt(oPC, "NorthWind") && GetLocalInt(oPC, "SouthWind") &&
GetLocalInt(oPC, "EastWind") && GetLocalInt(oPC, "WestWind"))
{
SetLocalInt(oPC, "WallIsOpen", 1);
object UnlockedSound = GetObjectByTag("WindRmvSnd");
object oObject1 = GetObjectByTag("WindSeal1");
object oObject2 = GetObjectByTag("WindSeal2");
object oObject3 = GetObjectByTag("WindSeal3");
object oObject4 = GetObjectByTag("WindSeal4");
object oObject5 = GetObjectByTag("SealoftheFourWinds");
DestroyObject(oObject1, 0.0);
DestroyObject(oObject2, 0.1);
DestroyObject(oObject3, 0.2);
DestroyObject(oObject4, 0.3);
DestroyObject(oObject5, 0.5);
SoundObjectPlay(UnlockedSound);
PlaySound("as_dr_stonvlgcl1");
FloatingTextStringOnCreature("The wall of the four winds has been removed.", oPC, FALSE);
AddJournalQuestEntry("TheFourHorns", 5, oPC);
RewardPartyXP(750, oPC, TRUE);
effect eShake = EffectVisualEffect(356);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eShake, GetLocation(oWP));
DestroyObject(UnlockedSound, 4.0);
}
}
void BlowHorn(string sHorn, string sMessage, object oPC)
{
//debug("BlowHorn");
object oWindWallWP = GetWaypointByTag("WP_FourWindWall");
float fDistance = GetDistanceBetweenLocations(GetLocation(oPC), GetLocation(oWindWallWP));
if(fDistance < 10.0 && fDistance >= 0.0)
//if (fDistance < 10.0)
{
//debug("Distance = " + FloatToString(fDistance));
SetLocalInt(oPC, sHorn, 1);
// Insert Sound Effect here
// sff_howlmind
AssignCommand(oPC, PlaySound("sff_howlmind"));
DelayCommand(0.0, FloatingTextStringOnCreature("A hollow sound comes from the horn.", oPC, FALSE));
FloatingTextStringOnCreature(sMessage, oPC, FALSE);
//DelayCommand(60.0, SetLocalInt(oWindWallWP, sHorn, 0));
}
}
#13
Posté 20 juin 2013 - 07:14
I only needed to use the horns four times. I would like to keep that last line of pop up text in there, but I may not be able too since its apparently causing issues with it firing off correctly.
Any suggestions?
#14
Posté 20 juin 2013 - 07:55
D'oh! Hazard of scripting in a text editor at work. Fixed now.meaglyn wrote...
Monk's code won't compile as is due to the oPlayer in BlowHorn.
Yeah, that's your problem there: OpenWall() checks for ints that were set by BlowHorn(). This is effectively running OpenWall() before BlowHorn(). If you wanna delay something, delay the OpenWall() call:Dark wrote...
DelayCommand(2.5, BlowHorn(sTag, "You feel a cold draft from the north.", oPC));
OpenWall(oPC);
BlowHorn(sTag, "You feel a cold draft from the north.", oPC); DelayCommand(2.5, OpenWall(oPC));
That shouldn't have anything do do with it. But just to ensure your messages are spaced out enough to see, try setting those two lines like this:Dark wrote...
And removing the pop text from below this one: A hollow sound comes from the horn
I only needed to use the horns four times. I would like to keep that last line of pop up text in there, but I may not be able too since its apparently causing issues with it firing off correctly.
FloatingTextStringOnCreature("A hollow sound comes from the horn.", oPC, FALSE);
DelayCommand(1.0, FloatingTextStringOnCreature(sMessage, oPC, FALSE));
Modifié par Squatting Monk, 20 juin 2013 - 08:16 .
#15
Posté 20 juin 2013 - 08:19
Squatting Monk wrote...
Yeah, that's your problem there: OpenWall() checks for ints that were set by BlowHorn(). This is effectively running OpenWall() before BlowHorn(). If you wanna delay something, delay the OpenWall() call.Dark wrote...
DelayCommand(2.5, BlowHorn(sTag, "You feel a cold draft from the north.", oPC));
OpenWall(oPC);
I was suspecting something like that was going on. You beat me to the punch
#16
Posté 20 juin 2013 - 09:24
If you are still into playing NWN 1 Here is a link to the mod, it’s not released yet, but it will be soon.
I don’t know if you guys are any good at making Cut Scenes, but I could use some help with someone setting up an opening cut scene that’s not to big, and an ending one to finish off the game. If you’re interested please let me know, I could use some help in that dept.
Here’s the link to the site.
http://nwvault.ign.c....Detail&id=6375
#17
Posté 20 juin 2013 - 09:39
Hope to see your mod soon!
#18
Posté 21 juin 2013 - 04:19
If you want to take a crack at the opening scene let me know, I have the script already. its the camera movement that needs to be done. Up to you, please let me know.
Rick





Retour en haut







