Game Object Event Types

Game Object Added To Inventory

class S4CLGameObjectAddedToInventoryEvent(game_object)

Bases: sims4communitylib.events.event_handling.common_event.CommonEvent

An event that occurs after a Game Object has been added to the inventory of something.

Example usage:
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.modinfo import ModInfo

class ExampleEventListener:

    # In order to listen to an event, your function must match these criteria:
    # - The function is static (staticmethod).
    # - The first and only required argument has the name "event_data".
    # - The first and only required argument has the Type Hint for the event you are listening for.
    # - The argument passed to "handle_events" is the name of your Mod.
    @staticmethod
    @CommonEventRegistry.handle_events(ModInfo.get_identity().name)
    def handle_event(event_data: S4CLGameObjectAddedToInventoryEvent):
        pass
Parameters:game_object (GameObject) – The Object has been added to the inventory of something.
game_object

The Game Object that was added to the inventory.

Returns:The Game Object that was added to the inventory.
Return type:GameObject

Game Object Added To Game Object Inventory

class S4CLGameObjectAddedToGameObjectInventoryEvent(game_object, added_game_object)

Bases: sims4communitylib.events.event_handling.common_event.CommonEvent

An event that occurs when a GameObject is added to the inventory of another Game Object.

Example usage:
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.modinfo import ModInfo

class ExampleEventListener:

    # In order to listen to an event, your function must match these criteria:
    # - The function is static (staticmethod).
    # - The first and only required argument has the name "event_data".
    # - The first and only required argument has the Type Hint for the event you are listening for.
    # - The argument passed to "handle_events" is the name of your Mod.
    @staticmethod
    @CommonEventRegistry.handle_events(ModInfo.get_identity())
    def handle_event(event_data: S4CLGameObjectAddedToGameObjectInventoryEvent):
        pass
Parameters:
  • game_object (GameObject) – The Game Object that changed.
  • added_game_object (GameObject) – The Object that was added to the inventory of the Game Object.
added_game_object

The Game Object that was added.

Returns:The Game Object that was added.
Return type:GameObject
added_game_object_guid

The guid identifier of the Game Object that was added.

Returns:The guid identifier of the Game Object that was added.
Return type:int
added_game_object_id

The decimal identifier of the Game Object that was added.

Returns:The decimal identifier of the Game Object that was added.
Return type:int
game_object

The Game Object that had the Game Object added to its inventory.

Returns:The Game Object that had the Game Object added to its inventory.
Return type:GameObject

Game Object Initialized

class S4CLGameObjectInitializedEvent(game_object)

Bases: sims4communitylib.events.event_handling.common_event.CommonEvent

An event that occurs after a Game Object has been initialized.

Example usage:
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.modinfo import ModInfo

class ExampleEventListener:

    # In order to listen to an event, your function must match these criteria:
    # - The function is static (staticmethod).
    # - The first and only required argument has the name "event_data".
    # - The first and only required argument has the Type Hint for the event you are listening for.
    # - The argument passed to "handle_events" is the name of your Mod.
    @staticmethod
    @CommonEventRegistry.handle_events(ModInfo.get_identity().name)
    def handle_event(event_data: S4CLGameObjectInitializedEvent):
        pass
Parameters:game_object (GameObject) – The Game Object that was initialized.
game_object

The Game Object that was initialized.

Returns:The Game Object that was initialized.
Return type:GameObject

Game Object Loaded

class S4CLGameObjectLoadedEvent(game_object)

Bases: sims4communitylib.events.event_handling.common_event.CommonEvent

An event that occurs after a Game Object has been loaded.

Example usage:
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.modinfo import ModInfo

class ExampleEventListener:

    # In order to listen to an event, your function must match these criteria:
    # - The function is static (staticmethod).
    # - The first and only required argument has the name "event_data".
    # - The first and only required argument has the Type Hint for the event you are listening for.
    # - The argument passed to "handle_events" is the name of your Mod.
    @staticmethod
    @CommonEventRegistry.handle_events(ModInfo.get_identity().name)
    def handle_event(event_data: S4CLGameObjectLoadedEvent):
        pass
Parameters:game_object (GameObject) – The Game Object that was loaded.
game_object

The Game Object that was loaded.

Returns:The Game Object that was loaded.
Return type:GameObject

Game Object Spawned

class S4CLGameObjectSpawnedEvent(game_object)

Bases: sims4communitylib.events.event_handling.common_event.CommonEvent

An event that occurs after a Game Object has been spawned.

Example usage:
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.modinfo import ModInfo

class ExampleEventListener:

    # In order to listen to an event, your function must match these criteria:
    # - The function is static (staticmethod).
    # - The first and only required argument has the name "event_data".
    # - The first and only required argument has the Type Hint for the event you are listening for.
    # - The argument passed to "handle_events" is the name of your Mod.
    @staticmethod
    @CommonEventRegistry.handle_events(ModInfo.get_identity().name)
    def handle_event(event_data: S4CLGameObjectSpawnedEvent):
        pass
Parameters:game_object (GameObject) – The Game Object that was spawned.
game_object

The Game Object that was spawned.

Returns:The Game Object that was spawned.
Return type:GameObject

Game Object Pre Despawned

Game Object Pre Deleted

class S4CLGameObjectPreDeletedEvent(game_object)

Bases: sims4communitylib.events.event_handling.common_event.CommonEvent

An event that occurs before a Game Object has been deleted.

Example usage:
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.modinfo import ModInfo

class ExampleEventListener:

    # In order to listen to an event, your function must match these criteria:
    # - The function is static (staticmethod).
    # - The first and only required argument has the name "event_data".
    # - The first and only required argument has the Type Hint for the event you are listening for.
    # - The argument passed to "handle_events" is the name of your Mod.
    @staticmethod
    @CommonEventRegistry.handle_events(ModInfo.get_identity().name)
    def handle_event(event_data: S4CLGameObjectPreDeletedEvent):
        pass
Parameters:game_object (GameObject) – The Game Object that will be deleted.
game_object

The Game Object that will be deleted.

Returns:The Game Object that will be deleted.
Return type:GameObject

Game Object Pre Removed From Inventory

class S4CLGameObjectPreRemovedFromInventoryEvent(game_object)

Bases: sims4communitylib.events.event_handling.common_event.CommonEvent

An event that occurs before a Game Object has been removed from the inventory of something.

Example usage:
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.modinfo import ModInfo

class ExampleEventListener:

    # In order to listen to an event, your function must match these criteria:
    # - The function is static (staticmethod).
    # - The first and only required argument has the name "event_data".
    # - The first and only required argument has the Type Hint for the event you are listening for.
    # - The argument passed to "handle_events" is the name of your Mod.
    @staticmethod
    @CommonEventRegistry.handle_events(ModInfo.get_identity().name)
    def handle_event(event_data: S4CLGameObjectPreRemovedFromInventoryEvent):
        pass
Parameters:game_object (GameObject) – The Game Object that will be removed from the inventory of something.
game_object

The Game Object that will be removed from the inventory.

Returns:The Game Object that will be removed from the inventory.
Return type:GameObject

Game Object Pre Removed From Game Object Inventory

class S4CLGameObjectPreRemovedFromGameObjectInventoryEvent(game_object, removed_game_object)

Bases: sims4communitylib.events.event_handling.common_event.CommonEvent

An event that occurs before a Game Object is removed from the inventory of another Game Object.

Example usage:
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.modinfo import ModInfo

class ExampleEventListener:

    # In order to listen to an event, your function must match these criteria:
    # - The function is static (staticmethod).
    # - The first and only required argument has the name "event_data".
    # - The first and only required argument has the Type Hint for the event you are listening for.
    # - The argument passed to "handle_events" is the name of your Mod.
    @staticmethod
    @CommonEventRegistry.handle_events(ModInfo.get_identity())
    def handle_event(event_data: S4CLGameObjectPreRemovedFromGameObjectInventoryEvent):
        pass
Parameters:
  • game_object (GameObject) – The Game Object that changed.
  • removed_game_object (GameObject) – The Object that was removed from the inventory of the Game Object.
game_object

The Game Object that is having the Game Object removed from its inventory.

Returns:The Game Object that is having the Game Object removed from its inventory.
Return type:GameObject
removed_game_object

The Game Object that is being removed.

Returns:The Game Object that is being removed.
Return type:GameObject
removed_game_object_guid

The guid identifier of the Game Object that is being removed.

Returns:The guid identifier of the Game Object that is being removed.
Return type:int
removed_game_object_id

The decimal identifier of the Game Object that is being removed.

Returns:The decimal identifier of the Game Object that is being removed.
Return type:int