MiraQ wrote...
Say you create an item for the Knights of Alexandria. Let's give it the tag "faction_koa". In the OnClientEnter event in your module, the PC (GetEnteringObject()) will be oPC below.
- Create two NPCs in areas in your module where they won't be disturbed by anything. They can't be invulnerable or immortal. Their tags could be "factionnpc_koa" and "factionnpc_kok".
- Include nw_i0_plot in your OnClientEnter script, so HasItem will work (#include "nw_i0_plot").
- Do the following modification to the OnClientEnter event:
if(HasItem(oPC, "faction_koa"))
{
//Set factions friendly and hostile
AdjustReputation(oPC, GetObjectByTag("factionnpc_koa"), 100); //KoA faction will be friendly
AdjustReputation(oPC, GetObjectByTag("factionnpc_kok"), -100); //KoK faction will be hostile
if(!(GetLocalInt(oPC, "faction_koa"))
{
//Reward gold and exp
GiveXPToCreature(oPC, 100);
GiveGoldToCreature(oPC, 100);
SendMessageToPC(oPC, "You have received gold and exp for training as a Knight of Alexandria.");
//Make sure this only happens the first time you log in so it can't be exploited by logging in and out all the time.
SetLocalInt(oPC, "faction_koa", 1);
}
}
I've not tried it yet, but since placeables use factions, couldn't they be used for referrences instead of NPCs as is usually suggested? I'm just curious.
'> If they can, would that be the best method as well? IE... would a placeable demand fewer resources?
Modifié par kalbaern, 07 janvier 2011 - 07:26 .