Page 1 of 1

EntityPostHook on start_touch

Posted: Tue Mar 20, 2018 3:20 pm
by Retro
I cant seem to get start_touch to convert the Pointers to Entities not sure what I'm doing wrong.

Syntax: Select all

@EntityPostHook(EntityCondition.equals_entity_classname("trigger_multiple"), 'start_touch')
def Entity_StartTouch(stack, arg2):
#arg2 seems to always be None
ent = make_object(Entity, stack[0])
ent2 = make_object(Entity, stack[1])


Code: Select all

[SP] Caught an Exception:
Traceback (most recent call last):
  File "..\addons\source-python\plugins\timer\timer.py", line 99, in Entity_StartTouch
    ent = make_object(Entity, stack[0])
  File "..\addons\source-python\packages\source-python\entities\_base.py", line 218, in _obj
    return cls(index_from_pointer(ptr))

ValueError: Conversion from "Pointer" (<_memory.Pointer object at 0x00DD44A0>) to "Index" failed.

Re: EntityPostHook on start_touch

Posted: Tue Mar 20, 2018 5:40 pm
by Ayuto
"arg2" is the return value of the original function. In this case it always returns None, because CBaseEntity::StartTouch doesn't return something (the return type is void, which means that nothing is being returned).

Regarding your actual problem:
You are probably experiencing the same issue like here:
viewtopic.php?p=7542#p7542

Re: EntityPostHook on start_touch

Posted: Wed Mar 21, 2018 6:12 am
by Retro
Ayuto wrote:"arg2" is the return value of the original function. In this case it always returns None, because CBaseEntity::StartTouch doesn't return something (the return type is void, which means that nothing is being returned).

Regarding your actual problem:
You are probably experiencing the same issue like here:
viewtopic.php?p=7542#p7542


Thank you for the explanation for the life of me I couldn't figure out what i was doing wrong.