General > Off-Topic
"Predator" Vision
JamminR:
Hi folks.
Have any of you more advanced LUA scripters made a vision script before?
I found a nice one with three different levels of intensity at FacePunch for Night Vision,
http://forums.facepunchstudios.com/showthread.php?t=114088&highlight=night+vision , but I'm looking for more along the lines of thermal, red background with characters looking blue/yellowish, like in the movie Predator (the original)
Is there a way to do this? I figure the Night Vision files could be edited to reddish tint, but, that wouldn't make players look bright blue/yellow.
Is it possible to attach a sprite/texture to a player that only the client sees using LUA?
(I know, v10 might allow this, but I was hoping for now)
Thanks in advance
Golden-Death:
Technically possible, but it'd be pretty laggy I think. There are scripts that detect ent positions, like the radar, so itd be easy to make it find ents and draw a rect around them, but still tough.
JamminR:
I'll have to look into that Radar. Is it like the CS one?
I've seen the holo-radar post. Didn't seem to have potential for what I'm trying to do.
I didn't think of drawing rectangles on/around players.
(See, I knew I asked in the right place)
Does seem like it would be slow though. And not fully what I'd like, but we work with what we have.
The nuclear pack at FP has a Redeemer, that places some type of text above (I think its above, been a while since I used it) player and NPC heads as you're flying it.
Though the script can't be used well online due to its lag factor when the nuclear explosion goes off, perhaps I could use the ideas from its 'text' tracking to try drawing rectangles.
Also, now that I've slept on it, I think Predator's main vision was more blue blackground, with yellow/red thermals. I'll have to watch to movie to make sure.
Either way, I'm still open to more ideas.
Golden-Death:
Forgot what its called, but its a radar that draws a a line accross your screen and ents on it are red squares, growing bigger on your screen radar as you approach them
JamminR:
I searched. Found several radars. None really did what I wanted.
I dug into the Redeemer nuke swep at FP. (I'm at work, can't grab the link right now, darn Websense!! Geez. Like they don't want me to slack or something inbetween other work coding. ;D ;D )
Here's my version of the 'targetting' code I will hopefully use. (Oh, feel free to modify/edit/use, just credit original SWEP at FP, and tweaks I made.)
HOWEVER... I'd like help with the following....
As discussed previously, I'd like to use rectangles (or some type of sprite? I'm thinking combine ball in reasonable shape of player would be great)instead of Text.
I have no problem drawing a plain rectangle for use in a menu, its pretty static. However, players/npcs move. Am I going to have to write think code to automatically adjust the size of the rectangle? Or can the size of the rectangle be set on the players position, and then it adjust as I move closer/farther away, like the text automatically does now?
--- Code: -----Target code idea is from Apocolypse Mod "redeemer" SWEP from FP forums, heavily modified
targs = {}
radius = 9999
function findtargets(predid, centervec, radius)
targs = _EntitiesFindInSphere( centervec, radius )
for i = 1,table.getn(targs) do
if (string.find (_EntGetType(targs[i]),"npc_",1,true) ~= nil) or
(_EntGetType(targs[i]) == "player")
then
_GModText_Start("Default")
_GModText_SetText("\[ ]")
_GModText_SetColor(255,20,50,200)
_GModText_SetTime(9999,0.1,0.1)
_GModText_SetEntity( targs[i] )
_GModText_SetEntityOffset(vector3(0,0,32))
_GModText_Send(predid,888 + i + predid)
end
end
end
--[[
There were originally 15 or more 'if (_EntGetType(targs[i]) == "npc_BLAHBLAH") or' comparisons above.
Where BLAHBLAH was each npc individually from game.
JamminR had hoped there was an easier way.
There is. Thanks to string handling explanation http://www.lua.org/manual/5.1/manual.html#5.4
string.find (s, pattern [, init [, plain]])
JamminR hasn't timed the two different ones.
Even if not faster, at least its neater/smaller code.
]]--
function hidetargets( predid, channel )
if (allowindicators == 1) then
for i = 1,table.getn(targs) do
_GModText_Hide(predid,channel + i + predid)
end
end
end
function DoShowTargets(predid)
local targetvector = _PlayerGetShootPos(predid)
findtargets(predid, targetvector, 9999)
end
CONCOMMAND("target",DoShowTargets)
CONCOMMAND("notarget",hidetargets,888)
--- End code ---
Edit: I just realized the rectangle can be made into any VMT material. Nice. I can work with that instead of gmod/white. Still, anyone help me with other concerns? I'm concerned width/heigth won't auto if I use _GmodRect_SetPos and SetPosOffset, anyone know? I've not ever worked with the vectors before, and am trepid about doing so
Navigation
[0] Message Index
[#] Next page
Go to full version