61 lines
2.0 KiB
Plaintext
61 lines
2.0 KiB
Plaintext
/////////////////////////////////////////////////////////
|
|
//
|
|
// Craftable Natural Resources (CNR) by Festyx
|
|
//
|
|
// Name: cnr_bird_ondeath
|
|
//
|
|
// Desc: The OnDeath handler for birds that drop
|
|
// feathers. Bird/feather pairs are configured
|
|
// in cnr_source_init.
|
|
//
|
|
// Author: David Bobeck 26Mar03
|
|
//
|
|
/////////////////////////////////////////////////////////
|
|
|
|
/*
|
|
Anphillia Changes
|
|
eyesolated: Added method CreateLoot(string sResRef)
|
|
Modified Creation to use CreateLoot method
|
|
*/
|
|
#include "lgs_inc"
|
|
object CreateLoot(string sResRef)
|
|
{
|
|
// Get the location of the dead monster
|
|
location lCorpseLoc = GetLocation(OBJECT_SELF);
|
|
|
|
// Make the corpse NOT fade
|
|
SetIsDestroyable(FALSE, TRUE, FALSE);
|
|
|
|
// Create Blood Stain under the coprse
|
|
object oBlood = CreateObject(OBJECT_TYPE_PLACEABLE, "plc_bloodstain", lCorpseLoc, FALSE);
|
|
|
|
// Create Loot Container on the corpse
|
|
object oLootObject = CreateObject(OBJECT_TYPE_PLACEABLE, "invis_corpse_obj", lCorpseLoc, FALSE, GetTag(OBJECT_SELF));
|
|
SetName(oLootObject, "Dead " + GetName(OBJECT_SELF));
|
|
SetDescription(oLootObject, GetDescription(OBJECT_SELF));
|
|
|
|
// Create the feather in the Loot container
|
|
object oReturn = CreateItemOnObject(sResRef, oLootObject);
|
|
|
|
// Plan for everything to decay
|
|
float fFade = 240.0f;
|
|
object oModule = GetModule();
|
|
ActionWait(fFade);
|
|
DelayCommand(fFade, lgs_ClearInventory(oLootObject));
|
|
DelayCommand(fFade, lgs_ClearInventory(OBJECT_SELF));
|
|
DelayCommand(fFade + 0.25f, DestroyObject(oLootObject));
|
|
DelayCommand(fFade + 0.25f, DestroyObject(oBlood));
|
|
DelayCommand(fFade + 1.0f, SetIsDestroyable(TRUE,TRUE,FALSE));
|
|
DelayCommand(fFade + 1.5f, DestroyObject(OBJECT_SELF));
|
|
|
|
return oReturn;
|
|
}
|
|
|
|
void main()
|
|
{
|
|
location locDeath = GetLocation(OBJECT_SELF);
|
|
string sBirdTag = GetTag(OBJECT_SELF);
|
|
string sFeatherTag = GetLocalString(GetModule(), sBirdTag + "_FeatherTag");
|
|
CreateLoot(sFeatherTag); // *CnR Original: CreateObject(OBJECT_TYPE_ITEM, sFeatherTag, locDeath, FALSE);
|
|
}
|