This is just a little broadcast ondeath script for boss monsters. The body of the script goes at the top of the monsters ondeath. It will broadcast, shout, to all players that so and so killed monsterx in areax. I imagine this is not new, but I had a request for it.
Posted by Blasco-Yang at 2009-04-11 12:28:47 Voted 10.00 on 04/11/09
Another simple, but quite handy script that makes you say: "Why didn't I think of that?"
I actually downloaded this quite some time ago, but had other things going on that prevented me from really looking at it.
Thanks ffbj.
Posted by Shargast at 2006-03-30 07:47:38 Voted 10.00 on 03/30/06
Got it running - 10.00 is for the scripting plus the online support! Keep on rocking in a free world!
Shargast aka Sai Highpockets _________________________ Realms of Shargast V1-V5ab, LOTR V15, The Undeath Clave & Faithful of Aerth
You can also just add in the line:
SpeakString(sMessage, TALKVOLUME_SHOUT);
under the oPlayer message, but it won't shout to all the players, though it will still send the message. This is due to the fact that you can't shout to all players, there is not function that does that. Sorry.
Posted by Shargast at 2006-03-29 10:00:24 Voted 10.00 on 03/30/06
Ok All I could wish for is that you could edit this script so that it will appear as TALKVOLUME_SHOUT. The message at the end of the script 76 - 96 .
I've borrowed from you and if you can help me to get this script going I'd be most grateful!
Thanks for any help - should be easy, but then again Greek and Latin are also easy.
Cheers
Sai
NWScript:
//:://////////////////////////////////////////////////
//:: NW_C2_DEFAULT7
/*
Default OnDeath event handler for NPCs.
Adjusts killer's alignment if appropriate and
alerts allies to our death.
*/
//:://////////////////////////////////////////////////
//:: Copyright (c) 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 12/22/2002
//:://////////////////////////////////////////////////
#include "x2_inc_compon"
#include "x0_i0_spawncond"
#include "se_respawn_inc"
void main()
{
int nClass = GetLevelByClass(CLASS_TYPE_COMMONER);
int nAlign = GetAlignmentGoodEvil(OBJECT_SELF);
object oKiller = GetLastKiller();
// If we're a good/neutral commoner,
// adjust the killer's alignment evil
if(nClass > 0 && (nAlign == ALIGNMENT_GOOD || nAlign == ALIGNMENT_NEUTRAL))
{
AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5);
}
// Call to allies to let them know we're dead
SpeakString("NW_I_AM_DEAD", TALKVOLUME_SILENT_TALK);
//Shout Attack my target, only works with the On Spawn In setup
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
// NOTE: the OnDeath user-defined event does not
// trigger reliably and should probably be removed
if(GetSpawnInCondition(NW_FLAG_DEATH_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1007));
}
craft_drop_items(oKiller);
// Do not respawn creature if tagged with _NSP eg. NW_GOBLINA_NSP
if (FindSubString(GetTag(OBJECT_SELF), "NSP") > -1)
return;
{ SE_DoCreatureRespawn(); }
{
object oPC = GetLastKiller();
if (!GetIsPC(oPC)) return;
object oTarget;
oTarget = OBJECT_SELF;
//Visual effects can't be applied to waypoints, so if it is a WP
//the VFX will be applied to the WP's location instead
int nInt;
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SCREEN_SHAKE), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SCREEN_SHAKE), GetLocation(oTarget));
//Visual effects can't be applied to waypoints, so if it is a WP
//the VFX will be applied to the WP's location instead
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DESTRUCTION), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DESTRUCTION), GetLocation(oTarget));
//add in to the top of the ondeath of the creature ffbj
}
//the following is the body of the script. I just left the void
//main in so it would compile.
object oBoss = OBJECT_SELF;//code begins
object oPC = GetLastHostileActor(oBoss);
object oArea = GetArea(oBoss);
string sBoss = GetName(oBoss);
string sPC = GetName(oPC);
string sArea = GetName(oArea);
object oPlayer = GetFirstPC();
if (GetIsDead(oBoss))
while (oPlayer != OBJECT_INVALID)
{ string sMessage = (sBoss + " was killed by "+sPC+" in "+sArea);
SendMessageToPC(oPlayer, sMessage);
oPlayer = GetNextPC();
}//end of code
}
_________________________ Realms of Shargast V1-V5ab, LOTR V15, The Undeath Clave & Faithful of Aerth
Fleshmelter - OBJECT_SELF in the OnPlayerDeath event IS the module. (OnPlayerDeath is a module event, as where OnDeath is a creature event so the creature is OBJECT_SELF).
If you want to tell who killed the player, try this
// object oBoss = OBJECT_SELF;//code begins