EN4_PRC8/_module/nss/htc_enter.nss

105 lines
3.4 KiB
Plaintext
Raw Permalink Normal View History

//#include "x0_i0_henchman"
#include "rd_spawnmobs"
void CreateSpecialMerchant();
void main()
{
object oCreature;
object oGuard;
string sSpirit;
location lLoc;
object oSpirit;
oCreature = GetEnteringObject();
oGuard = GetObjectByTag("en4_cityguard0_1");
if (!GetIsPC(oCreature) && GetIsEnemy(oGuard,oCreature))
{
CreateObject(OBJECT_TYPE_CREATURE,"en4_vguard",GetLocation(oCreature));
}
if (GetIsPC(oCreature))
{
sSpirit = GetLocalString(GetModule(),"FriendlySpirit");
if (GetLocalInt(OBJECT_SELF,"DoOnce") == 0)
{
if (GetLocalInt(GetModule(),"HTC_SpecialMerchant")>0)
CreateSpecialMerchant();
}
SetLocalInt(OBJECT_SELF,"DoOnce",1);
if (sSpirit == GetName(oCreature))
{
lLoc = GetLocation(GetObjectByTag("wp_spirit"));
oSpirit = CreateObject(OBJECT_TYPE_CREATURE,"en3_spiritfriend",lLoc);
AddHenchman(oCreature,oSpirit);
if (GetHitDice(oCreature)>1)
LevelMob(oSpirit,GetHitDice(oCreature)-1);
ActionForceFollowObject(oCreature,3.0);
SetLocalString(GetModule(),"FriendlySpirit","");
SetLocalString(oSpirit,"Master",GetName(oCreature));
}
if (GetIsEnemy(oGuard,oCreature) && (GetLocalInt(oCreature,"EN4EnterOnce") == 1 || GetHitDice(oCreature)>1))
{
//en4_hg4
object oGuard2;
oGuard2=CreateObject(OBJECT_TYPE_CREATURE,"en4_hg1",GetLocation(oCreature));
LevelMob(oGuard2,GetHitDice(oCreature)+Random(4));
EquipMob(oGuard2);
if (Random(2) == 0)
{
oGuard2=CreateObject(OBJECT_TYPE_CREATURE,"en4_hg1",GetLocation(oCreature));
LevelMob(oGuard2,GetHitDice(oCreature)+Random(4));
EquipMob(oGuard2);
} else {
oGuard2=CreateObject(OBJECT_TYPE_CREATURE,"en4_hg2",GetLocation(oCreature));
LevelMob(oGuard2,GetHitDice(oCreature)+Random(4));
EquipMob(oGuard2);
}
if (Random(2) == 0)
{
oGuard2=CreateObject(OBJECT_TYPE_CREATURE,"en4_hg1",GetLocation(oCreature));
LevelMob(oGuard2,GetHitDice(oCreature)+Random(4));
EquipMob(oGuard2);
} else {
oGuard2=CreateObject(OBJECT_TYPE_CREATURE,"en4_hg3",GetLocation(oCreature));
LevelMob(oGuard2,GetHitDice(oCreature)+Random(4));
EquipMob(oGuard2);
}
if (Random(2) == 0)
{
oGuard2=CreateObject(OBJECT_TYPE_CREATURE,"en4_hg1",GetLocation(oCreature));
LevelMob(oGuard2,GetHitDice(oCreature)+Random(4));
EquipMob(oGuard2);
} else {
oGuard2=CreateObject(OBJECT_TYPE_CREATURE,"en4_hg4",GetLocation(oCreature));
LevelMob(oGuard2,GetHitDice(oCreature)+Random(4));
EquipMob(oGuard2);
}
}
if (GetIsEnemy(oGuard,oCreature) && GetLocalInt(oCreature,"EN4EnterOnce") == 0)
SetLocalInt(oCreature,"EN4EnterOnce",1);
if (GetGoodEvilValue(oCreature) < 40 && GetLocalInt(OBJECT_SELF,"SpawnEvilNPC") == 0)
{
object oEvilCheck = GetObjectByTag("en4_evilstarter");
if (!GetIsObjectValid(oEvilCheck))
CreateObject(OBJECT_TYPE_CREATURE,"en4_evilstarter",GetLocation(GetObjectByTag("htc_evilstarter")));
}
}
}
void CreateSpecialMerchant()
{
location lLoc;
lLoc = GetLocation(GetObjectByTag("htc_specialnpc"));
CreateObject(OBJECT_TYPE_CREATURE,"en4_smer",lLoc);
}