View Single Post
  #1  
Old 07-05-2009, 02:45 AM
Shendare
Dragon
 
Join Date: Apr 2009
Location: California
Posts: 814
Default New Rule: Flagging Hostile NPCs

Some server admins might like this idea and some might not, but I figured it was worth putting out there as an option.

When exploring areas with multiple factions, some of which may be hostile, it can be stressful to need to manually con each and every NPC you come across to see whether it's on a hostile faction or not.

I have created a rule that, when activated, changes the title of any hostile NPC to "(Hostile)" when sending NPC spawns to the client, causing it to appear beneath the name of the NPC.

I would have preferred to be able to make the name a different color, but it looks like this will have to do.



Required SQL:
Code:
INSERT INTO rule_values VALUES (1, 'World:FlagHostileNPCs', 'true', 'If true, hostile NPCs show (Hostile) beneath their name');
File - ruletypes.h (Line 105)
Code:
...
  RULE_INT ( World, SoFStartZoneID, -1 ) //Sets the Starting Zone for SoF Clients separate from Titanium Clients (-1 is disabled)
+ RULE_BOOL ( World, FlagHostileNPCs, false) // Shendare: If true, displays (Hostile) under names of hostile NPCs
RULE_CATEGORY_END()
...
File - mob.cpp (Line 813) - Mob::FillSpawnStruct()
Code:
...
    memset(ns->spawn.set_to_0xFF, 0xFF, sizeof(ns->spawn.set_to_0xFF));

+   switch ((ForWho && RuleB(World, FlagHostileNPCs)) ? ForWho->GetReverseFactionCon(this) : 0)
+   {
+     case FACTION_THREATENLY:
+     case FACTION_SCOWLS:
+       memcpy_s(ns->spawn.lastName, sizeof(ns->spawn.lastName), "Hostile", 8);
+       break;
+   }
  }
...
Reply With Quote