EntityPostHook on start_touch

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
Retro
Junior Member
Posts: 9
Joined: Tue Mar 20, 2018 2:55 pm
Contact:

EntityPostHook on start_touch

Postby Retro » Tue Mar 20, 2018 3:20 pm

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.
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: EntityPostHook on start_touch

Postby Ayuto » Tue Mar 20, 2018 5:40 pm

"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
User avatar
Retro
Junior Member
Posts: 9
Joined: Tue Mar 20, 2018 2:55 pm
Contact:

Re: EntityPostHook on start_touch

Postby Retro » Wed Mar 21, 2018 6:12 am

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.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 26 guests