Just thought I would post on how to create a new faction and attach it to a new NPC.
This is for those just learning, so I kept it simple, using an example, all in one post
You will be creating two NEW (numerical) id's in two different database tables.
STEP ONE:
First, in the
faction_list table, create your new faction with id and a name.
MAKE SURE "id" is a new (higher) number than any used.(sort the list numerically)
The name can be what you want, then set the base value.
Example:
Code:
id name base
516 the Faction Guards -700
Keep in mind, the base value is what a player will start out at with any NPC on this
faction In the example above, -700 is dubious. Here's the table of values to reference:
1101 -> ABOVE ALLY
701 -> 1100 WARMLY
401 -> 700 KINDLY
101 -> 400 AMIABLE
0 -> 100 INDIFFERENT
-100 -> -1 APPREHENSIVE
-700 -> -101 DUBIOUS
-999 -> -701 THREATENLY
-1000 -> BELOW SCOWLS
STEP TWO:
NOW, go into the
npc_faction table and create a new id. Again, a higher unused number.
Example: (1328 is the NEW id number and 516 is the id you created in faction_list table)
NOTE: the "name" (in this step) can have no blank spaces. Use underscores (like in NPC names)
Code:
id name primaryfaction ignore_primary_assist
1328 the_Faction_Guards 516 0
There. Now your new faction is created. All you have to do is create your new NPC and
put it on your new (sample) faction called "the Faction Guards". Using the 1328 example.
That is the number you give an NPC in the npc_types table under the npc_faction field.
If you are using George's Tools, the NPC Editor comes in handy to do that, as well
Scripts to help out with faction:
If you're setting up an NPC that requires faction to talk to, you can put this quest
script on the NPC. In this example, it checks the player's faction points to
see if there is enough to con ally, from starting at dubious, causing the NPC
to respond.
Example : 2001 is the amount needed to get from dubious -700 to ally 1101
Code:
sub EVENT_SAY {
$myfaction = $client->GetCharacterFactionLevel(516); # 516 is the new id from the faction_list table.
if ($text=~/Hail/i && $myfaction >= 2001 ) {
quest::say("Greetings $name. I am with the Faction Guards. How can I help you?");
} else {
quest::say("Go away fool, I have no time for you!"); # example response if there isn't enough faction.
}
}
So, now, if you are interested in a little script to add to a killable mob that
will raise,(or lower) that new faction, this is a simplified one.
The 516 is the id, the 30 is the amount of faction points gained from the kill.
The last number 0, keeps the value permanent on the player record, unless raised
or lowered. To lower from a kill, example, just change that "30" to a -30.
Code:
sub EVENT_DEATH_COMPLETE {
quest::faction(516, 30, 0);
}
Upon killing an NPC using all this as an example, your client gets a message:
"Your faction with the Faction Guards just got better".