You are here

HELP! 1: A member of a non-standard faction should become hostile to PC, but not everyone else...

5 posts / 0 new
Last post
fkirenicus
HELP! 1: A member of a non-standard faction should become hostile to PC, but not everyone else...

FACTION: Neutral-Hostile. 
ACTOR: Weak Thug

Conversation ends with violence, as it often does with such never-do-gooders. However, we don't want to use ga_attack and turn our enemy into the Hostile Faction, because then he goes on a rampage killing everyone in... well, not sight, sense, is more like it (he can spot each damn creature on the map, it seems...). So, we (try to) create our own script, ga_fk_set_enemy:

// a_DoStuff (string sTarget)
/*
Description:
 
Parameters:
sTarget -  Tag of the target object.  Default is OWNER.
 
 
=== Action Script general Info ===
This is a conversation action script template.  
Action script names are usually prefixed as follows:
"ga_" - global action script
"ka_" - campaign action script
"<moduleID>a_" - module action script
Conversation actions and conditions are the only scripts that can have parameters.
Any number and many types of parameters can be passed.
*/
// Name_Date
 
#include "ginc_param_const"
#include "ginc_actions"
#include "nw_i0_generic"
 
void main(string sTarget)
{
// Get the PC Speaker - if used from command line, then use OBJECT_SELF
// In a conversation, OBJECT_SELF refers to the NPC.
// From the command line, OBJECT_SELF refers to the currently possesed character.
    object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());
 
// Find a target by Tag - also supports "$PC", "$OWNED_CHAR", etc. (see list in ginc_param_const)
// Optional second parameter can be added to change the default target.
object oTarget = GetTarget(sTarget);
 
// If debug text is on, this will let you know the script fired.
PrettyDebug("Script Fired on target: " + GetName(oTarget) + "!");
 
// Do stuff here
SetIsTemporaryEnemy(oPC, OBJECT_SELF, FALSE);
AssignCommand(OBJECT_SELF, StandardAttack(OBJECT_SELF, oPC, FALSE));
AssignCommand(OBJECT_SELF, DetermineCombatRound(oPC));
}
 
Our problem? He attacks once, and that's that... No matter what I do, it seems in order to get the thug to actually enter into combat with the PC, I have to change to standard faction Hostile.... So, what am I doing wrong?

- fkirenicus -

  • up
    50%
  • down
    50%
fkirenicus

Faction PIGS... are you serious?? I've used Faction OBJECTS before, but...PIGS?? Jeeez. 

  • up
    50%
  • down
    50%
kevL's

yeah faction pigs :) know em, love em, they work script-hidden


re. combat vs. PC only. Think of the OC, the Light of Heavens combats. To get LoH to fight only the PC the rest of the party gets cleared.

Have you found the "PersonalReputations" switches yet? This is a can o' worms (in Nwn2); eg, each party-member is considered to be in its own faction, and the ai seems to be hardcoded to not let companions auto-attack like you'd think they should. It's like the player has to give the command to attack to each companion ... not fun for peeps who want to watch their party do its thing.

But SetIsTemporary*() won't work [probably] unless PersonalReputations is turned on. So /everyone/ uses ChangeToStandardFaction(HOSTILE) instead.

so, it's a bit of a bumpy road to get what you want,


ps.

AssignCommand(OBJECT_SELF, ...); is redundant.

pps. If it's okay for speaker to combat the whole party, yes use a faction pig that's hostile to PC-faction but nobody else. Then call ChangeFaction() to change speaker's faction to the pig's faction.

  • up
    50%
  • down
    50%
fkirenicus

Yep, thanks. Got it working using Katrina's NWN2 guide, don't think I've ever seen something about faction pigs anywhere else. This is utterly lame, IMHO, but it works well enough. 
I must admit I have tried to find the PersonalReputation switches, but so far I don't think I have been successful. All Reputation-related switches seem to me to be faction-related, which means that if the PC in the example above has a companion, the attacker will attack both PC and companion. And that's not really what I want... Not all the time, at any rate. Are these found in an elusive include somewhere?
Thanks for reminding of LoH from the OC, I can try to check how that is done, then. That's chapter 3, right (been a while since I last played the OC)?

  • up
    50%
  • down
    50%
kevL's

PersonalReputation can be toggled in the CampaignEditor: UsesPersonalReputations. And/or it can be toggled per module in the OnModuleLoad script:

    SetGlobalInt(CAMPAIGN_SWITCH_USE_PERSONAL_REPUTATION, FALSE);


My description above of what it does shouldn't be taken literally. I looked into this years ago and as soon as i came across the quirk with companions not auto-attacking (whether or not in puppet-mode) thought "I'm not going to use this" and dropped it.

in Nwn1 I always built with it on - it's just so convenient. But the Nwn2 engine seems to have made its meaning ambiguous; am sure that's the reason i rarely come across it in the stock scripts, and when I do - SetIsTemporary*() functions, for example ... i mean, I had occasion to test SetIsTemporaryEnemy() just days ago and it didn't appear to work (the description of the function actually says "Make oSource into a temporary enemy of oTarget using personal reputation.").

so ... faction pigs + custom faction table(s)
 

  • ... that if the PC in the example above has a companion, the attacker will attack both PC and companion. And that's not really what I want...

It takes a bit of scripting, yes ... one way is to remove the companions from the party and re-add them after combat. Another might be to loop over the party and set all not-Owned characters script-hidden w/ SetScriptHidden() and uncommandable w/ SetCommandable().

Note that Lilac's generator doesn't likely deal well with companions, it has no knowledge of functions like GetIsRosterMember() and GetIsOwnedByPlayer() etc etc

  • up
    100%
  • down
    0%