DysoForums Forum Index DysoForums
 
GalleryGallery   Donate to DysotopiaDonate   Dysotopia.com homepageDyso.com
SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStats   RegisterRegister 
 Login to check your private messagesLogin to check your private messages   LoginLogin 

monster corpses

 
Post new topic   Reply to topic    DysoForums Forum Index -> Help
View previous topic :: View next topic :: Hide signatures  
Author Message
Shadowleaf
Hero


Joined: 14 Jan 2003
Posts: 634

Level: 23
XP
EXP: 1 / 65 EXP: 1 / 65 EXP: 1 / 65
 1%
PostPosted: Mon Apr 14, 2003 10:08 pm    Post subject: monster corpses Reply with quote

howd you guys do it on dyso? i need it for the mod im making. how do u make a monster leave a corpse and can a PC do it too and also go somewhere else and walk about?
_________________
Glorin wrote:
Marine you are such a great guy, i hope you don't get hit by a truck one day!!
Back to top
View users profile Send private message Send email AIM Address MSN Messenger
RedStorm
Elder


Joined: 30 Nov 2002
Posts: 927

Level: 27
XP
EXP: 10 / 83 EXP: 10 / 83 EXP: 10 / 83
 12%
PostPosted: Wed Apr 16, 2003 8:05 pm    Post subject: Reply with quote

il give you the scripts,its a system made by some one,BUT the monster will drop all he carrys icon_cry.gif
Ok
[Copy Paste! icon_biggrin.gif ]
OKAY! After waaaaaaaaaaaaaaay too many additional hours on this tonight, I think the new version is ready.

In addition to the scripts below, you need to create your INVISIBLE CORPSE OBJECT. This object absolutely MUST have the Blueprint ResRef of invis_corpse_obj . The details that I use at home are:

Name: corpse
Tag: invis_corpse_obj
Blueprint ResRef: invis_corpse_obj

Now set the following flags: PLOT, HAS INVENTORY, USEABLE (put checks in all 3 boxes)

After you create the scripts, you will attach 2 of them to this object thusly:
onCLose/onOpen Script: _kb_corpse_sound
onDisturbed Script: _kb_ondist_loot

The last script, the big one: _kb_loot_corpse will go either in the onSawn or onDeath events of your creatures. You CAN use this script in place of the normal onDeath script (nw_c2_default7) which it includes. Please read the comments in the script for more info - or drop me a note.

SOME FINAL NOTES
The onDisturbed script is not quite as sure fire as my old onHeartbeat, but I believe that the savings in CPU cycles is probably worth it. If you DON'T use the Drop Weapons feature, the Empties do a pretty good job of cleaning themselves up. If you DO use the drop weapons feature and your Players empty the chest without picking up the weapons or before they pick up the weapons... the Empties will hang out for the delay before decaying - just as if they had inventories. I will be trying to find a better way to manage this, but it is workable for now. I would suggest that multi-party servers or PW-ish servers concerned about system resources NOT use the weapon drop, OR set your delay for a relatively short period of time (the auto decay/fade WILL cleanup the weapons if they are left lying around).

The _kb_corpse_sound script is WEAK. I just wanted a little something to mask that aweful door sound. Unfortunately, it appears that any object that does not have its own OPEN/CLOSE sound that you give inventory will default to that DOOR sound set. Yuck.

I now there was at least one more thing I wanted to cover... but I'm fragged. I'm going to get some sleep. Enjoy!

Here are the scripts:


HERE IS THE NEW ONDISTURBED SCRIPT
***********
////////////////////////////////////////////////////////////////////////////////
// // //
// _kb_ondist_loot // VERSION 1.0 //
// // //
// by Keron Blackfeld on 07/17/2002 ////////////////////////////
// //
// email Questions and Comments to: keron@broadswordgaming.com or catch me //
// in Bioware's NWN Community - Builder's NWN Scripting Forum //
// //
////////////////////////////////////////////////////////////////////////////////
// //
// This is an OnDisturbed Script to go with my _kb_loot_corpse script for //
// LOOTABLE MONSTER/NPC CORPSES. If you were using my _kb_ohb_lootable, be //
// sure to remove that script from the onHeartbeat of your lootable, the //
// "invis_corpse_obj" placeable. //
// //
// PLACE THIS SCRIPT IN THE ONDISTURBED EVENT OF YOUR "invis_corpse_obj" //
// BLUEPRINT. This script checks the inventory of OBJECT_SELF, and when it //
// is empty, it checks the LocalInt to see if the now empty corpse should //
// be Destroyed along with the Lootable Corpse Object. This script will also //
// checks to see if it should clear corpse inventory prior to fading in //
// order to prevent a lootbag from appearing. If the inventory is NOT empty, //
// it checks to see if the ARMOUR is removed from itself, and if so, it //
// destroys the Original Armour on the corpse. //
// //
// The _kb_loot_corpse script must have this line: //
// int nKeepEmpties = FALSE; //
// in order for the Empty Corpse to Destroy itself in this script. //
// //
////////////////////////////////////////////////////////////////////////////////

/*******************************************
** This function is used to clear the **
** entire inventory of an object **
*******************************************/
void ClearInventory(object oCorpse)
{
int nAmtGold = GetGold(oCorpse); //Get any gold from the dead creature
if(nAmtGold) TakeGoldFromCreature(nAmtGold, oCorpse, TRUE);
//Get any loot the dead creature has equipped - thanks again to the HCR for strip-equiped
DestroyObject(GetItemInSlot(INVENTORY_SLOT_ARMS, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_ARROWS, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_BELT, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_BOLTS, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_BOOTS, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_BULLETS, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_CLOAK, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_HEAD, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_LEFTRING, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_NECK, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_CHEST, oCorpse));
//Get the remaining loot from the dead creature and move it to the lootable object
object oLootEQ = GetFirstItemInInventory(oCorpse);
while(GetIsObjectValid(oLootEQ))
{
DestroyObject(oLootEQ);
oLootEQ = GetNextItemInInventory(oCorpse);
}
}

/*******************************************
** This function checks to see if our **
** corpses discarded weapons have been **
** picked up. If so, it returns TRUE. **
*******************************************/
int CheckWeapons(object oCorpse)
{
//Check to see if a Anyone Possesses the Left Weapon
object oLeftWpn = GetLocalObject(oCorpse, "oLeftWpn");
object oLeftTest = GetItemPossessor(oLeftWpn);
//Check to see if a Anyone Possesses the Right Weapon
object oRightWpn = GetLocalObject(oCorpse, "oRightWpn");
object oRightTest = GetItemPossessor(oRightWpn);
if (oLeftWpn == OBJECT_INVALID && oRightWpn == OBJECT_INVALID)
{
return TRUE;
}
else
{
if (oLeftTest != OBJECT_INVALID && oLeftTest != OBJECT_INVALID)
{
return TRUE;
}
else
{
return FALSE;
}
}
}

/*******************************************
** Here is our main script, which is **
** fired if the Inventory is disturbed. **
** It then checks to see if it needs to **
** either clean up the corpse or Destroy **
** the original suit of armour still on **
** the corpse. **
*******************************************/
void main()
{
//Get all of our required information
object oInvDisturbed = GetInventoryDisturbItem(); //Get item that was disturbed to trigger event
int nInvDistType = GetInventoryDisturbType(); //Get type of inventory disturbance
object oHostCorpse = GetLocalObject(OBJECT_SELF, "oHostBody"); //Get Value set by _kb_loot_corpse at creation
object oCorpseBlood = GetLocalObject(OBJECT_SELF, "oBloodSpot"); //Get Value set by _kb_loot_corpse at creation
object oOrigArmour = GetLocalObject(OBJECT_SELF, "oOrigArmour"); //Get Value set by _kb_loot_corpse at creation
object oLootArmour = GetLocalObject(OBJECT_SELF, "oLootArmour"); //Get Value set by _kb_loot_corpse at creation

object oHasInventory = GetFirstItemInInventory(OBJECT_SELF); //Check for inventory
if (oHasInventory == OBJECT_INVALID && CheckWeapons(oHostCorpse)) //If no inventory found and Weapons have been claimed
{
/*******************************************
** Inventory is empty. Now we check the **
** nKeepEmpty value. **
*******************************************/
int nKeepEmpty = GetLocalInt(OBJECT_SELF, "oKeepEmpty"); //Get Value set by _kb_loot_corpse at creation
if (!nKeepEmpty)
{
/*******************************************
** nKeepEmpty is FALSE. Delete empty. **
*******************************************/
ClearInventory(oHostCorpse);
AssignCommand(oHostCorpse,SetIsDestroyable(TRUE,FALSE,FALSE)); //Set actual corpse to destroyable
DestroyObject(oHostCorpse); //Delete the actual Creature Corpse
DestroyObject(oCorpseBlood); //Delete the BloodSpot
DelayCommand(1.0f,DestroyObject(OBJECT_SELF)); //Delete Lootable Object (Self)
}
}
else
{
/*******************************************
** If not empty, check to see if armour **
** has been removed from corpse. **
*******************************************/
if (oInvDisturbed == oLootArmour && nInvDistType == INVENTORY_DISTURB_TYPE_REMOVED)
{
/*******************************************
** The Armour is gone - destroy original **
** armour still showing on corpse. **
*******************************************/
DestroyObject(oOrigArmour);
}
}
}
***********

HERE'S THE VERY WEAK DOOR-SOUND-MASKING SCRIPT
***********
////////////////////////////////////////////////////////////////////////////////
// // //
// _kb_corpse_sound // VERSION 1.0 //
// // //
// by Keron Blackfeld on 07/17/2002 ////////////////////////////
// //
// email Questions and Comments to: keron@broadswordgaming.com or catch me //
// in Bioware's NWN Community - Builder's NWN Scripting Forum //
// //
////////////////////////////////////////////////////////////////////////////////
// //
// This script is a simple, albeit weak, attempt to mask the default DOOR //
// sounds tied to the invisible lootable object. Please this in both the //
// onOpened and onClosed Events of the "invis_corpse_obj" described in my //
// _kb_lootable_corpse script. //
// //
////////////////////////////////////////////////////////////////////////////////

void main()
{
effect eQuiet = EffectSilence();
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eQuiet, OBJECT_SELF, 120.0f);
PlaySound("it_armorleather");
DelayCommand(0.2f, PlaySound("it_materialsoft"));
DelayCommand(0.3f, PlaySound("it_armorleather"));
DelayCommand(0.4f, PlaySound("it_materialsoft"));
DelayCommand(0.5f, PlaySound("it_armorleather"));

}
***********

HERE'S THE MAIN SCRIPT
***********
////////////////////////////////////////////////////////////////////////////////
// // //
// _kb_loot_corpse // VERSION 1.5 //
// // //
// by Keron Blackfeld on 07/13/2002 ////////////////////////////
// update on 07/17/2002 //
// email Questions and Comments to: keron@broadswordgaming.com or catch me //
// in Bioware's NWN Community - Builder's NWN Scripting Forum //
// //
////////////////////////////////////////////////////////////////////////////////
// //
// RELATED SCRIPTS REQUIRED FOR FULL FUNCTIONALITY: //
// _kb_ondist_loot //
// _kb_corpse_sound //
// //
// //
// THE ONLY OTHER THING NEEDED for this script to work is a custom PLACEABLE //
// INVISIBLE OBJECT with a Blueprint ResRef of "invis_corpse_obj". Also, set //
// its name to "corpse" or something equally appropriate - this will be the //
// TEXT your players see when they put their mouse over the body. You will //
// put the accompanying script, _kb_ondist_loot, into that object's //
// onDisturbed Event. If you so desire, you may also place the //
// _kb_corpse_sound script into the onOpened and onClosed Events of the //
// object to help mask the default "DOOR" sounds that are apparently tied //
// automatically to any object that doesn't have an OPEN/CLOSE sound of its //
// own. If you have a better fix for this, PLEASE LET ME KNOW! //
// //
// This script can perform its functions in two ways. //
// //
// #1 PLACED IN THE onDeath EVENT: If used in place of or added to the //
// onDeath script of any creature, it will keep their corpse from decaying //
// for either a delayed period (set in this script) or until the module is //
// closed. It then creates an invisible corpse object under the body that //
// may be clicked for looting. //
// //
// #2 PLACED IN THE onSpawn EVENT: If the creature's tag is set so that it //
// starts with the string 'Dead' and this script is used in the onSpawn //
// event, it will kill the creature at spawn, preserve the corpse, and add //
// an invisible, lootable corpse object (as in #1). This functionality gives //
// you placeable, lootable corpses of all types. Please note tha by default //
// this script is set to override the Corpse Fade and Keep Empties on placed //
// 'Dead' creatures (or creatures that are "Spawned Dead"). This may be //
// changed by setting nOverrideForPlacedCorpses = TRUE; in the beginning of //
// the script. //
// //
////////////////////////////////////////////////////////////////////////////////

#include "NW_I0_GENERIC"
/*******************************************************************************
** This script was borrowed from the Hard Core Ruleset, where they use it to **
** move a Dead PC's inventory to a lootable corpse object. Credit where **
** credit is due, I always say. icon_smile.gif **
*******************************************************************************/
void strip_equiped(object oDeadNPC, object oLootCorpse, object oEquip)
{
if(GetIsObjectValid(oEquip))
{
AssignCommand(oLootCorpse, ActionTakeItem(oEquip, oDeadNPC));
}
}

/*******************************************************************************
** SPECIAL THANKS TO DREZDAR AND MOJO for their help in getting these two **
** drop weapon scripts written. I never would have gotten the vectors right, **
** but THEY sure did! **
*******************************************************************************/
void DropLeftWeapon(object oDeadNPC)
{
object oLeftWpn = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oDeadNPC);

if(GetIsObjectValid(oLeftWpn))
{
vector vCorpseLoc = GetPositionFromLocation(GetLocation(oDeadNPC));
float fDifferential = 45.0f + IntToFloat(d20());
float fDistance = 0.5f + (IntToFloat(d10())/10);
float fVarWpnFace = -20.0f - IntToFloat(d20(2));
float fFacing = GetFacing(oDeadNPC);
fFacing = fFacing + fDifferential;
if (fFacing > 360.0f)
{ fFacing = 720.0f - fFacing; }
if (fFacing < 0.0f)
{ fFacing = 360.0f + fFacing; }
float fWpnFacing = GetFacing(oDeadNPC) + fVarWpnFace;
object oArea = GetArea(oDeadNPC);
//Generate New Location
float fNewX;
float fNewY;
float fNewZ;
if ((fFacing > 0.0f) && (fFacing < 90.0f))
{ fNewX = vCorpseLoc.x + ((cos(fFacing))*fDistance); fNewY = vCorpseLoc.y + ((sin(fFacing))*fDistance); fNewZ = vCorpseLoc.z; }
else if ((fFacing > 90.0f) && (fFacing < 180.0f))
{ fNewX = vCorpseLoc.x - ((cos(180.0f - fFacing))*fDistance); fNewY = vCorpseLoc.y + ((sin(180.0f - fFacing))*fDistance); fNewZ = vCorpseLoc.z; }
else if ((fFacing > 180.0f) && (fFacing < 270.0f))
{ fNewX = vCorpseLoc.x - ((cos(fFacing - 180.0f))*fDistance); fNewY = vCorpseLoc.y - ((sin(fFacing - 180.0f))*fDistance); fNewZ = vCorpseLoc.z; }
else if ((fFacing > 270.0f) && (fFacing < 360.0f))
{ fNewX = vCorpseLoc.x + ((cos(360.0f - fFacing))*fDistance); fNewY = vCorpseLoc.y - ((sin(360.0f - fFacing))*fDistance); fNewZ = vCorpseLoc.z; }
else if (fFacing == 0.0f)
{ fNewX = vCorpseLoc.x + fDistance; fNewY = vCorpseLoc.y; fNewZ = vCorpseLoc.z; }
else if (fFacing == 90.0f)
{ fNewX = vCorpseLoc.x; fNewY = vCorpseLoc.y + fDistance; fNewZ = vCorpseLoc.z; }
else if (fFacing == 180.0f)
{ fNewX = vCorpseLoc.x - fDistance; fNewY = vCorpseLoc.y; fNewZ = vCorpseLoc.z; }
else if (fFacing == 270.0f)
{ fNewX = vCorpseLoc.x; fNewY = vCorpseLoc.y - fDistance; fNewZ = vCorpseLoc.z; }
vector vNewFinal = Vector(fNewX, fNewY, fNewZ);
location lDropLeft = Location(oArea, vNewFinal, fFacing);
//Drop Weapon
string sLeftWpnTag = GetStringLeft(GetTag(oLeftWpn), 16);
DestroyObject(oLeftWpn);
object oLeftWpn = CreateObject(OBJECT_TYPE_ITEM, sLeftWpnTag, lDropLeft, FALSE);
AssignCommand(oLeftWpn, SetFacing(fWpnFacing));
SetLocalObject(oDeadNPC, "oLeftWpn", oLeftWpn);
}
}
//
void DropRightWeapon(object oDeadNPC)
{
object oRightWpn = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oDeadNPC);

if(GetIsObjectValid(oRightWpn))
{
vector vCorpseLoc = GetPositionFromLocation(GetLocation(oDeadNPC));
float fDifferential = -45.0f + IntToFloat(d20());
float fDistance = 0.5f + (IntToFloat(d10())/10);
float fVarWpnFace = 20.0f - IntToFloat(d20(2));
float fFacing = GetFacing(oDeadNPC);
fFacing = fFacing + fDifferential;
if (fFacing > 360.0f)
{ fFacing = 720.0f - fFacing; }
if (fFacing < 0.0f)
{ fFacing = 360.0f + fFacing; }
float fWpnFacing = GetFacing(oDeadNPC) + fVarWpnFace;
object oArea = GetArea(oDeadNPC);
//Generate New Location
float fNewX;
float fNewY;
float fNewZ;
if ((fFacing > 0.0f) && (fFacing < 90.0f))
{ fNewX = vCorpseLoc.x + ((cos(fFacing))*fDistance); fNewY = vCorpseLoc.y + ((sin(fFacing))*fDistance); fNewZ = vCorpseLoc.z; }
else if ((fFacing > 90.0f) && (fFacing < 180.0f))
{ fNewX = vCorpseLoc.x - ((cos(180.0f - fFacing))*fDistance); fNewY = vCorpseLoc.y + ((sin(180.0f - fFacing))*fDistance); fNewZ = vCorpseLoc.z; }
else if ((fFacing > 180.0f) && (fFacing < 270.0f))
{ fNewX = vCorpseLoc.x - ((cos(fFacing - 180.0f))*fDistance); fNewY = vCorpseLoc.y - ((sin(fFacing - 180.0f))*fDistance); fNewZ = vCorpseLoc.z; }
else if ((fFacing > 270.0f) && (fFacing < 360.0f))
{ fNewX = vCorpseLoc.x + ((cos(360.0f - fFacing))*fDistance); fNewY = vCorpseLoc.y - ((sin(360.0f - fFacing))*fDistance); fNewZ = vCorpseLoc.z; }
else if (fFacing == 0.0f)
{ fNewX = vCorpseLoc.x + fDistance; fNewY = vCorpseLoc.y; fNewZ = vCorpseLoc.z; }
else if (fFacing == 90.0f)
{ fNewX = vCorpseLoc.x; fNewY = vCorpseLoc.y + fDistance; fNewZ = vCorpseLoc.z; }
else if (fFacing == 180.0f)
{ fNewX = vCorpseLoc.x - fDistance; fNewY = vCorpseLoc.y; fNewZ = vCorpseLoc.z; }
else if (fFacing == 270.0f)
{ fNewX = vCorpseLoc.x; fNewY = vCorpseLoc.y - fDistance; fNewZ = vCorpseLoc.z; }
vector vNewFinal = Vector(fNewX, fNewY, fNewZ);
location lDropRight = Location(oArea, vNewFinal, fFacing);
//Drop Weapon
string sRightWpnTag = GetStringLeft(GetTag(oRightWpn), 16);
DestroyObject(oRightWpn);
object oRightWpn = CreateObject(OBJECT_TYPE_ITEM, sRightWpnTag, lDropRight, FALSE);
AssignCommand(oRightWpn, SetFacing(fWpnFacing));
SetLocalObject(oDeadNPC, "oRightWpn", oRightWpn);
}
}

/*******************************************************************************
** This script checks to see if the weapons are still unclaimed. If it finds **
** that they are not possessed by someone, it issues the DestroyObjects to **
** eliminate them. **
*******************************************************************************/
void DestroyWeapons(object oCorpse)
{
//Check to see if a PC Possesses the Left Weapon
object oLeftWpn = GetLocalObject(oCorpse, "oLeftWpn");
object oLeftTest = GetItemPossessor(oLeftWpn);
if (oLeftTest == OBJECT_INVALID) DestroyObject(oLeftWpn);
//Check to see if a PC Possesses the Right Weapon
object oRightWpn = GetLocalObject(oCorpse, "oRightWpn");
object oRightTest = GetItemPossessor(oRightWpn);
if (oLeftTest == OBJECT_INVALID) DestroyObject(oRightWpn);
}

/*******************************************************************************
** This script is derived from the one above borrowed from the Hard Core **
** Ruleset. It sweeps an objects inventory (all but Creature Slots, which **
** have no bearing here) so that when the object is destroyed no Lootbags **
** are left behind to litter up the landscape & devour system resources. **
*******************************************************************************/
void ClearInventory(object oCorpse)
{
int nAmtGold = GetGold(oCorpse); //Get any gold from the dead creature
if(nAmtGold) TakeGoldFromCreature(nAmtGold, oCorpse, TRUE);
//Get any loot the dead creature has equipped - thanks again to the HCR for strip-equiped
DestroyObject(GetItemInSlot(INVENTORY_SLOT_ARMS, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_ARROWS, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_BELT, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_BOLTS, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_BOOTS, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_BULLETS, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_CLOAK, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_HEAD, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_LEFTRING, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_NECK, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oCorpse));
DestroyObject(GetItemInSlot(INVENTORY_SLOT_CHEST, oCorpse));
//Get the remaining loot from the dead creature and move it to the lootable object
object oLootEQ = GetFirstItemInInventory(oCorpse);
while(GetIsObjectValid(oLootEQ))
{
DestroyObject(oLootEQ);
oLootEQ = GetNextItemInInventory(oCorpse);
}
}

void main()
{
//SET YOUR ARMOUR, WEAPONS/SHIELD, BLOOD, CORPSE FADE, KEEP EMPTY, AND SPAWNED DEAD OVERRIDE PREFERENCES HERE ///////////////
// //
int nCopyArmour = TRUE; // This will use the TAG to guess the ResRef for creating a copy of the Armour //
int nMoveArmour = FALSE; // Setting this TRUE will just move the armour from the Chest Slot //
int nDropWeapons = TRUE; // This will use the TAG to guess the ResRef for dropping the weapons on the ground //
int nMoveWeapons = FALSE; // Setting this TRUE will just move the weapons to the Lootable Object //
int nUseBlood = TRUE; // Set this to TRUE if you want a Bloodspot to appear under the corpse //
int nCorpseFade = 0120; // Set this to 0 (ZERO) if you DO NOT want the corpses to fade //
int nKeepEmpties = TRUE; // Set this to FALSE if you want EMPTY corpses to fade immediately //
int nOverrideForPlacedCorpses = TRUE; //Set this to TRUE if you want the 'Spawned Corpses' you //
// //place to be permament. Setting it to FALSE will cause //
// //your Placed Dead creatures to act as the settings above dictate. //
// //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//ALTER THE FOLLOWING AT YOUR OWN RISK icon_smile.gif
object oDeadNPC = OBJECT_SELF; //Get the Dead Creature Object
string sBaseTag = GetTag(oDeadNPC); //Get that TAG of the dead creature
string sPrefix = GetStringLeft(sBaseTag, 4); //Look for Dead Prefix

int nKillMe;
if (sPrefix == "Dead") //Do Spawned Cropse
{
nKillMe = 1; //Set nKillMe to 1 if you need this creature to 'spawn dead'
}
else //Do Default On Death Functions from Bioware Script: nw_c2_default7
{
int nClass = GetLevelByClass(CLASS_TYPE_COMMONER);
int nAlign = GetAlignmentGoodEvil(OBJECT_SELF);
if(nClass > 0 && (nAlign == ALIGNMENT_GOOD || nAlign == ALIGNMENT_NEUTRAL))
{
object oKiller = GetLastKiller();
AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5);
}

SpeakString("NW_I_AM_DEAD", TALKVOLUME_SILENT_TALK);
//Shout Attack my target, only works with the On Spawn In setup
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
if(GetSpawnInCondition(NW_FLAG_DEATH_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1007));
}
}

location lCorpseLoc = GetLocation(oDeadNPC); //Set the spawnpoint for our lootable object

//Do 'spawned corpse' if desired
if(nKillMe)
{
//Set up and Deliver our Death Blow
/* this is only needed if you need this
creature to SPAWN as a corpse. */
effect eDamage = EffectDamage(1000); //Set up for the kill
ApplyEffectToObject (DURATION_TYPE_INSTANT, eDamage, oDeadNPC); //Deliver the killing effect
if (nOverrideForPlacedCorpses)
{
nKeepEmpties = TRUE; //Set 'Spawned Dead' corpses to Keep Empties
nCorpseFade = 0; //Disable Corpse Fade for 'Spawned Dead' corpses
}
}

SetIsDestroyable(FALSE,TRUE,FALSE); //Protect our corpse from decaying
object oCorpseBlood;
if (nUseBlood)
{
oCorpseBlood = CreateObject(OBJECT_TYPE_PLACEABLE, "plc_bloodstain", lCorpseLoc, FALSE); //Spawn some blood for effect (if nUseBlood == TRUE)
}
object oLootCorpse = CreateObject(OBJECT_TYPE_PLACEABLE, "invis_corpse_obj", lCorpseLoc, FALSE); //Spawn our lootable object
SetLocalObject(oLootCorpse, "oHostBody", oDeadNPC); //Set Local for deletion later if needed
SetLocalObject(oLootCorpse, "oBloodSpot", oCorpseBlood); //Set Local for deletion later if needed
SetLocalInt(oLootCorpse, "oKeepEmpty", nKeepEmpties); //Set Local for deletion later if needed

//Get DEAD CREATURE'S INVENTORY
int nAmtGold = GetGold(oDeadNPC); //Get any gold from the dead creature
if(nAmtGold)
{
object oGold = CreateItemOnObject("nw_it_gold001", oLootCorpse, nAmtGold);
AssignCommand(oLootCorpse,TakeGoldFromCreature(nAmtGold,oDeadNPC,TRUE));
}
//Get any loot the dead creature has equipped - thanks again to the HCR for strip-equiped
strip_equiped(oDeadNPC, oLootCorpse, GetItemInSlot(INVENTORY_SLOT_ARMS, oDeadNPC));
strip_equiped(oDeadNPC, oLootCorpse, GetItemInSlot(INVENTORY_SLOT_ARROWS, oDeadNPC));
strip_equiped(oDeadNPC, oLootCorpse, GetItemInSlot(INVENTORY_SLOT_BELT, oDeadNPC));
strip_equiped(oDeadNPC, oLootCorpse, GetItemInSlot(INVENTORY_SLOT_BOLTS, oDeadNPC));
strip_equiped(oDeadNPC, oLootCorpse, GetItemInSlot(INVENTORY_SLOT_BOOTS, oDeadNPC));
strip_equiped(oDeadNPC, oLootCorpse, GetItemInSlot(INVENTORY_SLOT_BULLETS, oDeadNPC));
strip_equiped(oDeadNPC, oLootCorpse, GetItemInSlot(INVENTORY_SLOT_CLOAK, oDeadNPC));
strip_equiped(oDeadNPC, oLootCorpse, GetItemInSlot(INVENTORY_SLOT_HEAD, oDeadNPC));
strip_equiped(oDeadNPC, oLootCorpse, GetItemInSlot(INVENTORY_SLOT_LEFTRING, oDeadNPC));
strip_equiped(oDeadNPC, oLootCorpse, GetItemInSlot(INVENTORY_SLOT_NECK, oDeadNPC));
strip_equiped(oDeadNPC, oLootCorpse, GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oDeadNPC));
//Handle Weapons
if (nDropWeapons)
{
//Drop Weapons
DropLeftWeapon(oDeadNPC);
object oCLWpn = GetLocalObject(oDeadNPC, "oLeftWpn");
SetLocalObject(oLootCorpse, "oLeftWpn", oCLWpn);
DropRightWeapon(oDeadNPC);
object oCRWpn = GetLocalObject(oDeadNPC, "oRightWpn");
SetLocalObject(oLootCorpse, "oRightWpn", oCRWpn);
}
if (nMoveWeapons)
{
//Move Weapons
strip_equiped(oDeadNPC, oLootCorpse, GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oDeadNPC));
strip_equiped(oDeadNPC, oLootCorpse, GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oDeadNPC));
}

//Handle Armour
if(nMoveArmour)
{
strip_equiped(oDeadNPC, oLootCorpse, GetItemInSlot(INVENTORY_SLOT_CHEST, oDeadNPC));
}

if(nCopyArmour)
{
object oArmour = GetItemInSlot(INVENTORY_SLOT_CHEST, oDeadNPC);
string sArmourTag = GetStringLeft(GetTag(oArmour), 16);
object oLootArmour = CreateItemOnObject(sArmourTag, oLootCorpse);
SetLocalObject(oLootCorpse, "oOrigArmour", oArmour);
SetLocalObject(oLootCorpse, "oLootArmour", oLootArmour);
}
//Get the remaining loot from the dead creature and move it to the lootable object
object oLootEQ = GetFirstItemInInventory(oDeadNPC);
while(GetIsObjectValid(oLootEQ))
{
AssignCommand(oLootCorpse, ActionTakeItem(oLootEQ, oDeadNPC));
oLootEQ = GetNextItemInInventory(oDeadNPC);
}

//Do Corpse Fade out after specified delay (unless flagged 0)
if (nCorpseFade > 0)
{
float fCorpseFade = IntToFloat(nCorpseFade);
ActionWait(fCorpseFade);
DelayCommand(fCorpseFade, ClearInventory(oLootCorpse));
DelayCommand(fCorpseFade, ClearInventory(oDeadNPC));
DelayCommand(fCorpseFade, DestroyObject(oLootCorpse));
DelayCommand(fCorpseFade, DestroyObject(oCorpseBlood));
DelayCommand(fCorpseFade, DestroyWeapons(oDeadNPC));
DelayCommand(fCorpseFade + 1.0f, SetIsDestroyable(TRUE,TRUE,FALSE));
DelayCommand(fCorpseFade + 1.5f, DestroyObject(oDeadNPC));
}
}
***********

I'm planning at least one more revision, so if you think something else would be handy to have in here, please let me know.

Oh... I'm thinking that the main script would be better handled in a UserDefinedEvent... (as someone on the Bioware Forums suggested) ,but I haven't really messed with those. I'm planning to learn more about them before the next revision... which will include, if nothing else, some kind of filter so you can set certain inventory items to NOT drop into the lootable corpse (because setting the dropable flag currently does NOT stop items from being moved into the lootable corpse).

GOODNIGHT! :yawn:
[End of the mighty copy paste!]
_________________
Cain Darkwind- Priest Of Helm
Raziel- Drow Assassin
Press here ^.^: http://go.everwars.com/play.x?p=47594
Back to top
View users profile Send private message AIM Address MSN Messenger
Shadowleaf
Hero


Joined: 14 Jan 2003
Posts: 634

Level: 23
XP
EXP: 1 / 65 EXP: 1 / 65 EXP: 1 / 65
 1%
PostPosted: Wed Apr 16, 2003 8:21 pm    Post subject: Reply with quote

that wont help but its cool. i needed something for PCs so like you die and go the the afterlife BUT you leave a corpse so u can be raised. IMHO the respawn thing where u get back without res is too unrealistic so im gonna make it so u have to be raised and ill have NPCs that have a chance to appear and res u so u dont have to wait for a PC. so anyway, i want it so a PC leaves a corpse and also gets sent to an afterlife where they can walk around but the corpse remains where they died. anyone know how to do this?
_________________
Glorin wrote:
Marine you are such a great guy, i hope you don't get hit by a truck one day!!
Back to top
View users profile Send private message Send email AIM Address MSN Messenger
RedStorm
PostWed 04/16/03 8:35pm
Ohhh sorry,i havent been in dyso for some quite time so how can i know?,but anyway its based the same,try to change it!  Reply with quote
 
Shadowleaf
Hero


Joined: 14 Jan 2003
Posts: 634

Level: 23
XP
EXP: 1 / 65 EXP: 1 / 65 EXP: 1 / 65
 1%
PostPosted: Wed Apr 16, 2003 8:49 pm    Post subject: Reply with quote

no i wasnt saying u leave a corpse on dyso when u die. thats what i wanna do for my mod. and i saw it before... forgot where though. on dyso monsters leave corpses but thats way easier cuz basicaly i have to make a copy of the player so he can have a corpse where he died and also walk around. hehe if they did do that on dyso ill ask bri. maybe they did i havent been on in a while either.

oh i know how its done on dyso. i remember u cant select the whole corpse cuz its an invisible object named "corpse" that woudlnt work for a PC though... darn it
_________________
Glorin wrote:
Marine you are such a great guy, i hope you don't get hit by a truck one day!!
Back to top
View users profile Send private message Send email AIM Address MSN Messenger
RedStorm
Elder


Joined: 30 Nov 2002
Posts: 927

Level: 27
XP
EXP: 10 / 83 EXP: 10 / 83 EXP: 10 / 83
 12%
PostPosted: Wed Apr 16, 2003 9:28 pm    Post subject: Reply with quote

then dont use invis,use a corpse corpse icon_smile.gif ,as for what mod,that will be krynn icon_neutral.gif
_________________
Cain Darkwind- Priest Of Helm
Raziel- Drow Assassin
Press here ^.^: http://go.everwars.com/play.x?p=47594
Back to top
View users profile Send private message AIM Address MSN Messenger
Shadowleaf
PostWed 04/16/03 10:24pm
krynn does that? im going there to weedle the secret out!  Reply with quote
 
Shin2k
Elder


Joined: 21 Feb 2003
Posts: 822

Level: 25
XP
EXP: 56 / 73 EXP: 56 / 73 EXP: 56 / 73
 76%
PostPosted: Thu Apr 17, 2003 7:56 am    Post subject: Reply with quote

Anphillia also used it.... and it got bugged alot of times.... you didnt have your body or something and well everyone got pissed icon_biggrin.gif
Back to top
View users profile Send private message Send email Yahoo Messenger MSN Messenger
Shadowleaf
PostThu 04/17/03 11:55pm
any idea of how its done?  Reply with quote
 
Shadowleaf
Hero


Joined: 14 Jan 2003
Posts: 634

Level: 23
XP
EXP: 1 / 65 EXP: 1 / 65 EXP: 1 / 65
 1%
PostPosted: Fri Apr 18, 2003 3:26 am    Post subject: Reply with quote

well i did it. first i checked the bioware forums, then nwnvault... then lilac souls site.... nothing! so i tried again and figured it out myself! god the whole nwn community is so useless!
_________________
Glorin wrote:
Marine you are such a great guy, i hope you don't get hit by a truck one day!!
Back to top
View users profile Send private message Send email AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    DysoForums Forum Index -> Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.2 © 2001, 2002 phpBB Group