Initial commit. Updated release archive.
This commit is contained in:
127
_module/nss/ro_m_deathdrop.nss
Normal file
127
_module/nss/ro_m_deathdrop.nss
Normal file
@@ -0,0 +1,127 @@
|
||||
//function to destroy or drop PC items randomly in loot bag
|
||||
|
||||
void DropItems(object oPC)
|
||||
{
|
||||
int nBagMade = 0;
|
||||
int nSlot;
|
||||
object oItem;
|
||||
object oLootBag;
|
||||
oItem = GetFirstItemInInventory(oPC);
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
|
||||
if (GetPlotFlag(oItem))
|
||||
{
|
||||
//do nothing, it's a Plot item
|
||||
}
|
||||
|
||||
//1% chance of item being destroyed
|
||||
else if (d100() == 1)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC, "You have broken an item in the battle");
|
||||
}
|
||||
|
||||
//5% chance of item being dropped into backpack on the ground
|
||||
/*else if (d100() <= 5)
|
||||
{
|
||||
if (nBagMade == 0)
|
||||
{
|
||||
oLootBag = CreateObject(OBJECT_TYPE_PLACEABLE, "plc_lootbag5", GetLocation(oPC));
|
||||
nBagMade = 1;
|
||||
}
|
||||
CreateItemOnObject(GetResRef(oItem), oLootBag, GetItemStackSize(oItem));
|
||||
DestroyObject(oItem);
|
||||
}*/
|
||||
oItem = GetNextItemInInventory(oPC);
|
||||
}
|
||||
}
|
||||
//end of random item drop
|
||||
|
||||
|
||||
|
||||
void Raise(object oPC)
|
||||
{
|
||||
effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION);
|
||||
|
||||
effect eBad = GetFirstEffect(oPC);
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPC);
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPC)), oPC);
|
||||
|
||||
//Search for negative effects
|
||||
while(GetIsEffectValid(eBad))
|
||||
{
|
||||
if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE ||
|
||||
GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE ||
|
||||
GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE ||
|
||||
GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE ||
|
||||
GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE ||
|
||||
GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE ||
|
||||
GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE ||
|
||||
GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE ||
|
||||
GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS ||
|
||||
GetEffectType(eBad) == EFFECT_TYPE_DEAF ||
|
||||
GetEffectType(eBad) == EFFECT_TYPE_PARALYZE ||
|
||||
GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL)
|
||||
{
|
||||
//Remove effect if it is negative.
|
||||
RemoveEffect(oPC, eBad);
|
||||
}
|
||||
eBad = GetNextEffect(oPC);
|
||||
}
|
||||
//Fire cast spell at event for the specified target
|
||||
SignalEvent(oPC, EventSpellCastAt(OBJECT_SELF, SPELL_RESTORATION, FALSE));
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oPC);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetLastPlayerDied();
|
||||
|
||||
|
||||
//give anti-cheat item
|
||||
if (GetItemPossessedBy(oPC, "Death")== OBJECT_INVALID)
|
||||
{
|
||||
CreateItemOnObject("death", oPC, 1);
|
||||
}
|
||||
|
||||
|
||||
//gets rid of flag FX if player is a CTF flag carrier
|
||||
if (GetLocalInt(oPC, "HasFlag") == 1)
|
||||
{
|
||||
string sName = GetName(oPC);
|
||||
SendMessageToAllDMs (" "+ sName +" has died with the flag!");
|
||||
SetLocalInt (oPC, "HasFlag", 0);
|
||||
|
||||
//removes flag effect
|
||||
effect eLoop=GetFirstEffect(oPC);
|
||||
while (GetIsEffectValid(eLoop))
|
||||
{
|
||||
if (GetEffectType(eLoop)==EFFECT_TYPE_VISUALEFFECT)
|
||||
RemoveEffect(oPC, eLoop);
|
||||
|
||||
eLoop=GetNextEffect(oPC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// * make friendly to Each of the 3 common factions
|
||||
AssignCommand(oPC, ClearAllActions());
|
||||
// * Note: waiting for Sophia to make SetStandardFactionReptuation to clear all personal reputation
|
||||
if (GetStandardFactionReputation(STANDARD_FACTION_COMMONER, oPC) <= 10)
|
||||
{ SetLocalInt(oPC, "NW_G_Playerhasbeenbad", 10); // * Player bad
|
||||
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 80, oPC);
|
||||
}
|
||||
if (GetStandardFactionReputation(STANDARD_FACTION_MERCHANT, oPC) <= 10)
|
||||
{ SetLocalInt(oPC, "NW_G_Playerhasbeenbad", 10); // * Player bad
|
||||
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 80, oPC);
|
||||
}
|
||||
if (GetStandardFactionReputation(STANDARD_FACTION_DEFENDER, oPC) <= 10)
|
||||
{ SetLocalInt(oPC, "NW_G_Playerhasbeenbad", 10); // * Player bad
|
||||
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oPC);
|
||||
}
|
||||
|
||||
DelayCommand(2.5, PopUpGUIPanel(oPC,GUI_PANEL_PLAYER_DEATH));
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user