here is a respawn script, and a include easly adjustable:
mod respawn event:
//:://////////////////////////////////////////////////////////////
//:: Title : mod_on_respawn //On Pressed Respawn Button
//:: Author: Greyfort
//:: Module: any who need
//:: Date : Aug 20, 2010
//:: Vers : 1.0
//:://////////////////////////////////////////////////////////////
// some scripts taken from default bioware script
// * Applies an XP and GP penalty
// * to the player respawning
// !!! careful changeing below!!!
void Custm_ApplyPenalty(object oDead)
{
int nXP = GetXP(oDead);
int nPenalty = 50 * GetHitDice(oDead);//change 50
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
nNewXP = nMin;
SetXP(oDead, nNewXP);
int nGoldToTake = FloatToInt(0.10 * GetGold(oDead));
// * a cap of 10 000gp taken from you
if (nGoldToTake > 10000)
{
nGoldToTake = 10000;//change this to max
}
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));
}
//////////////////////////////////////////////////////////////////////////////
#include "nw_i0_plot"
#include "grey_func_inc"
void main()
{
//:://////////////////////////////////////////////////////////////
//:: Title : mod_on_respawn
//:: Author: Greyfort
//:: Module: any who need
//:: Date : Aug 20, 2010
//:: Vers : 1.0
//:://////////////////////////////////////////////////////////////
object oRespawner = GetLastRespawnButtonPresser();
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
RemoveEffects(oRespawner);
object oSpawnPoint;
string sDestTag;
//DEBUG
//int iVobj=GetIsObjectValid( oRespawner);
//SendMessageToPC(oRespawner,"Valid Object.."+IntToString (iVobj)+".." );
////////////////////////////////////////////////
// GC_Get_C_Aling will not work GetLastRespawnButtonPresser()
//int nTestAlign= GC_Get_C_Aling(oRespawner);
////////////////////
// from lexicon
////////////////////
int nAlignGE = GetAlignmentGoodEvil(oRespawner);
int nAlignLC = GetAlignmentLawChaos(oRespawner);
int nAlign = 0;
//Calculate the IP_CONST_ALIGNMENT_* integer value
switch (nAlignGE) //Good is the default 0 [ethics unintended - ed.]
{
case ALIGNMENT_NEUTRAL: nAlign = 1; break;
case ALIGNMENT_EVIL: nAlign = 2;
}
switch (nAlignLC) //Lawful = 0
{
case ALIGNMENT_NEUTRAL: nAlign+=3; break; //increment nAlign by 3
case ALIGNMENT_CHAOTIC: nAlign+=6; break; //increment nAlign by 6
}
int nTestAlign = nAlign;
////////////////////
//end of int nTestAlign = nAlign;
////////////////////
//DEBUG
//SendMessageToPC(oRespawner,"alingment int"+IntToString (nTestAlign)+".." );
//:://///////////////////////////////////////////////////////////////////////////////////////////////
// This is from lexicon the nAlign switches derive from the following table:
/////// IP_CONST_ALIGNMENT ////////
// 0 1 2 //
// 0 LG = 0 // LN = 1 // LE = 2 //
// 3 NG = 3 // TN = 4 // NE = 5 //
// 6 CG = 6 // CN = 7 // CE = 8 //
/////////////////////////////////////////////////////////////
// Alingments...
// LG || LN || NG // sDestTag ="WP_Gplain";
// TN // sDestTag ="WP_Nplain";
// LE || CG || CN || NE || CE // sDestTag ="WP_Eplain";
////////////////////////////////////////////////////////////
// this switch chooses waypoint based on int nTestAlign = nAlign; value
switch (nTestAlign)
{
case 0:
// ...LG
sDestTag ="WP_Gplain";
break;
case 1:
// ...LN
sDestTag ="WP_Gplain";
break;
case 2:
// ...LE
sDestTag ="WP_Eplain";
break;
case 3:
// ...NG
sDestTag ="WP_Gplain";
break;
case 4:
// ...NN
sDestTag ="WP_Nplain";
break;
case 5:
// ...NE
sDestTag ="WP_Eplain";
break;
case 6:
// ...CG
sDestTag ="WP_Eplain";
break;
case 7:
// ...CN
sDestTag ="WP_Eplain";
break;
case 8:
// ...CE
sDestTag ="WP_Eplain";
break;
default:
// do nothing ...
break;
}
/////////////////////////////////////
// Custm_ApplyPenalty()
Custm_ApplyPenalty(oRespawner);
/////////////////////////////////////
// jump to alingment plain
//DEBUG
SendMessageToPC(oRespawner,"alingment int"+IntToString (nTestAlign)+".." );
SendMessageToPC(oRespawner,"alingment waypoint"+sDestTag +".." );
oSpawnPoint = GetObjectByTag(sDestTag);
AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
//end of script
}
include script:
//:://////////////////////////////////////////////////////////////
//:: Title : grey_func_inc
//:: Author: Greyfort
//:: Module: any who need
//:: Date : Aug 22, 2010
//:: Vers : 1.0
//:://////////////////////////////////////////////////////////////
//!!!WARNING!!! !!!WARNING!!! !!!WARNING!!! !!!WARNING!!!
//!!! "custm_drop_inc" will cause duplicate errors if used with this include
//!!!WARNING!!! !!!WARNING!!! !!!WARNING!!! !!!WARNING!!!
//:://///////////////////////////////////////////////////////////////////////////////////////////////
// This is CONSTANTS for function Get_C_Aling
const int GC_LAWFUL_GOOD=0;
const int GC_LAWFUL_NEUTRAL=1;
const int GC_LAWFUL_EVIL=2;
const int GC_NEUTRAL_GOOD=3;
const int GC_TRUE_NEUTRAL=4;
const int GC_NEUTRAL_EVIL=5;
const int GC_CHAOTIC_GOOD=6;
const int GC_CHAOTIC_NEUTRAL=7;
const int GC_CHAOTIC_EVIL=8;
//:://///////////////////////////////////////////////////////////////////////////////////////////////
// This is from lexicon the nAlign switches derive from the following table:
/////// IP_CONST_ALIGNMENT ////////
// 0 1 2 //
// 0 LG = 0 // LN = 1 // LE = 2 //
// 3 NG = 3 // TN = 4 // NE = 5 //
// 6 CG = 6 // CN = 7 // CE = 8 //
//
/////////////////////////////////////////////////////
// This function gets object oCreature ALINGMENT
int GC_Get_C_Aling( object oCreature);//
//////////////////////////////////////////////////
// This function gets object oCreature ALINGMENT
int GC_Get_C_Aling( object oCreature)
{
object oCreature;
int nAlignGE = GetAlignmentGoodEvil(oCreature);
int nAlignLC = GetAlignmentLawChaos(oCreature);
int nAlign = 0;
//Calculate the IP_CONST_ALIGNMENT_* integer value
switch (nAlignGE) //Good is the default 0 [ethics unintended - ed.]
{
case ALIGNMENT_NEUTRAL: nAlign = 1; break;//return nAlign;//
case ALIGNMENT_EVIL: nAlign = 2; //break;
}
switch (nAlignLC) //Lawful = 0
{
case ALIGNMENT_NEUTRAL: nAlign+=3; break;// //increment nAlign by 3
case ALIGNMENT_CHAOTIC: nAlign+=6; break;// //increment nAlign by 6
}
return nAlign;
// end of GC_Get_C_Aling
}
//:://///////////////////////////////////////////////////////////////////////////////////////////////
// This function strips all items on object. An example of this can be found in lexicon.
// see lexicon cellowin strips all items with tag.
void GC_StripALLItems(object oStrippee);
//////////////////////////////////////
// This function strips all items on object
void GC_StripALLItems(object oStrippee)
{
object oCurrentItem = GetFirstItemInInventory(oStrippee);
while (oCurrentItem != OBJECT_INVALID)
{
DestroyObject(oCurrentItem);
oCurrentItem = GetNextItemInInventory(oStrippee);
}
}// end GC_StripItems function
//:://///////////////////////////////////////////////////////////////////////////////////////////////
// this funtion generates gold, based on pc lvl, and area.
// put int iGold; before use of GenGoldValues, dont give number will add it to total.
// EXAMPLE:
// int iGold;
// CreateItemOnObject("NW_IT_GOLD001",oPC,GenGold_Values(iGold),"");
// Also see file:"rat_drop_death" for an example of use.
//
// You should only generate values within include "rat_drop_inc".
// make backup named "rat_drop_inc_bu" if you do alter you will always have old file to refer to.
// marked CHANGE ONLY, or add more areas ware marked instruction within include "rat_drop_inc".
//
//// MUST INCLUDE "int iValue;"
// BEFOR "GC_GenGoldValues(iValue);" FUNCTION
// NO NEED TO GIVE A VALUE WILL POSSIBLY ADD TO TOTAL
// SET IN THE INCLUDE FILE.
// you can also just use 0 GC_GenGoldValues(0);
// I think so....
int GC_GenGoldValues(int iRGold);
//////////////////////////////////////
// this funtion generates gold
int GC_GenGoldValues(int iRGold)
{
//
// generate values for gold based on areas
int iPClvl1 = GetLevelByPosition(1,GetLastKiller());
int iPClvl2 = GetLevelByPosition(2,GetLastKiller());
int iPClvl3 = GetLevelByPosition(3,GetLastKiller());
int iTPClvl = iPClvl1+iPClvl2+iPClvl3;
int iRGMax;
if (GetTag(GetArea(OBJECT_SELF))=="vampy")
{
// for area "vampy" ...name="Twilight Misty Lands"
iRGMax=200;// CHANGE ONLY iRGMax value only
}
else if (GetTag(GetArea(OBJECT_SELF))=="vampIsle2")
{
// for area "vampIsle2" ...name="VampIsle2"
iRGMax=300;// CHANGE ONLY iRGMax value only
}
else if (GetTag(GetArea(OBJECT_SELF))=="vampgard")
{
// for area "vampgard" ...name="Forboding Cave"
iRGMax=500;// CHANGE ONLY iRGMax value only
}// you can add more areas buy another else if
// EXAMPLE:
//else if (GetTag(GetArea(OBJECT_SELF))=="tag of your area")
//{
// for area "tag of your area" ...name=""
//iRGMax=number value here;// CHANGE ONLY iRGMax value only
//{
// EXAMPLE:
//else if (GetTag(GetArea(OBJECT_SELF))=="tag of your area")
//{
// for area "tag of your area" ...name=""
//iRGMax=number value here;// CHANGE ONLY iRGMax value only
//{
// EXAMPLE:
//else if (GetTag(GetArea(OBJECT_SELF))=="tag of your area")
//{
// for area "tag of your area" ...name=""
//iRGMax=number value here;// CHANGE ONLY iRGMax value only
//{
else
{
// default if no area or error ...
iRGMax=100;// CHANGE ONLY iRGMax value only
}
int iRnum = iRGMax + iTPClvl;
int iRGold= Random(iRnum);
return (iRGold);
}// end GC_GenGoldValues
//:://////////////////////////////////////////////////////
// * Applies an XP and GP penalty
// * to the player respawning
void GC_Dfault_ApplyPenalty(object oDead);
// * Applies an XP and GP penalty
// * to the player respawning
void GC_Dfault_ApplyPenalty(object oDead)
{
int nXP = GetXP(oDead);
int nPenalty = 50 * 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
nNewXP = nMin;
SetXP(oDead, nNewXP);
int nGoldToTake = FloatToInt(0.10 * GetGold(oDead));
// * a cap of 10 000gp taken from you
if (nGoldToTake > 10000)
{
nGoldToTake = 10000;
}
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));
}// end GC_Dfault_ApplyPenalty
//:://////////////////////////////////////////////////////
// * Applies an XP and GP penalty
// * to the player respawning
void GC_Custm_ApplyPenalty(object oDead);
// * Applies an XP and GP penalty
// * to the player respawning
void GC_Custm_ApplyPenalty(object oDead)
{
int icustm1 = 50;// CHANGE ONLY xp penalty
int icustmMaxGP = 10000;// CHANGE ONLY max gold taken
int nXP = GetXP(oDead);
int nPenalty = icustm1 * 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
nNewXP = nMin;
SetXP(oDead, nNewXP);
int nGoldToTake = FloatToInt(0.10 * GetGold(oDead));
// * a cap of 10 000gp taken from you
if (nGoldToTake > icustmMaxGP)
{
nGoldToTake = icustmMaxGP;
}
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));
}// end GC_Custm_ApplyPenalty
////////////////////////////////////
// add new funtions below
////////////////////////////////////
Note these scripts dont do exactly what you want but you can adjust them or if unsure how i can make them more to what you described just drop me a pm
Modifié par Greyfort, 15 janvier 2011 - 04:43 .