Tempent Troubles

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
quartata
Member
Posts: 77
Joined: Wed Jun 22, 2016 11:49 pm

Tempent Troubles

Postby quartata » Tue May 01, 2018 10:09 pm

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)
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: Tempent Troubles

Postby satoon101 » Tue May 01, 2018 10:31 pm

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.
Image
User avatar
quartata
Member
Posts: 77
Joined: Wed Jun 22, 2016 11:49 pm

Re: Tempent Troubles

Postby quartata » Tue May 01, 2018 10:42 pm

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.
User avatar
quartata
Member
Posts: 77
Joined: Wed Jun 22, 2016 11:49 pm

Re: Tempent Troubles

Postby quartata » Tue May 01, 2018 10:45 pm

I'll try a different effect to see if maybe it's specific to the ball one.
User avatar
quartata
Member
Posts: 77
Joined: Wed Jun 22, 2016 11:49 pm

Re: Tempent Troubles

Postby quartata » Tue May 01, 2018 10:59 pm

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...
User avatar
quartata
Member
Posts: 77
Joined: Wed Jun 22, 2016 11:49 pm

Re: Tempent Troubles

Postby quartata » Tue May 01, 2018 11:02 pm

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).
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: Tempent Troubles

Postby satoon101 » Tue May 01, 2018 11:06 pm

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.
Image
User avatar
quartata
Member
Posts: 77
Joined: Wed Jun 22, 2016 11:49 pm

Re: Tempent Troubles

Postby quartata » Tue May 01, 2018 11:37 pm

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.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 47 guests