78 lines
2.4 KiB
Plaintext
78 lines
2.4 KiB
Plaintext
/*
|
|
This script goes in the onDeath handler of the creature to spawn a
|
|
40 shop. It will Spawn a Ghost merchant, assign a variable for the
|
|
shops tag, and the boss' name that was killed.
|
|
*/
|
|
//://////////////////////////////
|
|
//:/ Created By : SoulFlame
|
|
//:/ Date : Jan 21, 2005
|
|
//://////////////////////////////
|
|
|
|
#include "nw_i0_spells"
|
|
#include "lod_boss_inc"
|
|
|
|
const int TOKEN_40SHOP = 68555;
|
|
const string SHOP_KEEPER_40 = "sf_40shop_ghost";
|
|
|
|
void main()
|
|
{
|
|
object oDead = OBJECT_SELF, oShopKeep, oShop;
|
|
|
|
// Ensure this is only called once
|
|
int nHasProcessedDeath = GetLocalInt(OBJECT_SELF, "HasProcessedDeath");
|
|
if(nHasProcessedDeath)
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
SetLocalInt(OBJECT_SELF, "HasProcessedDeath", TRUE);
|
|
}
|
|
|
|
string sName = GetName(oDead);
|
|
location lDead = GetLocation(oDead);
|
|
|
|
// Get the resref of the Merchant for this boss.
|
|
string sShopTag = GetLocalString(OBJECT_SELF, "BossShop");
|
|
|
|
// Create Merchant NPC
|
|
oShopKeep = CreateObject(OBJECT_TYPE_CREATURE, SHOP_KEEPER_40, lDead, 1);
|
|
|
|
// Set name of boss
|
|
SetLocalString(oShopKeep, "40Boss", sName);
|
|
|
|
// Create Merchant
|
|
oShop = CreateObject(OBJECT_TYPE_STORE, sShopTag, lDead);
|
|
|
|
// Bind Merchant object to Merchant NPC
|
|
SetLocalObject(oShopKeep, "40ShopMerchant", oShop);
|
|
|
|
string sTokenMsg = "For decades my Soul has been bound to that foul beast. " +
|
|
"For releasing me from the prison within " + sName +
|
|
" you may browse my ancient goods.";
|
|
|
|
SetCustomToken(TOKEN_40SHOP, sTokenMsg);
|
|
|
|
// So that Lolinus death does not cause another boss to spawn.
|
|
if (GetTag(oDead) == "MDG_LOLINUS")
|
|
{
|
|
ExecuteScript("nw_c2_default7", OBJECT_SELF);
|
|
return;
|
|
}
|
|
|
|
SendMessageToAllDMs(sName + " has died, and shop is spawned in " + GetName(GetArea(oDead)));
|
|
|
|
SignalEvent(GetModule(), EventUserDefined(555));
|
|
|
|
/* float fDelay;
|
|
fDelay = GetRandomDelay(30.0, 360.0); //2360
|
|
SendMessageToAllDMs("Random Spawn Delay for respawn is: " + FloatToString(fDelay));
|
|
SendMessageToAllDMs(sName + " has died, and shop is spawned in " + GetName(GetArea(oDead)));
|
|
DelayCommand(fDelay, SendMessageToAllDMs("Random Spawn Monster Time Expired, firing function"));
|
|
DelayCommand(fDelay, SpawnRandomBoss());
|
|
// DelayCommand(fDelay, ExecuteScript("ba_r_randomspawn", OBJECT_SELF)); */
|
|
|
|
ExecuteScript("nw_c2_default7", OBJECT_SELF);
|
|
|
|
}
|