Aller au contenu

Photo

NPC Surrenders


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
archer4217

archer4217
  • Members
  • 105 messages
Hi all,

I'm looking for a script that makes a hostile npc surrender when he reaches a certain amt. of damage. Once he surrenders, I need the npc to to behave as if he's been captured and follow the PC to the jail. I tried doing it with the script generator, but no luck. Searched these forums too but found nothing.
I found one thing in the Lexicon, but it doesn't have info on checking for the npc's damage.

Any help is much appreciated. thanks :)

#2
Xardex

Xardex
  • Members
  • 217 messages
You might want to set the NPC to immortal so his HP wont be reduced below 1 by a lucky crit or something.
You could achieve this by with the NPC's OnDamaged script with these functions:

GetCurrentHitPoints
GetMaxHitPoints
AdjustReputation *
ClearAllActions **

* You might have to create a faction just for the NPC... I don't know, im not that experienced with faction functions.

** Apply this to both, the NPC and the PC.

Modifié par Xardex, 07 avril 2011 - 01:02 .


#3
archer4217

archer4217
  • Members
  • 105 messages
Awesome sweetie, thank you so much :)

#4
Bubba McThudd

Bubba McThudd
  • Members
  • 147 messages
Here is a surrender script I used in Agrenost. It causes the NPC to act out the meditate animation after he surrenders, so it looks like he's pleading for his life. It also creates a blood pool and a bag of incriminating evidence near the NPC.

------------------
void main()
{
int nHealth = GetCurrentHitPoints();
if((nHealth<18))
{
SurrenderToEnemies();
ClearAllActions();
GiveXPToCreature(GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC), 50 * FloatToInt(GetChallengeRating(OBJECT_SELF)));
ActionSpeakString ("No more, please!");
ActionPlayAnimation(ANIMATION_LOOPING_MEDITATE, 1.0f, 900.0f);
object oPC = GetLastDamager();


object oTarget;
object oSpawn;
location lTarget;
oTarget = oPC;

lTarget = GetLocation(oTarget);

oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "lootbag019", lTarget);
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "zep_bloodstain5", lTarget);


SetLocalInt(GetPCSpeaker(), "nZavog", 1);


}

}