builtin mob - boyism80/fb GitHub Wiki
Built-in Functions Documentation (Mob)
This document describes functions available to mob type objects.
target
Provides two functionalities to get or set the mob's current target.
target()
- Description:
Returns the current target of the mob. - Parameters:
- None
- Return Value:
fb.game.life|nil
: Current target object or nil if no target
- Example:
-- This is a real usage example from game scripts local current_target = mob:target() if current_target then me:message("Mob is targeting: " .. current_target:name()) else me:message("Mob has no target") end
target(new_target:fb.game.life)
- Description:
Sets the mob's target to the specified life object. - Parameters:
new_target:fb.game.life
: New target object (can be nil to clear target)
- Return Value:
- None
- Example:
-- This is a real usage example from game scripts mob:target(me) -- Set mob to target the current character
oblivion
Provides two functionalities to get or set the mob's oblivion target.
oblivion()
- Description:
Returns the current oblivion target of the mob. - Parameters:
- None
- Return Value:
fb.game.life|nil
: Current oblivion target or nil if none
- Example:
-- This is a real usage example from game scripts local oblivion_target = mob:oblivion() if oblivion_target then me:message("Mob has oblivion target: " .. oblivion_target:name()) end
oblivion(new_target:fb.game.life)
- Description:
Sets the mob's oblivion target to the specified life object. - Parameters:
new_target:fb.game.life
: New oblivion target (can be nil to clear)
- Return Value:
- None
- Example:
-- This is a real usage example from game scripts mob:oblivion(me) -- Set mob's oblivion target to current character
owner
owner()
- Description:
Returns the owner of the mob (usually the character who summoned it). - Parameters:
- None
- Return Value:
fb.game.character|nil
: Owner character or nil if no owner
- Example:
-- This is a real usage example from game scripts local mob_owner = mob:owner() if mob_owner then me:message("Mob owner: " .. mob_owner:name()) else me:message("Mob has no owner") end
items
items()
- Description:
Returns a table containing all items that the mob is carrying. - Parameters:
- None
- Return Value:
table
: Table containing item objects
- Example:
-- This is a real usage example from game scripts local mob_items = mob:items() for _, item in pairs(mob_items) do me:message("Mob has item: " .. item:model():name()) end