Показать сообщение отдельно
Старый 20.11.2007, 16:11   #46
Oranj
Бывалый Рауринец
 
Аватар для Oranj
 
Регистрация: 02.02.2007
Сообщения: 548
Власть репутации: 658 Oranj У него еще все впереди!
По умолчанию Re: Вопрос: OnPlayerDying

Цитата:
Сообщение от heartbeat.NSS
/*Created by Fadedshadow 8/28/02. Feel free to modify,pirate,or whatever to suit your needs. */
void main()
{
object oPC = GetLastPlayerDying();
int nHitPoints = GetCurrentHitPoints(oPC);
effect eHeal = EffectHeal(1);
effect eDamage = EffectDamage(1,DAMAGE_TYPE_MAGICAL,DAMAGE_POWER_PL US_FIVE);
string sDying = "Help ! I'm dying !";
string sStable = "I've stablized.";
string sRecover = "I have recovered.";
/* You can make this 0 so the pc will stay unconcious until healed by someone else. */
if (nHitPoints < 1)
{
if (nHitPoints > -10)
{
int nRoll = (Random(100));
if (GetLocalString(oPC,"sBleeding") == "True" && nRoll <=10)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oPC);
AssignCommand(oPC,SpeakString(sStable));
SetLocalString(oPC, "sBleeding","False");
if (GetCurrentHitPoints(oPC) >= 1)
{
SetLocalString(oPC, "sBleeding","True");
}
}
if (GetLocalString(oPC,"sBleeding") == "True" && nRoll > 10)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC);
AssignCommand(oPC,SpeakString(sDying));
}
if (nRoll <=33 && GetLocalString(oPC,"sBleeding") =="False")
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oPC);
}
if (GetCurrentHitPoints(oPC) >= 1)
{
SetLocalString(oPC, "sBleeding","True");
AssignCommand(oPC,SpeakString(sRecover));
}
}
}


if(GetCurrentHitPoints(oPC) <= -10)
{
effect eDeath = EffectDeath(FALSE, FALSE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, GetLastPlayerDying());
}
}
Цитата:
Сообщение от on_death.NSS
//::///////////////////////////////////////////////
//:: 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
//:://////////////////////////////////////////////
// BMA-OEI 7/20/06 -- Temp death screen
// BMA-OEI 11/08/06 -- Added engine death GUI: SCREEN_DEATH_DEFAULT (ingamegui.ini) is force closed upon resurrection

const string GUI_DEFAULT_DEATH_SCREEN = "SCREEN_DEATH_DEFAULT";

// Resurrect and remove negative effects from oPlayer
//void Raise( object oPlayer );

// Display death pop-up to oPlayer
//void ShowDefaultDeathScreen( object oPlayer );



// Resurrect and remove negative effects from oPlayer
void Raise(object oPlayer)
{
effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION);

effect eBad = GetFirstEffect(oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectRe surrection(),oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHe al(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 = GetFirstEffect(oPlayer);
}
else
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);
}

// Display death pop-up to oPlayer
void ShowDefaultDeathScreen( object oPlayer )
{
DisplayGuiScreen( oPlayer, GUI_DEFAULT_DEATH_SCREEN, FALSE );
//DisplayMessageBox( oPlayer, 0, GetStringByStrRef(181408), "gui_death_respawn_self", "", FALSE, "", 6603, "", 0, "" );
}



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
}

DelayCommand( 2.5f, ShowDefaultDeathScreen( oPlayer ) );
/*
// * Handle Spirit of the Wood Death
string sArea = GetTag(GetArea(oPlayer));

if (sArea == "MAP_M2Q2F2" && GetDistanceBetweenLocations(GetLocation(GetObjectB yTag("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(o SpawnPoint)));
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_COM MONER, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_COMM ONER, 80, oPlayer);
}
if (GetStandardFactionReputation(STANDARD_FACTION_MER CHANT, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_MERC HANT, 80, oPlayer);
}
if (GetStandardFactionReputation(STANDARD_FACTION_DEF ENDER, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_DEFE NDER, 80, oPlayer);
}

DelayCommand(2.5, PopUpGUIPanel(oPlayer,GUI_PANEL_PLAYER_DEATH));
*/
}

/*
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);
}
}
*/
Цитата:
Сообщение от on_dying.NSS
//::///////////////////////////////////////////////
//:: 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_PLAYE R_DEATH);
*/
// * April 14 2002: Hiding the death part from player
// effect eDeath = EffectDeath(FALSE, FALSE);
// ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, GetLastPlayerDying());
SetLocalInt(GetLastPlayerDying(),"dyinig",GetLocal Int(GetLastPlayerDying(),"dyinig")+1);

FloatingTextStringOnCreature(IntToString(GetLocalI nt(GetLastPlayerDying(),"dyinig")),GetLastPlayerDy ing());

}
Моудль здесь
Oranj is offline   Ответить с цитированием