obj_is_carrying_obj_pid() or obj_carrying_pid_obj() ?

Discussion in 'Fallout General Modding' started by Sduibek, Feb 11, 2014.

  1. Sduibek

    Sduibek Creator of Fallout Fixt Moderator Modder

    Oct 27, 2010
    Thank you for any thoughts on this:

    Are these actually different or do they have identical function and purpose? The code uses both, in Fallout1 obj_carrying_pid_obj() about 50% more often, they are used in about 45 and 65 scripts respectively.
  2. Ardent

    Ardent A Smooth-Skin

    Jul 24, 2009
    These two functions are different. obj_is_carrying_obj_pid() returns an int, while obj_carrying_pid_obj() returns a pointer. That means the first one is used to e.g. check how many 10mm pistols the player has in the inventory, while the other is used to point to the 10mm pistol that the player is carrying, in order to do something with that pistol (e.g. remove it from the inventory).

    Same goes for tile_contains_obj_pid and tile_contains_pid_obj. One is used to check e.g. whether a critter of a certain pid number is standing on a given tile, and the other is to identify a critter of a given pid standing on a given tile, in order to e.g. move him to another tile, play animation etc.
  3. TheEart

    TheEart First time out of the vault

    Nov 8, 2013
    These are two different functions!

    obj_is_carrying_obj_pid(ObjectPtr obj, int pid) - returns the number of objects with ID prototype pid located in the inventory object obj
    Return value: number of objects with the specified PID

    (ObjectPtr who, int pid) - returns a pointer to the object ID of the prototype of a pid that is the object who
    Return value: a pointer to the object (ObjectPtr), if it has one who, otherwise NULL
    Last edited: Jan 12, 2015
  4. Sduibek

    Sduibek Creator of Fallout Fixt Moderator Modder

    Oct 27, 2010
    Thank you both.

    ... and now I feel really stupid, because they are explained in the Mapper2 scripting info. BAH! :wall: