123 lines
5.0 KiB
Plaintext
123 lines
5.0 KiB
Plaintext
|
//::///////////////////////////////////////////////
|
||
|
//:: Dying Script
|
||
|
//:: ar_mod_ondying
|
||
|
//::
|
||
|
//:://////////////////////////////////////////////
|
||
|
/*
|
||
|
This script handles the default behavior
|
||
|
that occurs when a player is dying.
|
||
|
|
||
|
*/
|
||
|
//:://////////////////////////////////////////////
|
||
|
|
||
|
|
||
|
void StripPlayer(object oPlayer)
|
||
|
{
|
||
|
object oPlayer = GetLastPlayerDying();
|
||
|
object oLootChest = GetObjectByTag("PLC_ALK_PC_LOOT");
|
||
|
|
||
|
object oArms = GetItemInSlot(INVENTORY_SLOT_ARMS , oPlayer);
|
||
|
object oArrows = GetItemInSlot(INVENTORY_SLOT_ARROWS , oPlayer);
|
||
|
object oBelt = GetItemInSlot(INVENTORY_SLOT_BELT , oPlayer);
|
||
|
object oBolts = GetItemInSlot(INVENTORY_SLOT_BOLTS , oPlayer);
|
||
|
object oBoots = GetItemInSlot(INVENTORY_SLOT_BOOTS , oPlayer);
|
||
|
object oBullets = GetItemInSlot(INVENTORY_SLOT_BULLETS , oPlayer);
|
||
|
object oChest = GetItemInSlot(INVENTORY_SLOT_CHEST , oPlayer);
|
||
|
object oCloak = GetItemInSlot(INVENTORY_SLOT_CLOAK , oPlayer);
|
||
|
object oHead = GetItemInSlot(INVENTORY_SLOT_HEAD , oPlayer);
|
||
|
object oLeftHand = GetItemInSlot(INVENTORY_SLOT_LEFTHAND , oPlayer);
|
||
|
object oLeftRing = GetItemInSlot(INVENTORY_SLOT_LEFTRING , oPlayer);
|
||
|
object oNeck = GetItemInSlot(INVENTORY_SLOT_NECK , oPlayer);
|
||
|
object oRightHand = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND , oPlayer);
|
||
|
object oRightRing = GetItemInSlot(INVENTORY_SLOT_RIGHTRING , oPlayer);
|
||
|
|
||
|
// Removing PC's equipment
|
||
|
AssignCommand(oLootChest, ActionTakeItem(oArms, oPlayer));
|
||
|
AssignCommand(oLootChest, ActionTakeItem(oArrows, oPlayer));
|
||
|
AssignCommand(oLootChest, ActionTakeItem(oBelt, oPlayer));
|
||
|
AssignCommand(oLootChest, ActionTakeItem(oBolts, oPlayer));
|
||
|
AssignCommand(oLootChest, ActionTakeItem(oBoots, oPlayer));
|
||
|
AssignCommand(oLootChest, ActionTakeItem(oBullets, oPlayer));
|
||
|
AssignCommand(oLootChest, ActionTakeItem(oChest, oPlayer));
|
||
|
AssignCommand(oLootChest, ActionTakeItem(oCloak, oPlayer));
|
||
|
AssignCommand(oLootChest, ActionTakeItem(oHead, oPlayer));
|
||
|
AssignCommand(oLootChest, ActionTakeItem(oLeftHand, oPlayer));
|
||
|
AssignCommand(oLootChest, ActionTakeItem(oLeftRing, oPlayer));
|
||
|
AssignCommand(oLootChest, ActionTakeItem(oNeck, oPlayer));
|
||
|
AssignCommand(oLootChest, ActionTakeItem(oRightHand, oPlayer));
|
||
|
AssignCommand(oLootChest, ActionTakeItem(oRightRing, oPlayer));
|
||
|
|
||
|
// Removing PC's inventory
|
||
|
object oStuff = GetFirstItemInInventory(oPlayer);
|
||
|
while(GetIsObjectValid(oStuff))
|
||
|
{
|
||
|
AssignCommand(oLootChest, ActionTakeItem(oStuff, oPlayer));
|
||
|
oStuff = GetNextItemInInventory(oPlayer);
|
||
|
}
|
||
|
|
||
|
// Removing PC's money
|
||
|
AssignCommand(oLootChest, DelayCommand(0.0f, TakeGoldFromCreature(GetGold(oPlayer), oPlayer, FALSE)));
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
|
||
|
//Initialize objects, variables and effects.
|
||
|
object oPlayer = GetLastPlayerDying();
|
||
|
object oAttacker = GetLastAttacker(oPlayer);
|
||
|
object oTarget = GetWaypointByTag("WP_CAPTURED"); //or whatever the tag is for your destination waypoint
|
||
|
int iHPs = GetCurrentHitPoints(oPlayer);
|
||
|
effect eTeleport= EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);
|
||
|
effect eHeal = EffectHeal(20);
|
||
|
effect eGive1HP = EffectHeal(abs(iHPs)+1);
|
||
|
effect eDeath = EffectDeath(FALSE, FALSE);
|
||
|
|
||
|
string sMessage;
|
||
|
switch (d10())
|
||
|
{
|
||
|
case 1: sMessage = "I am gravely wounded."; break;
|
||
|
case 2: sMessage = "Need assistance."; break;
|
||
|
case 3: sMessage = "Water..."; break;
|
||
|
case 4: sMessage = "Ugh...Ahhh...Gah..."; break;
|
||
|
case 5: sMessage = "Help."; break;
|
||
|
case 6: sMessage = "Medic."; break;
|
||
|
case 7: sMessage = "Wow I suck!"; break;
|
||
|
case 8: sMessage = "Mmm... this sand is delicious."; break;
|
||
|
case 9: sMessage = "I always wanted to spend more time on my back."; break;
|
||
|
case 10: sMessage = "Wait... I lagged!"; break;
|
||
|
}
|
||
|
|
||
|
AssignCommand(oPlayer, ClearAllActions());
|
||
|
AssignCommand(oPlayer, SpeakString(sMessage));
|
||
|
|
||
|
if (GetTag(GetArea(oPlayer)) == "CARAVAN001")
|
||
|
{
|
||
|
//Main condition, If the Player is between 0 and -20 HPs they are "captured" and placed in a jail cell.
|
||
|
//...otherwise make them die.
|
||
|
if (iHPs >= -20)
|
||
|
{
|
||
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eTeleport, oPlayer);
|
||
|
AssignCommand(oPlayer, JumpToObject(oTarget));
|
||
|
// Remove & store all of PCs gear & money
|
||
|
StripPlayer(oPlayer);
|
||
|
//Stop the NPC from attacking the player
|
||
|
SetPCLike(oPlayer, oAttacker);
|
||
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oPlayer);
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//Make the Player die if at -20 or below.
|
||
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oPlayer);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (GetTag(GetArea(oPlayer)) != "TyrSSArena")
|
||
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHitPointChangeWhenDying(-1.0), oPlayer, 0.0f);
|
||
|
else
|
||
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(FALSE, FALSE), oPlayer);
|
||
|
|
||
|
}
|