#398 faction isnt being tracked correctly

Closed
opened 2 years ago by neatz09 · 5 comments
neatz09 commented 2 years ago

example -> cazic-thule default faction level for tae ew lizardmen(124) is -45000, upon zone in(with spawn faction setup and not discovered this faction yet) lizardmen are KoS, kill one. lizardmen no longer kos and faction shifts to -100 instead of the -45100 that it should be

example -> cazic-thule default faction level for tae ew lizardmen(124) is -45000, upon zone in(with spawn faction setup and not discovered this faction yet) lizardmen are KoS, kill one. lizardmen no longer kos and faction shifts to -100 instead of the -45100 that it should be
devn00b commented 2 years ago
Owner

Started looking into this. When killing a lizard man just down the stairs. 1st kill: -----DEV1--- Original Faction Value 0 -----DEV---- Faction ID 124. Amount 100 (to reduce) Faction Value: -100

2nd kill: -----DEV1--- Original Faction Value -100 -----DEV---- Faction ID 124. Amount 100 (to reduce) Faction Value: -200 in faction.cpp line ~162 faction_values[faction_id] -= amount;

Seems that faction_values are returning 0 because we have no faction yet. After the 1st kill, it gets set to -100 and goes down from there. Will look further into this when I get some time.

Started looking into this. When killing a lizard man just down the stairs. 1st kill: -----DEV1--- Original Faction Value 0 -----DEV---- Faction ID 124. Amount 100 (to reduce) Faction Value: -100 2nd kill: -----DEV1--- Original Faction Value -100 -----DEV---- Faction ID 124. Amount 100 (to reduce) Faction Value: -200 in faction.cpp line ~162 faction_values[faction_id] -= amount; Seems that faction_values are returning 0 because we have no faction yet. After the 1st kill, it gets set to -100 and goes down from there. Will look further into this when I get some time.
neatz09 commented 2 years ago
Collaborator

i actually stumbled upon my own answer to this... our db was never setup for this shit though im not sure if we have code or not to hide factions until discovered... will have to test that once i get around to adding the entries

i actually stumbled upon my own answer to this... our db was never setup for this shit though im not sure if we have code or not to hide factions until discovered... will have to test that once i get around to adding the entries
neatz09 commented 1 year ago
Collaborator

quests reward faction but do not notify player of faction shift and do not appear in character sheet until zoning

quests reward faction but do not notify player of faction shift and do not appear in character sheet until zoning
devn00b commented 1 year ago
Owner

Next time I update should have all this fixed. Should be tonight/tomorrow.

1) faction updates, without a faction discovered will add the default value to the DB, on character save it will do the math and set the faction correctly.

2) Adding lua function ChangeFaction() to handle well changes in faction. ChangeFaction(Spawn, , ) Can be used in two ways.

To add faction: ChangeFaction(Spawn, 33, 100) will add 100 faction to the faction City Rats.

To remove faction: ChangeFaction(Spawn, 33, -100) will subtract 100 faction to the faction City Rats.

Note, factions dont update in the db until a character save is completed.

Next time I update should have all this fixed. Should be tonight/tomorrow. 1) faction updates, without a faction discovered will add the default value to the DB, on character save it will do the math and set the faction correctly. 2) Adding lua function ChangeFaction() to handle well changes in faction. ChangeFaction(Spawn, <factionid>, <value>) Can be used in two ways. To add faction: ChangeFaction(Spawn, 33, 100) will add 100 faction to the faction City Rats. To remove faction: ChangeFaction(Spawn, 33, -100) will subtract 100 faction to the faction City Rats. Note, factions dont update in the db until a character save is completed.
devn00b commented 1 year ago
Owner

I removed possibly (2) DB read/writes by using a native function and removing the re-read from the DB of the faction. Removed the not needed function.

Noticed in factions.cpp ~line 118 if(faction_values.count(faction_id) == 0) return master_faction_list.GetDefaultFactionValue(faction_id);

In testing it always returned 1, so we would never set the default and just returned the faction value (0 since we didn't really have it). I will investigate further.

I removed possibly (2) DB read/writes by using a native function and removing the re-read from the DB of the faction. Removed the not needed function. Noticed in factions.cpp ~line 118 if(faction_values.count(faction_id) == 0) return master_faction_list.GetDefaultFactionValue(faction_id); In testing it always returned 1, so we would never set the default and just returned the faction value (0 since we didn't really have it). I will investigate further.
Sign in to join this conversation.
Loading...
Cancel
Save
There is no content yet.