Meaning of 64-bit AI flags

Discussion in 'Assorted Tech' started by Agetian, Jan 25, 2006.

Remove all ads!
  1. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    Heya,

    I thought I'd share something. :) The infamous 64-bit structure known in ToEEWB as "64-bit AI flags" (the one that shows up as a combination of 0's and 1's) actually comes from Arcanum and has similar, if not the same, meaning as there. In fact, only the first twelve bits are used. So, from left to right, they would be:

    1. Finding help -- the NPC is trying to find some help in a battle
    2. Waypoint delay -- the NPC is waiting for a delay to finish for his waypoints.
    3. Waypoint delayed -- the NPC has completed his delay to finish for his waypoints.
    4. Running off -- the NPC is running away.
    5. Fighting -- the NPC is fighting.
    6. Check Grenade -- the NPC has to check if he can throw a grenade (Arcanum leftover, most surely not used in ToEE anymore)
    7. Check Wield -- the NPC has to check what he has in his inventory to dress up, and dress up afterwards.
    8. Check Weapon -- the NPC has to check its weapon and possibly choose something else to wield.
    9. Look For Weapon -- (Arcanum leftover??) the NPC will look around its vicinity for a weapon and go grab it.
    10. Look For Armor -- (Arcanum leftover??) same for armor.
    11. Look For Ammo -- (Arcanum leftover??) same for ammo.
    12. Has Spoken Flee -- (Arcanum leftover??) the NPC has screamed about fleeing.

    Most of these flags are internal and should not be set in the editor. Instead, they are set/reset in the game process automatically. However, the flag that is of particular interest is flag #7 (Check Wield), which is very often set for human NPCs. It is usually set so that the NPC will dress up as soon as its created. So, setting this flag is often a good idea. ;)

    Now please, someone tell me what should we do so this information is not lost. May I suggest Ted to add this to one of his future tutorials?.. I don't want to *sticky* this post because it's minor compared to what should be stickied, yet it's important enough so I don't want this information to be lost in the course of time...

    Thanks go to Steve Moret for certain clarifications on this field.

    - Agetian
     
  2. darmagon

    darmagon stumbler in the dark

    Joined:
    Mar 22, 2005
    Messages:
    295
    Likes Received:
    0
    Hmmm...good stuff to know. I have a question for the moderators; Is there anyway to restrict the posting access for a thread such that only certain members (or only moderators, or some such) can post there? If so maybe we could start a moderated thread with info like the above and sticky it?

    Darmagon
     
  3. Shiningted

    Shiningted I want my goat back Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,651
    Likes Received:
    350
    Yes there is, because Agetian did it with the mob breakdown thread. And well done Agetian!
    Interesting... but my efforts to create NPCs in KotB who DIDN'T have weapons equiped (a pet grievance of mine, every NPC standing around with weapons drawn) by assigning slots to their weapons (in inventory not equipped slots) did nothing, or was instantaneously overridden. But certainly I did not have this flag (or any others) set.

    Agetian: what would a script to change these flags on the fly look like? Can we change them on the fly, by 'and'ing certain bits, for instance? And now I think of it, is there a way to 'equip' unarmed combat?
     
  4. Cerulean the Blue

    Cerulean the Blue Blue Meanie Veteran

    Joined:
    Apr 23, 2005
    Messages:
    1,962
    Likes Received:
    0
    I don't mean to highjack this thread, but I can't think of a better place to put this:

    Ted, you probably have already thought of this, but have you considered not giving your NPCs weapons in the mobs, but scripting them in instead, say via san_enter_combat. That way they will have no weapons to equip until combat starts, and once it does they will automatically equip the weapon (perhaps with a slight delay, which would reflect the necessity of drawing the weapon). You could also script it into sans_dying, so it would appear in the inventory if they got killed in the first round of combat.
     
  5. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    The possibility is that in fact this flag is also automatically controlled and is set by the game as soon as the NPC is created. I don't really know about whether it's true or not... If that's the default behavior, then probably this flag is internal too.

    I'm not sure if this flag would be editable manually in the script. Anyway, you *can* try this:

    <object>.obj_set_int(obj_f_ai_flags64, <value>)

    But the trick is - obj_set_int sets a 32-bit value, while obj_f_ai_flags64 is a 64-bit struct. I'm not sure if this would work or not. Of course, <value> is free to be operated with - you can ADD/OR bits there and so on.

    - Agetian

    Edit by SA: reading this flag (which is actually obj_f_npc_ai_flags64) causes a crash :/
     
    Last edited by a moderator: Jan 16, 2015
  6. Shiningted

    Shiningted I want my goat back Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,651
    Likes Received:
    350
    Hmmm...

    @Bluey - yes i have thought of that thanks, and its probably a direction I will go in if I decide to, ummm, bother. I think there is something to be said for merchants being emptyhanded (until attacked), guards and monsters walking around with weapons, and the quickdraw feat being of value.
     
    Last edited: Jan 26, 2006
  7. bradrinwi

    bradrinwi Established Member

    Joined:
    Mar 18, 2005
    Messages:
    226
    Likes Received:
    0
    i can look thru the dll and see if the flag is auto set...

    re #7 on first post...

    regarding seting can you add x+ the scrpit string for value to equal the 64 bit value??
     
Our Host!