Any and all help would be extremely appreciated.
--Weko
Modifié par _Knightmare_, 17 décembre 2010 - 09:31 .
Modifié par ffbj, 17 décembre 2010 - 11:15 .
Modifié par KenquinnTheInsaneOne, 17 décembre 2010 - 11:34 .
Modifié par _Knightmare_, 17 décembre 2010 - 11:43 .
void main() {
object oSelf = OBJECT_SELF;
location lLoc = GetLocation(oSelf);
int nHP = GetCurrentHitPoints(oSelf);
// If the NPC currently has 1 Hit Point left
if(nHP == 1) {
// Search through all creatures in a 20 meter radius centered on oSelf
object oNPC = GetFirstObjectInShape(SHAPE_SPHERE, 20.0f, lLoc, FALSE, OBJECT_TYPE_CREATURE);
while(GetIsObjectValid(oNPC)) {
// Clear combat states for every creature found in search
AssignCommand(oNPC, ClearAllActions(TRUE));
// Change NPC to Commoner Faction so no longer hostile
if (!GetIsObjectValid(oNPC)) {
ChangeToStandardFaction(oNPC, STANDARD_FACTION_COMMONER);
}
oNPC = GetNextObjectInShape(SHAPE_SPHERE, 20.0f, lLoc, FALSE, OBJECT_TYPE_CREATURE);
}
// Have the NPC begin a conversation with PC
object oPC = GetFirstPC(); // In a SP module, this is the player’s originally created character
AssignCommand(oSelf, ActionStartConversation(oPC, "vampirelord", FALSE, FALSE));
}
// Else NPC is not yet at 1 Hitpoint, so fire normal OnDamaged script
else {
ExecuteScript("x2_def_ondamage", oSelf);
}
}
wekoronshei wrote...
Ahh. Thanks. I'm still figuring all this stuff out and, apparently, haven't yet learned how to read scripts, let alone make them.