MOBs with Multiple factions

Discussion in 'General Modification' started by marc1967, Mar 2, 2019.

Remove all ads!
  1. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    578
    Likes Received:
    60
    I've observed that when a MOB's factions are defined directly in World Builder (WB), which overrides the setting in it's proto, things get a little problematic. Whenever a MOB is given more than one faction in World Builder WB, it seems to only recognizes the first one.

    I was told that you need to put a "0" after each faction listed in WB when you create a MOB, but I'm starting to question the need for that "0", as it seems to be the root of the problem.

    (As most people know, if am NPC is attacked and it has at least one matching faction number with another NPC standing nearby, both NPCs will join combat if either one of them is attacked. So, if you attack an NPC with factions "9 12", a nearby NPC with factions "9 11" will enter combat, since they both share a "9". An NPC with factions "1 14 22" will ignore the fray, unless attacked directly.)

    Some examples to clarify my observations:

    Example 1: If two MOBs have their factions set as follows, everything works fine. Nothing unusual.

    Code:
    MOB 1    MOB 2
    -----    -----     
      9        9
      0        0

    Example 2: If two MOBS have their factions set as follows, everything works fine. Nothing unusual.

    Code:
    MOB 1    MOB 2
    -----    -----     
      9        9
      0        0
      11       12
      0        0
    

    ** THE PROBLEMS START HERE **

    Example 3: If two MOBS have their factions set as follows:

    Code:
    MOB 1    MOB 2
    -----    -----     
      11       12
      0        0
      9        9
      0        0
    The second faction in each MOB (9) seems to be ignored.
    When the first MOB is attacked, the second MOB does not join in.
    And if the second MOB is also attacked, he joins combat, but doesn't get along with the first MOB. He'll take attacks of Opportunity on the first MOB, etc.
    It behaves as if the second faction in the list (9) is not even recognized, and it's just one MOB with faction 11, and the other with faction 12.

    (Note: This example has the same problem if the factions are changed to "1 0 9 0" and "2 0 9 0", so the problem is not that they are out of order numerically.)

    ** THIS NEXT EXAMPLE WORKS JUST FINE , CONTRARY TO WHAT I'VE BEEN TOLD **

    Example 4: If I break the rule about adding that "0" spacer, everything works. The matching faction of 9 is recognized and the two MOBs fight together:


    Code:
    MOB 1    MOB 2
    -----    -----     
      11       12
      9        9

    So, what's with that "0"? Is it really needed?

    It seems to void out any other faction that comes after it.

    Maybe this was never noticed because "9" is always listed first in most cases where a MOB has multiple factions.

     
  2. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    ToEE iterates the faction list under the assumption that it's 0 terminated. Not sure why anyone would say 0 after each faction, but that's clearly wrong, as it causes the engine to think the only faction is the first one.

    BTW good to see you, hoping to see your mod someday :)
     
  3. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    578
    Likes Received:
    60

    Well, that explains a lot. This quote below is sort of the official rule that's been followed since it was written from the Well Whaddya Know thread (https://co8.org/community/index.php?threads/well-whaddya-know.1999/page-3). It basically says to put a "0" after each faction number:


    Perhaps it should say only one trailing zero at the very end, instead of after each one. So it would actually be this:
    8
    19
    0

    I'll experiment and see.


    Thanks, you too. ;)

    The mod is moving along pretty well, maybe in a year. I really want to release something that will be a fully playable adventure that goes from level 1 - 12. I'm at about level 7 right now, but since I got by the frustrating learning curve a few years ago it goes pretty easy now instead of getting hung up on stupid things for a week.

    I just took about 6 months off, and I'll be going at it for a while again. It's called "Paladin's Cove" for those that are interested.

    When I first found this place I really wanted to contribute significantly to the main mod, or KOTB, but I was "late to the party" as the saying goes. I got here right at the start of that 2 year lull beginning in early 2014 when all the final versions of both mods were wrapping up, but before Temple+ got moving. By then, I was very invested in the work I had done on my own, so that's where I am.
     
  4. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    That post is wrong, it's a 32 bit array, just 0 terminated. I guess back in the day they thought it was 64 bit because it caused crashes when not null terminated? No matter. The engine wasn't as well understood back in 2006...
     
  5. Shiningted

    Shiningted I want my goat back Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,651
    Likes Received:
    350
    So in theory it all works? That's good. It explains moments like when you get into a fight in the tavern in Nulb and the pirates keep their distance - you must have (correctly) the relevant faction. Heh - I like moments like that.
     
Our Host!