|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
07-05-2009, 02:45 AM
|
Dragon
|
|
Join Date: Apr 2009
Location: California
Posts: 814
|
|
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;
+ }
}
...
|
|
|
|
07-05-2009, 01:21 PM
|
|
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
this is very interesting approach!
Personaly I prefer how they did it in EQ2 - where name color showed the level con of the mob, but RED outline around the name showed whenever its KOS or not (and if you were invised the outline would go away since mob can't see you), but I guess this is the luxury we don't have.
On other hand I was planning to use the (***) space to put indication of a power rank (again like in eq2, where they used Up Arrows to indicate if mob is solo, heroic or raid class)
Eitherway - this is a great innovation! I am sure some custom servers would like it.
|
07-06-2009, 05:32 PM
|
Discordant
|
|
Join Date: Sep 2006
Location: Green Bay, WI
Posts: 436
|
|
I really like the idea of this, I found a problem with it and really didnt look to much further. With this code added in pet classes will no longer be able to raise a pet, The spell goes off just as it should but the pet just never appears, and the regent is also consumed. I Ran out of time to do any further testing on this, sorry :(
*edit* this patch maybe fine for the stock source, I do have some custom code. The only thing i tested was pets work with the patch commented out, but with this active again pets no longer work.
|
07-06-2009, 05:40 PM
|
Dragon
|
|
Join Date: Apr 2009
Location: California
Posts: 814
|
|
That's... odd... do pets somehow make use of the lastName field?
|
07-06-2009, 06:14 PM
|
|
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
technicly pets should not be using the "hosile" tag. Even if its an npc's pet, the npc should be taged "hostile" , not pet. Pet is just pet
|
07-06-2009, 06:28 PM
|
Dragon
|
|
Join Date: Apr 2009
Location: California
Posts: 814
|
|
Right, and pets generally con as indifferent anyway, which would prevent them from ever getting to the tagging portion, which only activates for Glares Threateningly or Ready to Attack.
|
07-06-2009, 06:44 PM
|
Hill Giant
|
|
Join Date: Nov 2008
Location: Gold Coast, Oz
Posts: 119
|
|
Testing with an otherwise stock server, this change does indeed stop pets being raised. It's a shame, as it's the kind of thing that would make the game more friendly for very young players.
|
07-06-2009, 07:50 PM
|
Dragon
|
|
Join Date: Apr 2009
Location: California
Posts: 814
|
|
Roger that.
I'll have to take a deeper look to figure out what could possibly be going wrong with such a simple little piece of code.
|
07-06-2009, 11:02 PM
|
Dragon
|
|
Join Date: Apr 2009
Location: California
Posts: 814
|
|
Okay, apparently the problem was caused by a call to GetReverseFactionCon() for a non-player entity.
Fixed with the following code change:
File: mob.cpp, Line 817 - mob::FillSpawnStruct()
Code:
if (ForWho && ForWho->IsClient() && RuleB(World, FlagHostileNPCs))
{
switch (ForWho->CastToClient()->GetReverseFactionCon(this))
{
case FACTION_THREATENLY:
case FACTION_SCOWLS:
memcpy_s(ns->spawn.lastName, sizeof(ns->spawn.lastName), "Hostile", 8);
break;
}
}
On an unrelated note, I found that if you have a pet, you can aggro hostile NPCs even with the GM flag on. LOL.
It's hard to tell whether the pet's aggroing the NPC or the NPC is aggroing on the pet.
|
07-06-2009, 11:21 PM
|
|
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
hmm thats bad. I remember when back on the day your pet shared your faction - it was a nightmare. Since my pet was always lower level than my necro I could not just walk through a dungeon where mobs were allreday green - I had to kill every darn thing cuase it kept agroing on my pet.
But back in 2001 they finaly made it so your pet does not have a faction at all, so mobs never agro on the pet. So once mobs are green, you can walk around with lev 1 pet totaly safe
|
07-06-2009, 11:57 PM
|
Dragon
|
|
Join Date: Apr 2009
Location: California
Posts: 814
|
|
Apparently we could use the same change.
I just did some testing, and while a grey-con Level 40 hostile NPC will not attack a Level 75 character, it will attack its Level 2 pet, and then turn to the owner once the pet is dead.
Code:
Guard Legver glares at you threateningly -- You could probably win this fight.
Guard Legver hits Zarartik for 120 points of damage.
Zarartik has been slain by Guard Legver!
Guard Legver tries to hit YOU, but misses!
Zarartik tells you, 'Attacking Guard Legver Master.'
Guard Legver bashes YOU for 33 points of damage.
Also, pets can speak from beyond the grave. OooooOOOOOoooooh. Heh heh.
|
07-07-2009, 12:34 AM
|
|
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
hehe, but yeah this was a huge annoyance on LIVE, we realy need to get rid of it =P
|
07-07-2009, 01:09 AM
|
Dragon
|
|
Join Date: Apr 2009
Location: California
Posts: 814
|
|
Grr. There's still a slight problem with this feature.
It does the proper processing when a player zones in, FillSpawnStruct(&ns, Client) gets called for the particular client entering the zone, so they get the customized version of the NPC's lastname.
However, any new NPC spawn packets that get sent to the client after zoning in don't get processed in the same way... the same spawn packet gets sent to all clients in the zone, so NPCs that spawn after zoning in, via normal respawn cycles or #repop, won't have the customized lastname.
I'll have to do a little more work before this is 100% functional.
I'll probably have to move the processing into the QueuePacket() function, and things will get a little more complicated.
|
07-07-2009, 04:54 AM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Definitely an interesting option once the code issues are all worked out. Can you maybe just do an IsPet check before doing the case switch?
|
07-07-2009, 09:57 AM
|
Dragon
|
|
Join Date: Apr 2009
Location: California
Posts: 814
|
|
The pet problem isn't actually related to this at all, I just noticed it while testing. An IsPet check isn't part of the hostile NPC flagging.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 09:18 PM.
|
|
|
|
|
|
|
|
|
|
|
|
|