[QUOTE=Pazda;47146341]ok cool i'm using that and I copy/pasted their triangle script and moved it around and stuff, but I can't seem to add a point. I'm just adding an x/y coord to the table like the others, why won't that change it?
[CODE]
local trapezoid = {
{ x = 950, y = 0 },
{ x = 600, y = 100 },
{ x = 550, y = 0 },
{ x = 800, y = 200 },
}
[/CODE]
its not picking up the (800,200). no matter how i make the table it only registers the first three entriesx[/QUOTE]
[url]https://www.dropbox.com/s/68p2q6znp1tytv7/polyeditor.lua?dl=1[/url]
You can use that to design polygons.
[video=youtube;QwA6k-Y6TJ8]http://www.youtube.com/watch?v=QwA6k-Y6TJ8[/video]
Put the file in lua/autorun/client, and run "polyeditor" in the console.
Left click to add points, right click for the menu.
i'm coding off my chromebook (lol) cause my desktop is too slow to tab out a lot. is there any other way to do it? thanks for the helpful post though i'll save it for if i get an upgrade :)
[QUOTE=Pazda;47146523]i'm coding off my chromebook (lol) cause my desktop is too slow to tab out a lot. is there any other way to do it? thanks for the helpful post though i'll save it for if i get an upgrade :)[/QUOTE]
It's not an external program. You run it from within Garry's Mod.
(And if it takes a long time to tab out it's because you're running Garry's Mod in non-native resolution. Change your resolution settings in options to the one that has the word native next to it and you will minimize instantly.)
i am in native, it's just a really, really bad computer.
and ok ill give it a shot thanks. but is there a faster way to fix it? i dont want to install something & wait 30 minutes to restart gmod to fix it
[QUOTE=Pazda;47146550]i am in native, it's just a really, really bad computer.
and ok ill give it a shot thanks. but is there a faster way to fix it? i dont want to install something & wait 30 minutes to restart gmod to fix it[/QUOTE]
Personally I run GMod windowed so tabbing out is instantaneous.
polyeditor didn't work for me
[QUOTE=Pazda;47146654]polyeditor didn't work for me[/QUOTE]
What's wrong?
it says unknown command 'polyeditor'. I put it in my garrysmod/garrysmod/lua/autorun/client, joined my server, set sv_allowcslua to 1 and tried to open the script with lua_openscript_cl blah blah, and it couldn't find it
Well you shouldn't need to lua_openscript_cl if it's in autorun. Put it in the server's lua/autorun/client folder.
What are my options for centering text with RichText?
If I was to do:
[code]
for num,obj in pairs(self:GetItemAll(item)) do
end
[/code]
obj.Quantity are all numbers within the table.
How would I add up all the obj.Quantity's?
[QUOTE='[CLRP]extra;47147144']If I was to do:
[code]
for num,obj in pairs(self:GetItemAll(item)) do
end
[/code]
obj.Quantity are all numbers within the table.
How would I add up all the obj.Quantity's?[/QUOTE]
[lua]
local total = 0
for num,obj in pairs(self:GetItemAll(item)) do
total = total + obj.Quantity
end
print(total)
[/lua]
[QUOTE=bobbleheadbob;47147168][lua]
local total = 0
for num,obj in pairs(self:GetItemAll(item)) do
total = total + obj.Quantity
end
print(total)
[/lua][/QUOTE]
Holy fuck, the answer was so simple. I managed to get all the advanced inventory shit out of the way but couldn't think good enough to work this out. Thanks :D
I'd recommend keeping track of the number instead of counting each time...
Basically each time you add an item, +1, each time you remove -1... Depending on the storage system you may need to tally the number initially.
Wait a minute, why shouldn't you use Derma for a HUD? What's the problem with it?
What Acecool said, but don't worry too much about it as long as you only count it every once in a while.
[QUOTE=TheLuaNoob;47147427]Wait a minute, why shouldn't you use Derma for a HUD? What's the problem with it?[/QUOTE]
It's designed to be used as VGUI, and as such it has features which are useless for HUDs (potentially slowing things down). Also if you want to make anything which looks pretty it's simpler to use HUDPaint.
I don't remember which thread I saw it in, but I recall seeing tips reccomending not to use net.WriteTable or ply:SendLua. Why shouldn't I use these often?
[QUOTE=swadicalrag;47148806]I don't remember which thread I saw it in, but I recall seeing tips reccomending not to use net.WriteTable or ply:SendLua. Why shouldn't I use these often?[/QUOTE]
They aren't optimized. SendLua uses usermessages and net.WriteTable is slower than the other net functions.
That said, at the end of the day, fuck other people and their tiny optimizations. Use whatever code is easiest for you to use and understand. As long as it isn't problematic and it works then you're fine.
The biggest issue with networking is if you send lots of data all the time, it clogs up the stream and slows down all other streams.
Networking is sent and received in this order: net, umsg, console commands: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/networking/networking_channels_and_the_order_things_are_sent.lua[/url]
UMSG is limited to 255 bytes, SendLua, etc... uses umsg. Additionally it ties into RunString so it's likely shunned because it is a lazy method of networking on top of that since the data is RunString'd, if you trust client data or whatever in a RunString then player has control of your server.
Is there a way I can essentially freeze the AI of one specific NPC? Run an animation at the same time, but preferably without making a scripted sequence entity. I'm certain there is a way.
[editline]16th February 2015[/editline]
Freeze the AI as in disable it, but just for one target... and I gotta enable it again after a set amount of time.
[QUOTE=WalkingZombie;47149437]Is there a way I can essentially freeze the AI of one specific NPC? Run an animation at the same time, but preferably without making a scripted sequence entity. I'm certain there is a way.
[editline]16th February 2015[/editline]
Freeze the AI as in disable it, but just for one target... and I gotta enable it again after a set amount of time.[/QUOTE]
You can always call Entity:SetNextThink(CurTime() + delay) to stop an NPC from doing anything for the given amount of time, but I'm not certain that you could also have it play an animation.
Hacky work around: call set next think, hide the entity (setnodraw), spawn a clientsideentity at the same position, angles, with the same model, set that entities animation, after the delay, kill that clientsideentity and setnodraw(false) on the original entity.
Does anybody know of any [B][U]GOOD[/U][/B] car screeching sounds?
Something that could go with this:
[video=youtube;_n1fxd1VVT4]http://www.youtube.com/watch?v=_n1fxd1VVT4[/video]
I've tried googling it, all that comes up is poor quality versions.
Please help mah.
[QUOTE=Feihc;47149479]You can always call Entity:SetNextThink(CurTime() + delay) to stop an NPC from doing anything for the given amount of time, but I'm not certain that you could also have it play an animation.
Hacky work around: call set next think, hide the entity (setnodraw), spawn a clientsideentity at the same position, angles, with the same model, set that entities animation, after the delay, kill that clientsideentity and setnodraw(false) on the original entity.[/QUOTE]
Hacky... I would assume possible a-synchronization online, as in perhaps gaps of time with nothing drawn, or both drawn, but at least in single player that'd work nicely.
I did come up with an idea that might work online and off, though. I do believe there is an ACT BUSY possibility, though, just not sure how well that would work, if it would stop the combat AI and all... nor do I know how to properly use it. If anyone knows anything about that, could they please kelp me out?
How would you find an exponential function that goes between two points, say (0, self.owner:EyePos( ).z, self.Primary.BulletDropDist)? I've been trying to work out an equation on my ten minute breaks at work for the past couple days and I've had no luck and I'm really not sure where to start with something like this.
The goal is to make it so when I put in 0, it starts at (0, eyePos), and 0.1 returns the value at tenth of the distance.
I've been trying to plug values in for f(t)=a*b^t and setting up systems and stuff... I always end up weirdly zero'ing stuff out.
[QUOTE=wauterboi;47150438]How would you find an exponential function that goes between two points, say (0, self.owner:EyePos( ).z, self.Primary.BulletDropDist)? I've been trying to work out an equation on my ten minute breaks at work for the past couple days and I've had no luck and I'm really not sure where to start with something like this.
The goal is to make it so when I put in 0, it starts at (0, eyePos), and 0.1 returns the value at tenth of the distance.
I've been trying to plug values in for f(t)=a*b^t and setting up systems and stuff... I always end up weirdly zero'ing stuff out.[/QUOTE]
Bullet drop isn't exponential, it's parabolic.
Also exponentials only hit 0 at +/-infinity, so you'll want f(t) = a exp(b t) + c. Even then you'll not be able to get the initial direction of the shot right.
If you're aiming upwards, the only exponentials that match your initial direction would head up to infinity and none of them would ever hit the ground.
If you want to use a parabola instead:
[code]
𝐱 is position in metres
t is time in seconds
g = 9.81 m/s²
Acceleration:
𝐱'' (t) = [ 0 ]
[ -g ]
Integrate and stick in initial velocity (v₀ₓ, v₀ᵧ):
𝐱' (t) = [ v₀ₓ ]
[ v₀ᵧ - g t ]
Integrate again, initial position (0, eyeHeight):
𝐱 (t) = [ v₀ₓ t ]
[ eyeHeight + v₀ᵧ t - 0.5 g t² ]
To find time t when it hits the ground, solve the quadratic
eyeHeight + v₀ᵧ t - 0.5 g t² = 0
and pick the solution with positive t.
[/code]
You can take g = 600 or whatever sv_gravity is and use source engine units for everything.
Jesus. I've gotta look at this tomorrow with a pen and paper. It looks like you did a majority of the work for me though, so thanks a ton man.
May I ask what those funky brackets mean, though?
Is it possible to close a mysqloo connection?
[QUOTE=wauterboi;47150671]Jesus. I've gotta look at this tomorrow with a pen and paper. It looks like you did a majority of the work for me though, so thanks a ton man.
May I ask what those funky brackets mean, though?[/QUOTE]
It's just my attempt at vector notation using ascii.
[ x ] = Vector (x, y)
[ y ]
I've done barely any of the work to be honest. You've still got to extend it to 3d. And I have no idea if this is what you actually wanted.
This script prevents players that have the item from fall damage but also allows players in ttt to take damage preround and I'm unsure of what the problem is here is the lua:
[CODE]AddCSLuaFile()
EQUIP_BOOTS= 16
hook.Add( "InitPostEntity", "LoadEquipItemBoots", function()
local IronBoots = {
id = EQUIP_BOOTS,
loadout = false,
type = "item_passive",
material = "VGUI/ttt/icon_ironboots.vmt",
name = "Iron Boots",
desc = "Decreases fall damage by 100%."
}
table.insert( EquipmentItems[ROLE_TRAITOR], IronBoots )
table.insert( EquipmentItems[ROLE_DETECTIVE], IronBoots )
end)
hook.Add( "EntityTakeDamage", "IronBoots", function( ply, dmginfo )
if ply:IsPlayer() and ply:HasEquipmentItem( EQUIP_BOOTS ) and dmginfo:GetDamageType() == DMG_FALL then
dmginfo:ScaleDamage( 0 )
end
return dmginfo
end )[/CODE]
Remove the return dmginfo, it's not necessary at all and just breaks all the other EntityTakeDamage hooks.
Sorry, you need to Log In to post a reply to this thread.