ULX

Author Topic: Lua Halo Glow Help  (Read 13604 times)

0 Members and 2 Guests are viewing this topic.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Lua Halo Glow Help
« Reply #30 on: September 11, 2014, 08:23:57 AM »
perhaps a new board can be made for developers who complete scripts and have a place to share them
New board? We already have two.
Releases, if you feel it's release quality.
And, aptly, Developer's corner, if it might not be 100% release, but useful in a larger project or collection.
Many have posted useful stuff in the corner. A few even turned the useful stuff into releases.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline ChaosWolf

  • Jr. Member
  • **
  • Posts: 94
  • Karma: 2
  • "The Exiled One's" Server Owner
Re: Lua Halo Glow Help
« Reply #31 on: September 11, 2014, 09:18:27 AM »
In the developers corner it looks as though you have to sort through development and releases, that's all I meant.
"Someone once told me, scripting lua is like trying to build a rocket ship, once your finished with it and think your done, you start it up only to realize you had just built it upside down." ~Programmer

Offline ChaosWolf

  • Jr. Member
  • **
  • Posts: 94
  • Karma: 2
  • "The Exiled One's" Server Owner
Re: Lua Halo Glow Help
« Reply #32 on: September 12, 2014, 09:30:27 PM »
hey Avoid, I remember you saying something about making it ignore players. just a reminder, perhaps you can help me with that since you've seen the bug first hand.
"Someone once told me, scripting lua is like trying to build a rocket ship, once your finished with it and think your done, you start it up only to realize you had just built it upside down." ~Programmer

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Lua Halo Glow Help
« Reply #33 on: September 13, 2014, 06:49:03 AM »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline RainbowHG

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: Lua Halo Glow Help
« Reply #34 on: November 23, 2017, 02:38:04 PM »
Apologies for being a filthy necro.

The script that's available to download still targets players (on the props team).

I see a user has entered ent:IsPlayer() but I have no idea where to put this in the code. If someone could help that'd be great.

If I need to be punished for being a necro, can you do it after someone helps? :x

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Lua Halo Glow Help
« Reply #35 on: November 23, 2017, 04:32:46 PM »
Line 16 of the script already seems to try to avoid adding the halo.
Code: [Select]
if IsValid(tr.Entity) and !tr.Entity:IsPlayer() then You might try changing it to
Code: [Select]
if IsValid(tr.Entity) and not IsPlayer(tr.Entity) then
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline RainbowHG

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: Lua Halo Glow Help
« Reply #36 on: November 24, 2017, 01:47:55 AM »
Code: [Select]

[ERROR] lua/autorun/cl_halo.lua:16: attempt to call global 'IsPlayer' (a nil value)
  1. fn - lua/autorun/cl_halo.lua:16
   2. Run - addons/ulib/lua/ulib/shared/hook.lua:109
    3. fn - lua/includes/modules/halo.lua:148
     4. unknown - addons/ulib/lua/ulib/shared/hook.lua:109


Sadly that didn't work.

I've tried changing the trace.filter and adding a if team == but nothing seems to work..

The halo is literally stuck around the player and not any prop.

Here's the code I have

Code: [Select]

function Halos()
local tr = LocalPlayer():GetEyeTraceNoCursor()
local trace = {}
trace.start = tr.StartPos
trace.endpos = trace.start + LocalPlayer():GetAimVector() * 1000
trace.filter = self
trace.mask = MASK_SHOT

if IsValid(tr.Entity) and !tr.Entity:IsPlayer() then
if tr.HitPos:Distance(tr.StartPos) < 500 then -- How Close/Far do you want entities to glow?
local col = Color(255, 255, 0) -- Change the Color here
halo.Add({tr.Entity}, col, 2, 2, 2, true, true)



end
end

end
 
hook.Add( "PreDrawHalos", "DrawHalos", Halos )


As you can see the filter is trying to filter out the player but it doesn't seem to work

Here is the trace on the props team


Yet strangly....Here is the trace when a player is a hunter


So it works on the wrong team.
« Last Edit: November 24, 2017, 02:01:14 AM by RainbowHG »

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: Lua Halo Glow Help
« Reply #37 on: November 27, 2017, 02:57:11 AM »
As you can see the filter is trying to filter out the player but it doesn't seem to work

1. You are creating a Trace Structure, but you never use it to perform a trace.

Tip: Use a trace function like util.TraceLine to perform the trace.

2. Your filter needs a little bit of tweaking. You don't need to filter a player, but a gamemode prop entity.

Usually, filtering the player entity would suffice, but not in this case. When you're a prop, you're looking directly at a gamemode prop entity, not at a player entity.

I don’t know which Prop Hunt version you are running. There are so many. It looks like most of them have some way to get the prop entity on the client-side. You will have to look at the gamemode source code to figure out how you can get the prop entity.

For example, in Wolvin's Prop Hunt: Enhanced, there's a Player:GetPlayerPropEntity() function.