Page 1 of 1

Tempent Troubles

Posted: Tue May 01, 2018 10:09 pm
by quartata
I was trying to create a small sphere using the effects module. This is a sample plugin:

Syntax: Select all

import commands.typed
import effects
import filters.recipients
import players.entity


@commands.typed.TypedClientCommand("ball")
def ball(cmdinfo):
recipients = filters.recipients.RecipientFilter()
recipients.update(cmdinfo.index)

pos = players.entity.Player(cmdinfo.index).origin
print(pos)

effects.ball(recipients, pos, 10)


Nothing appears when the command is run, however. Am I doing this correctly? This is on TF2, although I do have my graphics settings fairly low so maybe I just can't see it (I doubt it, since I can still see particle effects and what not)

Re: Tempent Troubles

Posted: Tue May 01, 2018 10:31 pm
by satoon101
2 things come to mind. First, a player's 'origin' is at their feet, so you will need to look down to see it. Also, the distance from a player's origin (feet) to their eye location is 64 game units (in CS:S, at least). So, 10 units as the radius is very small.

Re: Tempent Troubles

Posted: Tue May 01, 2018 10:42 pm
by quartata
Moved it up by 100 HUs just to see if it was stuck in the ground and my game instantly crashed when I looked up (client, not server). Fun.

Re: Tempent Troubles

Posted: Tue May 01, 2018 10:45 pm
by quartata
I'll try a different effect to see if maybe it's specific to the ball one.

Re: Tempent Troubles

Posted: Tue May 01, 2018 10:59 pm
by quartata
Thinking that might have had something to do with me copying the origin vector... I tried something even simpler, which wasn't visible but did not crash my game even when looking right at where it should be:

Syntax: Select all

pos = mathlib.Vector(700, 0, 600)
effects.ball(recipients, pos, 50)


This kind of thing is basically impossible to debug since it's client-side...

Re: Tempent Troubles

Posted: Tue May 01, 2018 11:02 pm
by quartata
Nope, nevermind, I just got the coordinates wrong. Still crashes my game, presumably when it attempts to render it (although I guess not when it's in my PVS but off-screen).

Re: Tempent Troubles

Posted: Tue May 01, 2018 11:06 pm
by satoon101
No, I figured out the issue. You need to also pass the following values:

  • color
    • A colors.Color instance or even pass in red, green, blue, alpha instead
  • model
    • An engines.precache.Model instance
  • start_width
  • end_width

We might consider adding defaults for these for our effects functions, but the 'model' one could be especially tricky with models not always being the same across engines/games. We could also consider at least raising an error if the model is not passed in.

*Edit: I did notice that I crash if I pass everything but the model.

Re: Tempent Troubles

Posted: Tue May 01, 2018 11:37 pm
by quartata
Oh, I thought it was weird that it didn't need a color or anything. I suppose the easy solution is just to make those required arguments. Right now they're just lumped in with the **kwargs that get set on the TempEntity it makes, which makes it a bit misleading.