Custom Faction - Faction doesn't attack when attacked?
#1
Posté 30 janvier 2012 - 02:31
I have a custom faction set initially to 50. When testing the PC can attack and kill this faction and it won't fight back and its friends won't help either.
Have the campaign setting to attack neutral factions set to TRUE and all factions are Global. Am I doing something wrong?
#2
Posté 30 janvier 2012 - 02:34
#3
Posté 30 janvier 2012 - 03:00
#4
Posté 30 janvier 2012 - 03:18
M. Rieder wrote...
Like MC said, you could probably just as a few conditionals to make sure you want the NPC to turn hostile when attacked and then use SetStandardFaction() to turn them hostile to the PC.
Except you might want to adjust the faction's reputation with respect to the PC rather than changing the faction of the NPC to the Hostile faction.
If you change the faction of the NPC, you risk changing its relationship with respect to other NPCs. Of course, you should construct your faction table so that it doesn't suddenly get jumped by its buddies, but better safe than sorry.
#5
Posté 30 janvier 2012 - 03:19
I used a similar approach in Isle of Shrines for neutral NPCs, although that was a bit more complex as the script I wrote also turned their nearby allies hostile at the same time.
#6
Posté 30 janvier 2012 - 04:02
I see an option in DMFI to turn an entire area hostile or to the commoner faction. Also see the option to make a selected NPC hostile. But it runs into the same issue that MC pointed out, he'd get jumped by his buddies in some situations.
Perhaps there's a part of DMFI I'm missing? Seems like a DM would like to give his players the freedom of choosing who to consider a friend and who an enemy by having an adjust reputation command in the DMFI toolset without the need to prescript it in a conversation? Mmm...
Modifié par OrdinaryMan21, 30 janvier 2012 - 04:09 .
#7
Posté 30 janvier 2012 - 06:37
void main(object oPlaceholder,int oModified)
{
AdjustReputationWithFaction(GetFirstPC(1),oPlaceholder,oModified);
}
Basically in each conversation node I load the script as an action and place values for oPlaceholders and oModified which is the NPC with the faction I want to modify and the oModified being -100 or 100.
Problem is the script compiles but when I load it to my conversation and put it in an action node it crashes the client. Any ideas? Or more elegant solutions?
#8
Posté 30 janvier 2012 - 07:08
Regarding your particular script, I have not found a function called AdjustReputationWithFaction, just AdjustReputation (takes the same parameters you specify).
#9
Posté 30 janvier 2012 - 01:51
Difference between this one and AdjustReputation is the first is party-wide, and the latter is one PC-specific. It appears for me in the toolset when I attach the include script, and unless its deprecated or non-functioning appears to have a full description and entry.
My problem is not compiling, but instead attaching to a conversation node (in a DM-only book) as it crashes the toolset.http://social.bioware.com/forum/1/topic/172/new_post/9107436 as soon as I hit "refresh" to add the variables being passed onto the script.
#10
Posté 30 janvier 2012 - 05:09
If you wrote your script to fire from a conversation node, I have an idea about what might be causing your problem.
void main(object oPlaceholder,int oModified)
I'm not much of a conversation-node scripter. That being said, I'm not sure how you would pass an object from a convo node. A tag (as a string) would be fine, or you could identify the placeholder through script and save it as a local variable on some object you can retrieve.
When I wanted to give DMs faction-adjusting power, I created a wand (not too different from a book) that they would point at a target creature. Then I scripted a GUI (which is more advanced than a convo, to be sure) that would give them the options they wanted. In theory, you could just have a target designated when your DM pointed the widget, and then give them the faction options in text. For example:
"You have selected player <playername>. With which faction would you like to adjust <his/her> reputation?"
--DM choose faction--
"By how much?"
--DM chooses +/- amount--
"Done!" --fires adjustment script--
#11
Posté 30 janvier 2012 - 07:30
void main(string sPlaceholder,int oModified)
{
AdjustReputationWithFaction(GetFirstPC(1),GetObjectByTag(sPlaceholder),oModified);
}
Ideally, as you say, identifying the PC with a Wand might be better in case for whatever reason there are multiple groups around and GetFirstPC tags the wrong group. Im going to see if I can fiddle with this when I get back home
#12
Posté 06 février 2012 - 03:12
Here's the script:
#include "X0_I0_PARTYWIDE"
void main(string sPlaceholder, int iValue)
{
object oTarget = GetItemActivatedTarget();
object oFactionPig = GetObjectByTag(sPlaceholder);
if (GetIsObjectValid(oTarget) == TRUE) {
AdjustReputationWithFaction(oTarget,oFactionPig,iValue);}
}
The campaign setting USEPERSONALREPUTATION is set to TRUE. All set. Yet the Wand does nothing when used.
I cry.
Modifié par OrdinaryMan21, 06 février 2012 - 03:13 .
#13
Posté 06 février 2012 - 03:26
Then double-check that it finds oFactionPig successfully.
I can't see anything obvious mis-coded in your script, but there's a chance it's receiving bad info from elsewhere (like maybe the string passed by the convo doesn't exactly match the pig's tag).
#14
Posté 06 février 2012 - 08:12
All future Pig users. Repeat after me: FACTION PIGS CANNOT BE PLOT.
Now on to my Baaz death script.. mmm...
#15
Posté 06 février 2012 - 09:29
#16
Posté 17 mai 2012 - 05:24
i noticed that too, so did a lot of others on the old Bioware boardOrdinaryMan21 wrote...
Something I've noticed changed from NWN1 to NWN2: Factions don't change to hostile when attacked by a PC.
I've determined that this is a result of UsePersonalReputation=FALSE under Campaign Editor settings (regardless of the seemingly redundant setting CAMPAIGN_SWITCH_USE_PERSONAL_REPUTATION in the moduleLoad script, or whether the attacked faction is custom or standard)I have a custom faction set initially to 50. When testing the PC can attack and kill this faction and it won't fight back and its friends won't help either.
same.Have the campaign setting to attack neutral factions set to TRUE and all factions are Global.
imo, they made it so we can't do it right. While setting the campaign switch in the editor to TRUE will set neutral & friendly factions aggro, when attacked ( and, btw, enable Defenders to come to their aid! ), this setting also causes players to necessitate a manual attack sequence on creatures that are already Faction_Hostile -- companions eg won't auto-attack in AI-On mode, and Hostiles will appear blue instead of red on mouseovers in both AI & Puppet modes.Am I doing something wrong?
Functions from NwN that use personal reputation don't seem to work when PRep is set FALSE in NwN2. Like, SetIsTemporaryEnemy( ), so i just finished restructuring the primary OnPhysAttacked and OnSpellCastAt scripts to mimic that for GlobalRep. It seemed easier than trying to tell companions et al, 'yeah, that Ogre really is hostile bud' ... but i still haven't decided what to do such that Defenders will jump into the fray when their wards get attacked
EDIT, gonna try using "shouts" ....
MC, i Believe it's not so much the onAttacked scripts as it deals with personal reputation settings. If you remember my findings from this thread, re. Factions & Custom Factions -- the main result I was getting seems to have been caused by GetReputation parameters reversed (in the nwscript description), but what actually fixed that issue was that when changing the module into a campaign I set UsePersonalReputation=TRUEMasterChanger wrote...
I had this problem myself when creating a custom faction system. I believe that it may have something to do with the OnPhysicallyAttacked script attached to the NPC, but I'm not positive. I'd say that's a place to start, at least.
but i no longer want to do that since it means giving manual orders to attack against every goblin group ya meet ....
ps. My changes to the onAttacked scripts do a check for IsEnemy before adjusting reputation: my debug tells me that the engine itself is turning neutrals/friendlies aggro *before* getting to that check (when campaignPRep is true, when campaignPRep is false they would just stand there getting pounded on, aarg)
Modifié par kevL, 23 mai 2012 - 07:18 .





Retour en haut






