Script for setting faction/faction relationship during game play??
#1
Posté 14 juin 2013 - 11:10
#2
Posté 14 juin 2013 - 11:28
For custom factions: AdjustFactionReputation()
More information: NWN Lexicon on Reputation and Faction Functions
#3
Posté 14 juin 2013 - 11:49
The trick:
each creature has no AI scripts. Delete them all.
each creature has one of the custom factions.
each creature is tagged with the name of the custom faction they belong to
none of these creatures should be targeted with plot, and none of them should be able to see one another (although without any AI scripts this probably doesn't matter)
then when you want to adjust a faction's reputation relative to another or to the PC:
search by tag for the faction name
adjust reputation
#4
Posté 14 juin 2013 - 11:56
#5
Posté 15 juin 2013 - 12:43
#6
Posté 16 juin 2013 - 01:29
#include "nw_i0_plot"
void main()
{
// Get the faction focus objects
object oPC = GetObjectByTag("Faction_Focus_PC");
object oDojo = GetObjectByTag("Faction_Focus_Dojo");
// Get how the PC and Dojo feel about each other now.
int nReputationWithPC = GetReputation(oDojo, oPC);
int nReputationWithDojo = GetReputation(oPC, oDojo);
// Get how the PC should feel about the Dojo and vice versa. This
// info is set by any script that persistently adjusts how the factions feel
// about each other.
int nStoredReputationWithPC = GetCampaignInt("MyCampaign", "Reputation_PC_Dojo");
int nStoredReputationWithDojo = GetCampaignInt("MyCampaign", "Reputation_Dojo_PC");
// Adjust the reputations to the desired values.
AdjustFactionReputation(oDojo, oPC, nStoredReputationWithPC - nReputationWithPC - 100);
AdjustFactionReputation(oPC, oDojo, nStoredReputationWithDojo - nReputationWithDojo - 100);
}
#7
Posté 16 juin 2013 - 02:24
void main()
{
// Get the PC and Dojo faction focus object
object oPC = GetLastAttacker();
object oDojo = GetObjectByTag("Faction_Focus_Dojo");
// Adjust how the Dojo feels about the PC
AdjustReputation(oPC, oDojo, -100);
}Note that we don't get a faction focus for the PC. We just get him instead.
Modifié par Squatting Monk, 16 juin 2013 - 02:30 .
#8
Posté 16 juin 2013 - 02:24
Modifié par Squatting Monk, 16 juin 2013 - 02:26 .
#9
Posté 16 juin 2013 - 02:53
henesua wrote...
The typical way to do this is to have a few creatures in an area that are out of play and to target these creatures with the faction adjustments.
The trick:
each creature has no AI scripts. Delete them all.
each creature has one of the custom factions.
each creature is tagged with the name of the custom faction they belong to
none of these creatures should be targeted with plot, and none of them should be able to see one another (although without any AI scripts this probably doesn't matter)
then when you want to adjust a faction's reputation relative to another or to the PC:
search by tag for the faction name
adjust reputation
Couldn't you also do this with placeables?
#10
Posté 16 juin 2013 - 03:40
#11
Posté 18 juin 2013 - 06:47
#12
Posté 18 juin 2013 - 10:51
#13
Posté 19 juin 2013 - 12:11
No, you don't need to include anything. Here's a simple demo. Notice that when you attack the door, both the faction focus and the member of the faction go hostile. (Though neither of them will attack you, since they do not have scripts assigned making them do so).Groove Widdit wrote...
I still can't get it to work, Monk. Is there a header file?
IIRC, both the plot and immortal flags stop this from working. This is why it's important to keep your factions focuses isolated and unscripted. Don't want them killing each other.BelowTheBelt wrote...
Quick question... How does the plot setting on the NPC faction creatures affect the custom factions?
#14
Posté 19 juin 2013 - 12:14
#15
Posté 19 juin 2013 - 03:15
#16
Posté 19 juin 2013 - 06:19





Retour en haut







