Tell me why this script is not firing?
Zephirius
Member Posts: 419
Just want to do an evil check on the PC when he uses the altar...
I get nothing with this, not sure what's going on?
string sSound;
void main()
{
object oPC = GetLastUsedBy();
if (GetIsPC(oPC))
{
return;
}
int nGetAlign = GetAlignmentGoodEvil(oPC);
if (nGetAlign == ALIGNMENT_EVIL)
{
effect eUnholy = EffectVisualEffect(VFX_FNF_LOS_EVIL_10);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eUnholy, oPC);
effect eVFX = EffectVisualEffect(VFX_IMP_HEAD_EVIL);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);
sSound = "gui_learnspell";
AssignCommand(oPC, PlaySound(sSound));
AssignCommand(oPC, ActionSpeakString("You are not penitent!"));
ActionLockObject(OBJECT_SELF);
}
else
{
effect eHoly = EffectVisualEffect(VFX_IMP_HOLY_AID);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHoly, oPC);
}
}
I get nothing with this, not sure what's going on?
0
Comments
You want:
or
Now I just can't figure out why the altar wont unlock?
string sSound; #include "x3_inc_string" void main() { ActionLockObject(OBJECT_SELF); object oPC = GetLastUsedBy(); if (GetIsPC(oPC)) { int nGetAlign = GetAlignmentGoodEvil(oPC); if (nGetAlign == ALIGNMENT_EVIL) { AssignCommand(oPC, ActionLockObject(OBJECT_SELF)); effect eUnholy = EffectVisualEffect(VFX_FNF_LOS_EVIL_10); ApplyEffectToObject(DURATION_TYPE_INSTANT, eUnholy, oPC); effect eVFX = EffectVisualEffect(VFX_IMP_HEAD_EVIL); DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC)); sSound = "gui_learnspell"; AssignCommand(oPC, PlaySound(sSound)); string sChat = "You are not penitent!"; string sString = StringToRGBString(sChat, "770"); ActionSpeakString(sString); } else { AssignCommand(oPC, ClearAllActions(TRUE)); AssignCommand(oPC, SetCommandable(TRUE, oPC)); AssignCommand(oPC, SetLockUnlockDC(OBJECT_SELF, 0)); DelayCommand(0.3, AssignCommand(oPC, ActionUnlockObject(OBJECT_SELF))); effect eHoly = EffectVisualEffect(VFX_IMP_HOLY_AID); DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eHoly, oPC)); string sChat = "You are penitent and worthy to pass...!"; string sString = StringToRGBString(sChat, "770"); ActionSpeakString(sString); } } }... it's in the else part of the script where I can't get it to unlock?
I threw in a bunch of commands that are probable useless, but I'm trying anything... Lol
#include "x3_inc_string" const string csUnHoly = StringToRGBString("You are not penitent!", "770"); const string csHoly = StringToRGBString("You are penitent and worthy to pass...!", "770"); void main() { object oPC = GetLastUsedBy(); string sSound; if(GetIsPC(oPC)) { int nGetAlign = GetAlignmentGoodEvil(oPC); if(nGetAlign == ALIGNMENT_EVIL) { SetLocked(OBJECT_SELF, TRUE); effect eUnholy = EffectVisualEffect(VFX_FNF_LOS_EVIL_10); ApplyEffectToObject(DURATION_TYPE_INSTANT, eUnholy, oPC); effect eVFX = EffectVisualEffect(VFX_IMP_HEAD_EVIL); DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC)); sSound = "gui_learnspell"; PlaySound(sSound); AssignCommand(OBJECT_SELF, SpeakString(csUnHoly)); } else { SetLocked(OBJECT_SELF, FALSE); effect eHoly = EffectVisualEffect(VFX_IMP_HOLY_AID); ApplyEffectToObject(DURATION_TYPE_INSTANT, eHoly, oPC); AssignCommand(OBJECT_SELF, SpeakString(csHoly)); } } }Relying on oPC to actually do the unlocking is quite probably the reason why it fails to unlock because ActionUnlockObject() and ActionLockObject() represents the oPC's use of the 'Open Locks' skill which they may have too few points in. In this case I'm suggesting you try the SetLocked() function instead.
TR
TR