I am looking for an example of a test for low hp, switch to convo script. I have dug out Leldon and Lorne from the OC but the scripts are too complex for me to understand or work with.
Would anyone be kind enough to lead me to a simpler example that I can disect/understand and modify.
I think this came up earlier on this forum but its in a post and I cant remember/find where,
PJ
On low hp script
Débuté par
PJ156
, nov. 20 2010 12:44
#1
Posté 20 novembre 2010 - 12:44
#2
Posté 20 novembre 2010 - 03:03
Here's an example for you. For this to work, set the NPC as Immortal = True in its properties. This will allow the NPC to take damage down to 1 hit point but not be killed.
In the NPCs OnDamaged script slot, have something like the following:
This script compiles fine but is not tested in game.
In the NPCs OnDamaged script slot, have something like the following:
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((!GetIsPC(oNPC)) && (!GetIsOwnedByPlayer(oNPC)) && (!GetIsPlayerCreated(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(TRUE); // In a SP module, this is the player’s originally created character
AssignCommand(oSelf, ActionStartConversation(oPC, "convo_name_here", FALSE, FALSE, TRUE, FALSE ));
}
// Else NPC is not yet at 1 Hitpoint, so fire normal OnDamaged script
else
{
ExecuteScript("nw_c2_default6", oSelf);
}
}This script compiles fine but is not tested in game.
Modifié par _Knightmare_, 20 novembre 2010 - 03:04 .
#3
Posté 20 novembre 2010 - 07:02
On damaged script or on heartbat script for case where on damaged doesn't work.
SurrenderToEnnemies() or something like that, ClearAllActions(TRUE), and changing ennemie to a faction that isn't hostile before you can launch the conversation.
Combat event don't always work depending on the setting, but when they do it's better to use them.
SurrenderToEnnemies() or something like that, ClearAllActions(TRUE), and changing ennemie to a faction that isn't hostile before you can launch the conversation.
Combat event don't always work depending on the setting, but when they do it's better to use them.
Modifié par Shallina, 20 novembre 2010 - 07:03 .
#4
Posté 20 novembre 2010 - 07:06
Thanks to you both, I will have a go with that script _KM_ thanks very much. I can resart hostlities from the convo I create.
It seems to be just the basis I need since I doubt the NPC that will gate out mid combat will be the last to fall.
Thanks again, time to go and play.
PJ
It seems to be just the basis I need since I doubt the NPC that will gate out mid combat will be the last to fall.
Thanks again, time to go and play.
PJ
#5
Posté 20 novembre 2010 - 09:34
PJ156 wrote...
I am looking for an example of a test for low hp, switch to convo script. I have dug out Leldon and Lorne from the OC but the scripts are too complex for me to understand or work with.
Would anyone be kind enough to lead me to a simpler example that I can disect/understand and modify.
I think this came up earlier on this forum but its in a post and I cant remember/find where,
PJ
The standard scripts for doing this are gb_surrender_sp and gb_surrender_ud.
Regards
#6
Posté 21 novembre 2010 - 04:29
_Knightmare_ wrote...
Here's an example for you. For this to work, set the NPC as Immortal = True in its properties. This will allow the NPC to take damage down to 1 hit point but not be killed.
The script compiled and worked well thanks _KM_
It is of particular use as it ceases hostilities.
Now I am going to mess it up with a bit of inept customization.
Thanks _KM_ and to all who posted help/suggestions.
PJ





Retour en haut







