[QUOTE=Killstr3aKs;47597280]Ok, so i've been trying to solve this problem for a while, but i have tried everything and it still doesn't work.
Basically i can't control the speed of the animation for the landing gears. When i load the model in HLMV the animation works perfectly, but when using it in Gmod it ignores all the parameters and just moves superfast.
The animation has 200 frames, with a keyframe each 50 frames (0, 50, 100, 150, 200). That is to prevent the landing gear hatches to close before the wheels are fully retracted, which would happen if i only used 2 keyframes, at the beggining and at the end of the animation.
This is what happens (sorry for the size, i forgot to change the recording resolution when i made this clip):
(video)
And this is the .qc i used to compile each model. I even tried using [URL="http://wiki.garrysmod.com/page/Entity/SetPlaybackRate"]SetPlaybackRate[/URL] but apparently that function is broken, could anyone confirm that?
[CODE]qc[/CODE]
And i know this isn't the best place to ask for modelling or animation stuff, but i have made multiple threads on the Modelling section and i still haven't solved this :/[/QUOTE]
What function are you using to play the animation in GMod? I know that Entity:RestartGesture() isn't affected by SetPlaybackRate, and always plays animations at the wrong rate or not at all if the entity is anything other than a nextbot, but if you need to layer it over another animation then I really don't know if there's a better alternative.
[QUOTE=TwoYearLurker;47597613]What function are you using to play the animation in GMod? I know that Entity:RestartGesture() isn't affected by SetPlaybackRate, and always plays animations at the wrong rate or not at all if the entity is anything other than a nextbot, but if you need to layer it over another animation then I really don't know if there's a better alternative.[/QUOTE]
Entity:SetSequence is what we use
Does anyone have a download for Wild Engine, the creator's site is offline and he has been inactive from FP for a year now.
[url]http://www.facepunch.com/showthread.php?t=1286599[/url]
Does anyone know how to paint to a cam.3d2d with a cam.3d? For me it just paints to the screen.
[QUOTE=James xX;47598409]Does anyone know how to paint to a cam.3d2d with a cam.3d? For me it just paints to the screen.[/QUOTE]
What? What are you trying to do?
[QUOTE=Robotboy655;47598469]What? What are you trying to do?[/QUOTE]
If I wanted a model (like DModelPanel) on a 3d2d, it just draws to the screen.
EDIT: My work around is to throw a rendertarget into the mix.
Hi there. Is there any way to find if the player is a traitor in TTT? I tried using different solutions and none worked.
ply:GetTraitor()
returns an boolean.
Does anyone have a mirror of the "Why Your Scripts Are Now Broken" doc? It's been removed from google drive.
[url]https://docs.google.com/document/d/157blpvgS7-TzierM0WehBGa5W65HGG8ITXcxpYfY2G4/edit[/url]
or as an pdf
[url]http://www21.zippyshare.com/v/qG4rRgYt/file.html[/url]
Why do people define their globals locally when making lua modules? For example, before making a script, some people do:
[code]
local pairs = pairs
local ipairs = ipairs
local print = print
[/code]
..and so on and so forth for all of the globals they use. Why exactly is this so, and will there be consequences for not doing so? I just want to make sure that if I have to define my globals locally that I must do it, as it can get messy to do this:
[code]
local TypeID = TypeID
local MsgN = MsgN
local Format = Format
local pairs = pairs
local ipairs = ipairs
local SQLStr = SQLStr
local require = require
local unpack = unpack
local string = string
local util = util
local tonumber = tonumber
local table = table
local setmetatable = setmetatable
local file = file
local module = module
[/code]
[QUOTE=AK to Spray;47600093]Why do people define their globals locally when making lua modules?[/QUOTE]
After
[code]module ("modulename")[/code]
all global variable assignments and retrievals happen in the modulename table instead. You need to localize or you can't access those functions after the module() call.
[QUOTE=AK to Spray;47600093]Why do people define their globals locally when making lua modules? For example, before making a script, some people do:
[code]
local pairs = pairs
local ipairs = ipairs
local print = print
[/code]
..and so on and so forth for all of the globals they use. Why exactly is this so, and will there be consequences for not doing so? I just want to make sure that if I have to define my globals locally that I must do it, as it can get messy to do this:
[code]
local TypeID = TypeID
local MsgN = MsgN
local Format = Format
local pairs = pairs
local ipairs = ipairs
local SQLStr = SQLStr
local require = require
local unpack = unpack
local string = string
local util = util
local tonumber = tonumber
local table = table
local setmetatable = setmetatable
local file = file
local module = module
[/code][/QUOTE]
If it's inside a module, it's because those globals won't exist (when you create a module with the module function). It's also used for speed, when making heavy intensive functions that are called in Draw or other hooks that would slow down the game.
[QUOTE=AK to Spray;47600093]Why do people define their globals locally when making lua modules? For example, before making a script, some people do:
[code]
local pairs = pairs
local ipairs = ipairs
local print = print
[/code]
..and so on and so forth for all of the globals they use. Why exactly is this so, and will there be consequences for not doing so? I just want to make sure that if I have to define my globals locally that I must do it, as it can get messy to do this:
[code]
local TypeID = TypeID
local MsgN = MsgN
local Format = Format
local pairs = pairs
local ipairs = ipairs
local SQLStr = SQLStr
local require = require
local unpack = unpack
local string = string
local util = util
local tonumber = tonumber
local table = table
local setmetatable = setmetatable
local file = file
local module = module
[/code][/QUOTE]
If I recall correctly, it used to make scripts faster, as accessing a local is/was faster than accessing a global. Something related to jit makes this defunct now, I believe. It's also used in anti-cheats so that they have a local copy, which makes bypassing the anti-cheat more difficult.
[B]EDIT:[/B] I guess I explained the wrong thing, as you were wondering about modules, but meh.
[QUOTE=!cake;47600156]After
[code]module ("modulename")[/code]
all global variable assignments and retrievals happen in the modulename table instead. You need to localize or you can't access those functions after the module() call.[/QUOTE]
Ah, thanks. I'm trying to transfer a script I originally had in autorun into a module form, something which I have never done before, so this was very helpful.
[QUOTE=James xX;47600160]If it's inside a module, it's because those globals won't exist (when you create a module with the module function). It's also used for speed, when making heavy intensive functions that are called in Draw or other hooks that would slow down the game.[/QUOTE]
Thanks as well, I'll keep that in mind when working with such functions.
Would this cause any issues like the table disappearing or anything?
[lua]
function ExampleFunction()
GlobalTable = GlobalTable or {}
local tempTable = {}
tempTable.stuff = {}
tempTable.stuff.morestuff = "value"
GlobalTable = tempTable
end
[/lua]
The idea is to replace the whole table at once without emptying it, would there be any issues doing it this way?
[QUOTE=zerf;47599507]Does anyone have a mirror of the "Why Your Scripts Are Now Broken" doc? It's been removed from google drive.[/QUOTE]
You, and others, can find a ton of useful links and info in the "MODDING HELP" sticky.
how often are NWVars data sent to player, is it only when it changes or is it constantly updating(I found a thread from 2011 saying it's only when it changes but lately I read it is constantly?)
[QUOTE=Busan1;47600907]how often are NWVars data sent to player, is it only when it changes or is it constantly updating(I found a thread from 2011 saying it's only when it changes but lately I read it is constantly?)[/QUOTE]
Word of warning, I have nothing to back me up: I believe it's only when it's changed, I wouldn't see the point in updating it when it hasn't changed. Can you post a link to the thread?
Why is the DrawTexturedRectRotated positioned differently than DrawTexturedRect?
[img]http://i.imgur.com/HKkFx4O.png[/img]
(The one that is off the box is the rotated one)
[lua]
surface.DrawTexturedRect ( x, y - layer, w, layer )
surface.DrawTexturedRectRotated ( x, y - layer, w, layer, 0 )
[/lua]
[QUOTE=James xX;47600923]Word of warning, I have nothing to back me up: I believe it's only when it's changed, I wouldn't see the point in updating it when it hasn't changed. Can you post a link to the thread?[/QUOTE]
[url]http://facepunch.com/showthread.php?t=1105154&p=30987578&viewfull=1#post30987578[/url]
and yes I can't see why it would be updating constantly either but I have read both, and I would like to get a final understanding which one is true.
[QUOTE=Author.;47600927]Why is the DrawTexturedRectRotated positioned differently than DrawTexturedRect?
[img]http://i.imgur.com/HKkFx4O.png[/img]
(The one that is off the box is the rotated one)
[lua]
surface.DrawTexturedRect ( x, y - layer, w, layer )
surface.DrawTexturedRectRotated ( x, y - layer, w, layer, 0 )
[/lua][/QUOTE]
i think rotated is positioned by the center rather than the top left corner.
[QUOTE=Busan1;47600934][url]http://facepunch.com/showthread.php?t=1105154&p=30987578&viewfull=1#post30987578[/url]
and yes I can't see why it would be updating constantly either but I have read both, and I would like to get a final understanding which one is true.[/QUOTE]
I meant the threads where they mention it's updated constantly.
[QUOTE=James xX;47600955]I meant the threads where they mention it's updated constantly.[/QUOTE]
oh right, here is from google now:
[url]http://facepunch.com/showthread.php?t=1442354&p=46736469&viewfull=1#post46736469[/url]
I will see for more sources of both, but I see a comment there saying it will be updated, and in last update it said it was rewritten from scratch but then it was reverted? when it was the NWString problem, so not sure where it stands now?
[editline]26th April 2015[/editline]
[QUOTE=Busan1;47600988]oh right, here is from google now:
[url]http://facepunch.com/showthread.php?t=1442354&p=46736469&viewfull=1#post46736469[/url]
I will see for more sources of both, but I see a comment there saying it will be updated, and in last update it said it was rewritten from scratch but then it was reverted? when it was the NWString problem, so not sure where it stands now?[/QUOTE]
edit: maybe I misunderstand the comment but either way I'm just wondering if setting a NWVar on something is equalivent/better/worse than net.Broadcasting() the same thing, only when it changes.
[QUOTE=Robotboy655;47600814]You, and others, can find a ton of useful links and info in the "MODDING HELP" sticky.[/QUOTE]
Oh well. Made a [URL="http://wiki.garrysmod.com/page/Updating_Scripts_From_GMod_12_to_GMod_13"]wiki page[/URL] before I saw your post. :X
Is there a function like [url=http://wiki.garrysmod.com/page/GM/EntityEmitSound]this[/url] but for all sounds that play on a client no matter if they where called server side or not?
I have this:
[lua]
concommand.Add( "server_random", function()
local serverTable = {}
print( "Finding a random server, this may take a while..." )
serverlist.Query( {
GameDir = "garrysmod",
Type = "internet",
AppID = 4000,
Callback = function( ping, name, desc, map, players, maxplayers, botplayers, pass, lastplayed, ip, gamemode, workshop )
if players >= 4 and not pass then
if string.find( name, "[FR]", 0, true ) == nil and string.find( name, "[GER]", 0, true ) == nil then
print( name .. ": (" .. ip .. ")" )
table.insert( serverTable, ip )
print( "Found " .. #serverTable .. " servers so far." )
end
end
end,
Finished = function()
local ip = serverTable[ math.random( 1, #serverTable ) ]
print( "Done! Taking you to " .. ip .. " in 3 seconds..." )
print( ip )
timer.Simple( 3, function()
RunConsoleCommand( "connect", ip )
end )
end
} )
end )
[/lua]
But the IP is passed with "" around it, so RunConsoleCommand outputs this: Bad server address ("185.38.148.13:27215")
-snip, resolved-
[QUOTE=meharryp;47603764]I have this:
[lua]
concommand.Add( "server_random", function()
local serverTable = {}
print( "Finding a random server, this may take a while..." )
serverlist.Query( {
GameDir = "garrysmod",
Type = "internet",
AppID = 4000,
Callback = function( ping, name, desc, map, players, maxplayers, botplayers, pass, lastplayed, ip, gamemode, workshop )
if players >= 4 and not pass then
if string.find( name, "[FR]", 0, true ) == nil and string.find( name, "[GER]", 0, true ) == nil then
print( name .. ": (" .. ip .. ")" )
table.insert( serverTable, ip )
print( "Found " .. #serverTable .. " servers so far." )
end
end
end,
Finished = function()
local ip = serverTable[ math.random( 1, #serverTable ) ]
print( "Done! Taking you to " .. ip .. " in 3 seconds..." )
print( ip )
timer.Simple( 3, function()
RunConsoleCommand( "connect", ip )
end )
end
} )
end )
[/lua]
But the IP is passed with "" around it, so RunConsoleCommand outputs this: Bad server address ("185.38.148.13:27215")[/QUOTE]
I'm not quite sure I understand your problem, but does print( ip ) output the ip with "s on either side? If so, you could gsub them out, or use string.sub to get the string from post 2 to len-1
Printing it just returns the IP without the "" around it.
Sorry, you need to Log In to post a reply to this thread.