abstract
| - There are several ways to do this. It all depends on what your doing at hand. Here is a list of all the functions you can use to alter Faction. AdjustFactionReputation AdjustReputation ChangeFaction ChangeToStandardFaction ClearAllFactionMembers ClearPersonalReputation SetIsEnemy SetIsTemporaryEnemy SetIsTemporaryFriend SetIsTemporaryNeutral SetPCDislike SetPCLike SetStandardFactionReputation SurrenderToEnemies AdjustReputation() Is probably the most used of these functions. In a conversation, lets say you want the NPC to attack if the PC selects a specific text line. This would then go into the "Actions Taken" script node. #include "NW_I0_GENERIC" void main() { object oPC = GetPCSpeaker(); AdjustReputation(oPC,OBJECT_SELF,-100); DetermineCombatRound(oPC); } Notice the DetermineComabatRound(oPC) line, without this the NPC will change to Red to the PC, but will just stand there looking stupid. The DetermineCombatRound call makes the NPC "re-perceive" the Already Perceived PC. This will make the NPC hostile to the PC, if you want them to be hostile to the entire PC party, use AdjustFactionReputation() instead. This function is different in that it makes the NPC faction hate the Entire PC faction which is his party. #include "nw_i0_plot" #include "NW_I0_GENERIC" void main() { object oPC = GetPCSpeaker(); AdjustFactionReputation(oPC,OBJECT_SELF,-100); DetermineCombatRound(oPC); } Like wise, you can make a Hostile creature like a PC or other faction by changing the -100 to +80. Why not +100?. Unless you want the creature to be "green" to the PC and not be able to attack ever again (in non-pvp server) then you don't want to adjust them to 100. The game engine will see that Creature as an "ally", kind of like another PC, and if your playing non-PVP, you won't be able to attack them again. A Note to remember, A PCs faction can not be changed. You must always change how a NPC faction views a PC. When PCs are solo, they each have their own faction, When PCs are grouped, each PC in the group shares the same faction. If you want to actually change a faction of a NPC, then use ChangeFaction() for custom factions, and use ChangeToStandardFaction() to change to one of the standard factions. Standard factions are; STANDARD_FACTION_COMMONER STANDARD_FACTION_DEFENDER STANDARD_FACTION_HOSTILE STANDARD_FACTION_MERCHANT Lets say we want to change a NPC from FactA to a FactB faction during a conversation. Your "Actions Taken" script might look something like this. void main() { //Get a creature object of the FactB faction object oFactBMember = GetObjectByTag("Tag_of_FactB_Member"); ChangeFaction(OBJECT_SELF,oFactBMember); } Now during that conversation, the NPC will change from his current faction, to that of the FactB creature. The SetIsTemporary* Functions, will alter a NPCs Faction (how it view another object or PC) temporarily. You can specify how long the NPC likes or dislikes the other faction. It can also be used to change how the NPC feel permanently by setting the bDecays parameter to FALSE. All depends how you need to handle the situation. To make a PC like, or Dislike (red) another PC, use the SetPCDislike() & SetPCLike() Functions. This is how you can make one PC glow "red" when mouse over by another PC. Keep in mind this also makes that PC view you as Red also. That's the basic run down on factions, if you would like more specifics of any one of the functions listed above and how to use it, (not a specific script request please) let me know.
|