Battledale_PRC8/_module/nss/jw_machine2_hb.nss
Jaysyn904 7b9e44ebbb Initial upload
Initial upload.  PRC8 has been added.  Module compiles, PRC's default AI & treasure scripts have been integrated.  Started work on top hak for SLA / Ability / Scripting modifications.
2024-03-11 23:44:08 -04:00

122 lines
2.4 KiB
Plaintext

void main()
{
object oMachine=OBJECT_SELF;
int nStatus=GetLocalInt(oMachine,"nStatus");
if (nStatus<1)
{
SpeakString("Error - please report to DM");
return;
}
int nHP=GetCurrentHitPoints(OBJECT_SELF);
object oMob;
int nMobsexist=0;
string sMob="sMob";
string sCheckstring;
int nRandom;
string sMobtype;
int nMobnumber=1;
string sWP="jw_machine_sp_wp";
int nIdx;
object oBox;
// check to see if our mob already exists
if (GetIsObjectValid(GetLocalObject(OBJECT_SELF,"oMob")))
{
// if one is valid, set nMobsexist to 1
nMobsexist=1;
}
// if the old mob still exists, return
if (nMobsexist==1)
{
return;
}
/// ok, we have no mobs in existence and our status is one or more
// before we do anything else, check if our status is five for the first time
int nDone=GetLocalInt(OBJECT_SELF,"nDone");
if ((nStatus==5)&&(nDone!=1))
{
// make the machine killeable
SetPlotFlag(oMachine,0);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectSpellImmunity(SPELL_ALL_SPELLS),OBJECT_SELF);
// create the lights
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectVisualEffect(VFX_DUR_ANTI_LIGHT_10),oMachine);
for(nIdx = 1; nIdx <= 4; nIdx++)
{
sCheckstring=sWP+IntToString(nIdx);
oBox=CreateObject(OBJECT_TYPE_PLACEABLE,"jw_br_dun_box",GetLocation(GetWaypointByTag(sCheckstring)));
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectVisualEffect(VFX_DUR_ANTI_LIGHT_10),oBox);
}
SoundObjectPlay(GetObjectByTag("jw_br_dun4_snd"));
SetLocalInt(OBJECT_SELF,"nDone",1);
}
switch (nStatus)
{
case 1: sMobtype="jw_bandead_lord";
break;
case 2: sMobtype="jw_baneguard_lord";
break;
case 3: sMobtype="jw_blood_fiend";
break;
case 4: sMobtype="nightwalker";
break;
case 5: sMobtype="jw_deathbringer2";
break;
}
/// create our mob
// decide which waypoint to put it on
nRandom=d4();
sCheckstring=sWP+IntToString(nRandom);
oMob=CreateObject(OBJECT_TYPE_CREATURE,sMobtype,GetLocation(GetWaypointByTag(sCheckstring)));
//// set the mob as our local mob
SetLocalObject(OBJECT_SELF,"oMob",oMob);
// increase our status if it is not already 5
if (nStatus<5)
{
nStatus++;
SetLocalInt(oMachine,"nStatus",nStatus);
}
// apply an effect
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_BEAM_EVIL),oMob,3.0);
}