HoS_PRC8/_mod/_module/nss/oe_padlock_act.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

83 lines
2.8 KiB
Plaintext

////////////////////////////////////////////////////////////////////////////////
// padlock_activate_oe
////////////////////////////////////////////////////////////////////////////////
string fnGetCombination()
{
string sRet="";
int nC=1;
object oWP=GetWaypointByTag("ELEMENT_PADLOCK"+IntToString(nC));
while(nC<5)
{
sRet=sRet+IntToString(GetLocalInt(oWP,"nValue"));
nC++;
oWP=GetWaypointByTag("ELEMENT_PADLOCK"+IntToString(nC));
}
return sRet;
}
void fnClearPadlock()
{ // clear the settings
int nC=1;
object oWP;
object oOb;
DeleteLocalInt(GetModule(),"nWitchPadLockC");
oWP=GetWaypointByTag("ELEMENT_PADLOCK"+IntToString(nC));
while(nC<5)
{ // destroy shafts
oOb=GetLocalObject(oWP,"oShaft");
DeleteLocalInt(oWP,"nValue");
DestroyObject(oOb);
DeleteLocalObject(oWP,"oShaft");
nC++;
oWP=GetWaypointByTag("ELEMENT_PADLOCK"+IntToString(nC));
} // destroy shafts
} // clear the settings
void main()
{
object oPC=GetEnteringObject();
object oMod=GetModule();
int nPLC=GetLocalInt(oMod,"nWitchPadLockC");
object oPL;
object oShaft;
int nNum=StringToInt(GetName(OBJECT_SELF));
string sCombo;
effect eE;
if (GetIsPC(oPC)&&nPLC<4)
{ // PC ENTERED THE PADLOCK AREA
nPLC++;
SetLocalInt(oMod,"nWitchPadLockC",nPLC);
oPL=GetWaypointByTag("ELEMENT_PADLOCK"+IntToString(nPLC));
SetLocalInt(oPL,"nValue",nNum);
if (nNum==1) oShaft=CreateObject(OBJECT_TYPE_PLACEABLE,"element1",GetLocation(oPL));
else if (nNum==2) oShaft=CreateObject(OBJECT_TYPE_PLACEABLE,"element2",GetLocation(oPL));
else if (nNum==3) oShaft=CreateObject(OBJECT_TYPE_PLACEABLE,"element3",GetLocation(oPL));
else if (nNum==4) oShaft=CreateObject(OBJECT_TYPE_PLACEABLE,"element4",GetLocation(oPL));
SetLocalObject(oPL,"oShaft",oShaft);
if (nPLC==4)
{ // is a combination done
sCombo=fnGetCombination();
if (sCombo=="3412"||sCombo=="3333"||sCombo=="4242"||sCombo=="1234"||sCombo=="2233")
{ // create portal
oPL=GetWaypointByTag("ELEMENT_DEPART");
oShaft=CreateObject(OBJECT_TYPE_PLACEABLE,"witchportal",GetLocation(oPL));
} // create portal
else
{ // nothing
eE=EffectVisualEffect(VFX_FNF_SCREEN_SHAKE);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eE,oPC,1.0);
fnClearPadlock();
oPL=GetWaypointByTag("ELEMENT_DEPART");
nPLC=d6();
if (nPLC<3) sCombo="beholder005";
else if (nPLC==3) sCombo="air001";
else if (nPLC==4) sCombo="earth001";
else if (nPLC==5) sCombo="fire001";
else if (nPLC==6) sCombo="water001";
oShaft=CreateObject(OBJECT_TYPE_CREATURE,sCombo,GetLocation(oPL));
} // nothing
} // is a combination done
} // PC ENTERED THE PADLOCK AREA
}