Brush Entity

Please post any questions about developing your plugin here. Please use the search function before posting!
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Brush Entity

Postby decompile » Mon Jan 09, 2017 5:51 pm

Hey,

Recently I have the problem that my created "trigger_multiples" arent firing the EntityOutput "OnStartTouch" or any other type.
I checked with EntityIter that the brush is created, but randomly some of them arent working/ if they dont exist.
Its hard to reproduce it, since I have no clue how they randomly disable itself.

Is there something known, or changed recently?
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Brush Entity

Postby L'In20Cible » Tue Jan 10, 2017 3:55 am

Code?
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Brush Entity

Postby decompile » Tue Jan 10, 2017 7:48 pm

As I said, I cant reproduce the issue with a code, but heres my code to create and the entity output:

Syntax: Select all

def createBrushTriggerr(zoneObj, stageObj):
origin = Vector(*map(min, zip(zoneObj.coords1, zoneObj.coords2)))
maxCoord = Vector(*map(max, zip(zoneObj.coords1, zoneObj.coords2)))
m_vecMaxs = maxCoord - origin
m_vecMins = Vector(0, 0, 0)
trigger_multiple = Entity.create("trigger_multiple")
trigger_multiple.spawn_flags = 4097
trigger_multiple.target_name = "Zone_%i" % zoneObj.id
if stageObj.filter_name is not None:
trigger_multiple.filter_name = stageObj.filter_name
trigger_multiple.model = trigger_model
trigger_multiple.origin = origin
trigger_multiple.spawn()
trigger_multiple.maxs = m_vecMaxs
trigger_multiple.mins = m_vecMins
trigger_multiple.solid_type = SolidType.BBOX
return trigger_multiple.index


Syntax: Select all

@OnEntityOutput
def startTouch(output_name, activator, caller, value, delay):
if caller.classname == 'trigger_multiple':
printToServerConsole(output_name)


Randomly one trigger doesnt work, but with another plugin I saw it exists from EntityIter and checking the targetname.
Also I tried to .spawn() it again via the EntityIter but it didnt fixed my issue.
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Brush Entity

Postby Ayuto » Tue Jan 10, 2017 8:15 pm

This is off-topic, but worth mentioning it. This line

Syntax: Select all

origin = Vector(*map(min, zip(zoneObj.coords1, zoneObj.coords2)))
could just be

Syntax: Select all

origin = zoneObj.coords1.min(zoneObj.coords2)
The same also exists for "max".

Regarding the issue: have you tried calling "Enable" on the trigger, when it didn't work anymore?
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Brush Entity

Postby decompile » Wed Jan 11, 2017 6:30 pm

No clue why, but it doesnt appear anymore. Weird.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 29 guests