|
Banned
Join Date: Oct 2003
Location: posting for gb sweep
Posts: 1,330
|
*loads NWN Editor*
*loads script editor*
Get ready for a whole shitload of scripts with NWN functions + constants
//::///////////////////////////////////////////////
//:: Name x2_respawn
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Transports player back to Purgatory on respawn...
*/
//:://////////////////////////////////////////////
//:: Created By: Keith Warner
//:: Created On: Feb 10/03
//:://////////////////////////////////////////////
// * Applies an XP and GP penalty
// * to the player respawning
#include "nw_i0_plot"
#include "x0_i0_henchman"
void Raise(object oPlayer)
{
effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION);
effect eBad = GetFirstEffect(oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPlayer)), oPlayer);
//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(oPlayer, eBad);
}
eBad = GetNextEffect(oPlayer);
}
//Fire cast spell at event for the specified target
SignalEvent(oPlayer, EventSpellCastAt(OBJECT_SELF, SPELL_RESTORATION, FALSE));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oPlayer);
}
void 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 < nMin)
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));
}
// * Makes the standard factions neutral to the oChangeMe object
void AdjustReputationWithStandardFactions(object oMaster, object oChangeMe)
{
//Make friendly to Each of the 3 common factions
if (GetStandardFactionReputation(STANDARD_FACTION_COMMONER, oMaster) <= 10)
{
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 80, oChangeMe);
}
if (GetStandardFactionReputation(STANDARD_FACTION_DEFENDER, oMaster) <= 10)
{
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oChangeMe);
}
if (GetStandardFactionReputation(STANDARD_FACTION_MERCHANT, oMaster) <= 10)
{
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 80, oChangeMe);
}
//SPECIAL CASES - for non-standard factions
}
// * bring the player back to life, fully healed and
void main()
{
object oRespawner = GetLastRespawnButtonPresser();
object oHench;
// * remove 1 rogue stone
object oStone = GetItemPossessedBy(oRespawner, "x2_p_rogue");
if (GetIsObjectValid(oStone) == TRUE)
{
int nStack = GetItemStackSize(oStone);
if (nStack > 1)
SetItemStackSize(oStone, nStack - 1);
else
DestroyObject(oStone);
}
// ****************************
// Figure out where to go
// ****************************
//* Return PC to Purgatory
string sDestTag = "NW_DEATH_PLACE";
string sArea = GetTag(GetArea(oRespawner));
object oSpawnPoint;
location lLoc;
/*
1 SPECIAL CASE
*/
if (sArea == "mod1_hellgate")
{
sDestTag = "";
}
if (GetIsObjectValid(GetObjectByTag(sDestTag)))
{
if (sDestTag == "NW_DEATH_PLACE")
{
object oPriest = GetObjectByTag("NW_DEATH_CLERIC");
SetLocalLocation(oRespawner, "NW_L_I_DIED_HERE", GetLocation(oRespawner));
SetLocalInt(oRespawner, "NW_L_I_DIED", 1);
SetLocalObject(oPriest, "NW_L_LASTDIED", oRespawner);
// * April 2002: Moved penalty here, only when going back to the death temple
//ApplyPenalty(oRespawner);
}
else if (sDestTag == "")
{
sDestTag = "NW_DEATH_PLACE";
}
oSpawnPoint = GetObjectByTag(sDestTag);
lLoc = GetLocation(oSpawnPoint);
}
// ****************************
// Iterate through followers
// ****************************
// *
// * July 28 2003
// * Go through all henchmen and remove
// * any followers
// * Adjust their reputations with the standard
// * factions so that they are all friends again too
int i = 0;
do
{
i++;
oHench = GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oRespawner, i);
if (GetIsObjectValid(oHench) == TRUE)
{
AdjustReputationWithStandardFactions(oRespawner, oHench);
if (GetIsFollower(oHench) == FALSE)
{
// * Teleport henchmen to respawn place
if (GetIsObjectValid(oSpawnPoint) == TRUE)
DelayCommand(2.5, AssignCommand(oHench, JumpToLocation(lLoc)));
}
else
// * is a follower.
// * remove them and signal an event
{
RemoveHenchman(oRespawner, oHench);
SignalEvent(oHench, EventUserDefined(19767));
}
}
}
while (GetIsObjectValid(oHench) == TRUE);
AdjustReputationWithStandardFactions(oRespawner, oRespawner);
DelayCommand(2.0, Raise(oRespawner));
DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner));
DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner));
DelayCommand(2.0, RemoveEffects(oRespawner));
// ****************************
// Go to teleporation place - Player
// ****************************
if (GetIsObjectValid(oSpawnPoint) == TRUE)
{
DelayCommand(2.0, AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint))));
}
else
{
// * do nothing, just 'res where you are.
}
}
/* Caryatid OnSpawn script -- come in petrified.
This must be used with x0_percep_caryatd as the OnPerception handler
or else the caryatid will never un-petrify!
*/
#include "NW_O2_CONINCLUDE"
#include "NW_I0_GENERIC"
#include "x0_i0_petrify"
void main()
{
SetListeningPatterns();
WalkWayPoints();
GenerateNPCTreasure();
// Come in petrified
Petrify(OBJECT_SELF);
}
//::///////////////////////////////////////////////////
//:: X0_TRAPDLY_ISACG
//:: OnTriggered script for a projectile trap
//:: Spell fired: SPELL_ISAACS_GREATER_MISSILE_STORM
//:: Spell caster level: 11
//::
//:: Copyright (c) 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 11/17/2002
//::///////////////////////////////////////////////////
#include "x0_i0_projtrap"
void main()
{
TriggerProjectileTrap(SPELL_ISAACS_GREATER_MISSILE_STORM, GetEnteringObject(), 11);
}
//::///////////////////////////////////////////////
//:: Death Script
//:: NW_O0_DEATH.NSS
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This script handles the default behavior
that occurs when a player dies.
BK: October 8 2002: Overriden for Expansion
*/
//:://////////////////////////////////////////////
//:: Created By: Brent Knowles
//:: Created On: November 6, 2001
//:://////////////////////////////////////////////
/*
void ClearAllFactionMembers(object oMember, object oPlayer)
{
// AssignCommand(oMember, SpeakString("here"));
AdjustReputation(oPlayer, oMember, 100);
SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
object oClear = GetFirstFactionMember(oMember, FALSE);
while (GetIsObjectValid(oClear) == TRUE)
{
ClearPersonalReputation(oPlayer, oClear);
oClear = GetNextFactionMember(oMember, FALSE);
}
} */
void Raise(object oPlayer)
{
effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION);
effect eBad = GetFirstEffect(oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPlayer)), oPlayer);
//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(oPlayer, eBad);
}
eBad = GetNextEffect(oPlayer);
}
//Fire cast spell at event for the specified target
SignalEvent(oPlayer, EventSpellCastAt(OBJECT_SELF, SPELL_RESTORATION, FALSE));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oPlayer);
}
void main()
{
object oPlayer = GetLastPlayerDied();
// * increment global tracking number of times that I died
SetLocalInt(oPlayer, "NW_L_PLAYER_DIED", GetLocalInt(oPlayer, "NW_L_PLAYER_DIED") + 1);
// * BK: Automation Control. Autopcs ignore death
if (GetLocalInt(oPlayer, "NW_L_AUTOMATION") == 10)
{
Raise(oPlayer);
DelayCommand(1.0, ExecuteScript("crawl", OBJECT_SELF));
return; // Raise and return
}
// * Handle Spirit of the Wood Death
string sArea = GetTag(GetArea(oPlayer));
/*
if (sArea == "MAP_M2Q2F2" && GetDistanceBetweenLocations(GetLocation(GetObjectByTag("M2Q2F2_M2Q2G")), GetLocation(oPlayer)) < 5.0 && GetLocalInt(GetModule(),"NW_M2Q2E_WoodsFreed") == 0)
{
int bValid;
Raise(oPlayer);
string sDestTag = "WP_M2Q2GtoM2Q2F";
object oSpawnPoint = GetObjectByTag(sDestTag);
AssignCommand(oPlayer,JumpToLocation(GetLocation(oSpawnPoint)));
return;
}
*/
// * in last level of the Sourcestone, move the player to the beginning of the area
// * May 16 2002: or the main area of the Snowglobe (to prevent plot logic problems).
// * May 21 2002: or Castle Never
if (sArea == "M4Q1D2" || sArea == "M3Q3C" || sArea == "MAP_M1Q6A")
{
//Raise(oPlayer);
//string sDestTag = "M4QD07_ENTER";
//object oSpawnPoint = GetObjectByTag(sDestTag);
// AssignCommand(oPlayer, DelayCommand(1.0, JumpToLocation(GetLocation(oSpawnPoint))));
// * MAY 2002: Just popup the YOU ARE DEAD panel at this point
DelayCommand(2.5, PopUpDeathGUIPanel(oPlayer,FALSE, TRUE, 66487));
return;
}
// * make friendly to Each of the 3 common factions
AssignCommand(oPlayer, ClearAllActions());
// * Note: waiting for Sophia to make SetStandardFactionReptuation to clear all personal reputation
if (GetStandardFactionReputation(STANDARD_FACTION_COMMONER, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 80, oPlayer);
}
if (GetStandardFactionReputation(STANDARD_FACTION_MERCHANT, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 80, oPlayer);
}
if (GetStandardFactionReputation(STANDARD_FACTION_DEFENDER, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oPlayer);
}
DelayCommand(2.5, PopUpGUIPanel(oPlayer,GUI_PANEL_PLAYER_DEATH));
}//::///////////////////////////////////////////////
//:: Dying Script
//:: NW_O0_DEATH.NSS
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This script handles the default behavior
that occurs when a player is dying.
DEFAULT CAMPAIGN: player dies automatically
*/
//:://////////////////////////////////////////////
//:: Created By: Brent Knowles
//:: Created On: November 6, 2001
//:://////////////////////////////////////////////
void main()
{
/* AssignCommand(GetLastPlayerDying(), ClearAllActions());
AssignCommand(GetLastPlayerDying(),SpeakString( "I Dying"));
PopUpGUIPanel(GetLastPlayerDying(),GUI_PANEL_PLAYER_DEATH);
*/
// * April 14 2002: Hiding the death part from player
effect eDeath = EffectDeath(FALSE, FALSE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, GetLastPlayerDying());
}
|