Page 1 of 1

Cancel GameEvent

Posted: Sun May 24, 2015 4:15 am
by necavi
Is there currently a way to cancel/block/stop broadcast on a game event?

Posted: Sun May 24, 2015 7:09 am
by satoon101

Posted: Sun May 24, 2015 7:39 am
by necavi
Thanks! I can't believe I failed at searching that much.

Posted: Sun May 24, 2015 2:11 pm
by satoon101
I just now realized that those 2 scripts won't fully work with the newest version of SP. There have been some name changes since then. GameEventManager has been changed to game_event_manager. Also, both Argument and Return have been combined into DataType. So, it would now look more like this:

Syntax: Select all

from memory import get_object_pointer
from memory import make_object
from memory import Convention
from memory import DataType
from events import GameEvent
from events.manager import game_event_manager
from memory.hooks import PreHook
from core import PLATFORM

FIRE_EVENT_FUNC = get_object_pointer(
game_event_manager).make_virtual_function(
7 if PLATFORM == 'windows' else 8,
Convention.THISCALL,
(DataType.POINTER, DataType.POINTER, DataType.BOOL),
DataType.VOID
)

@PreHook(FIRE_EVENT_FUNC)
def pre_fire_event(arguments):
game_event = make_object(GameEvent, arguments[1])
if game_event.get_name() == 'player_death':
arguments[2] = True