obj_is_carrying_obj_pid() or obj_carrying_pid_obj() ?

Sduibek

Creator of Fallout Fixt
Moderator
Modder
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.
 
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.

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.
 
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

obj_carrying_pid_obj
(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:
Thank you both.

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