45 lines
1.6 KiB
Plaintext
45 lines
1.6 KiB
Plaintext
// * Applies an XP and GP penalty
|
|
// * to the player respawning
|
|
void ApplyPenalty(object oDead)
|
|
{
|
|
int nXP = GetXP(oDead);
|
|
int nPenalty = 500 * GetHitDice(oDead);
|
|
int nHD = GetHitDice(oDead);
|
|
// * You can not lose a level with this respawning
|
|
int nMin = ((nHD * (nHD - 1)) / 2) * 1000;
|
|
|
|
int nNewXP = nXP - nPenalty;
|
|
if (nNewXP < nMin)
|
|
nNewXP = nMin;
|
|
SetXP(oDead, nNewXP);
|
|
int nGoldToTake = FloatToInt(1.00 * GetGold(oDead));
|
|
// * a cap of 10 000gp taken from you
|
|
if (nGoldToTake > 99999)
|
|
{
|
|
nGoldToTake = 99999;
|
|
}
|
|
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
|
|
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
|
|
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));
|
|
|
|
}
|
|
|
|
void main()
|
|
{
|
|
object oArea = GetArea(OBJECT_SELF);
|
|
location lBegLoc = GetLocation(OBJECT_SELF);
|
|
//The "beggmale001" needs to be changed to whatever your module
|
|
//names the BLUEPRINT for your custom created creature. You
|
|
//cannot use a completely standard creature, because then you
|
|
//won't be able to change the scripts. Just create a regular
|
|
//instance of an NPC, right click it and pick properties. Switch
|
|
//to the scripts tag and fill in this script's name under the
|
|
//on death script. Then close that, and right click on your
|
|
//newly created NPC and add pick add blueprint. Then from the
|
|
//advanced tab of the properties for the blueprint, find out
|
|
//what the blueprint name is.
|
|
CreateObject(OBJECT_TYPE_CREATURE, "jailguard1", lBegLoc);
|
|
ApplyPenalty(GetLastKiller());
|
|
}
|
|
|