How does this look ?
"ondying"
/*OK, this is complicated. This script started off with (my) WormHearts modification of
FadedShadows dying script. I added more gore (lots of gore) and removed the possibility
of natural recovery. It worked in singleplayer but not in multi-player.
Then Alen Elford stepped forward to help, but it was Silent Agent that finally made this work in multiplay.
You do need to inset the following line of script in your module respawn script, though:
DeleteLocalInt (oRespawner, "BLEEDING");
Otherwise, it only fires once! So, in order of appearence :
FadedShadow, WormHeart, Alen Elford & Silent Agent. And Yes, you too can modify this!
'>
09/12/2002 WormHeart
*/
void main()
{
object oDying=GetLastPlayerDying();
object oPC;
if(!GetLocalInt(oDying,"BLEEDING"))
{
oPC=oDying;
SetLocalInt(oPC,"BLEEDING",1);
}
else
{
oPC=GetLocalObject(OBJECT_SELF,"DYING_PC");
DeleteLocalObject(oPC,"DYING_PC");
}
//If you're squirmish you might want to leave out the effects. They are quite graphic.
int nHitPoints=GetCurrentHitPoints(oPC);
effect eDamage=EffectDamage(1,DAMAGE_TYPE_MAGICAL,DAMAGE_POWER_PLUS_FIVE);
effect eFirst=EffectVisualEffect(VFX_COM_CHUNK_RED_SMALL);
effect eTwo=EffectVisualEffect(VFX_COM_CHUNK_RED_MEDIUM);
if(nHitPoints-10&&GetLocalInt(oPC,"BLEEDING"))
{
ApplyEffectToObject(DURATION_TYPE_INSTANT,eDamage,oPC);
//Now to check if the PC have reached -10, if s/he haves, then death!
if(GetCurrentHitPoints(oPC)<=-8)
ExecuteScript("stable",OBJECT_SELF);
//Now to check if the PC have reached -10, if s/he haves, then death!
if(GetCurrentHitPoints(oPC)<=-10)
{
AssignCommand(oPC,SpeakString("Goodbye, cruel world!"));
ApplyEffectToObject(DURATION_TYPE_INSTANT,eTwo,oPC);
effect eDeath=EffectDeath(FALSE, FALSE);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eDeath,oPC);
}
else
{
//If not, then play a animation of spurting gore and have the dying
//PC mutter some stuff!
ApplyEffectToObject(DURATION_TYPE_INSTANT,eFirst,oPC);
switch (d8())
{
case 1:AssignCommand(oPC,SpeakString("Urgh..."));break;
case 2:AssignCommand(oPC,SpeakString("*squirt, squirt*"));break;
case 3:AssignCommand(oPC,SpeakString("I'm bleeding here!"));break;
case 4:AssignCommand(oPC,SpeakString("It's in the BONE!"));break;
case 5:AssignCommand(oPC,SpeakString("*squirt*"));break;
case 6:AssignCommand(oPC,SpeakString("My life is fading..."));break;
case 7:AssignCommand(oPC,SpeakString("*squirt*"));break;
case 8:AssignCommand(oPC,SpeakString("Ralle..."));break;
}
//Finally to just loop the script, so it runs again!
SetLocalObject(oPC,"DYING_PC",oPC);
DelayCommand(6.0,ExecuteScript("module_dying",oPC));
}
}
}
script "stable"
void main()
{
object oDying=GetLastPlayerDying();
object oPC;
if (d100()<=5)
{
DeleteLocalInt (oDying, "BLEEDING");
effect eEffect;
eEffect = EffectRegenerate(1, 5.0f);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oPC, 45.0f);
}}
void main()
{
object oDying=GetLastPlayerDying();
object oPC;
if (d100()<=5)
{
DeleteLocalInt (oDying, "BLEEDING");
effect eEffect;
eEffect = EffectRegenerate(1, 5.0f);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oPC, 45.0f);
}}
Modifié par Knight_Shield, 14 novembre 2010 - 03:04 .