• What do you need help with? V3
    6,419 replies, posted
[QUOTE=EthanTheGreat;37160913]I'm sure this has been asked before, but since the search option isn't available I think it would be cool to ask... Is it possible to push source-engine vehicle's top speed past the preset number ( around 120 - 130 mph )? If so, how, and by what means..[/QUOTE] [lua] physenv.SetPerformanceSettings( { MaxVelocity = 4000 } ) [/lua] 4000 is the default, not sure what the units are. (You could just scale it eg 4000*1.5 to increase by 50%)
attempt to call method 'GetCount' (a nil value) [Lua] Deleted [/Lua] ---------- Fixed by my self ------------
How would I go about getting all spawned weapon entities at the start of a round and removing them? Thanks
[QUOTE=Trumple;37167232]How would I go about getting all spawned weapon entities at the start of a round and removing them? Thanks[/QUOTE] [lua]for k, v in pairs( ents.GetAll() ) do if v:IsWeapon() and not ValidEntity( v:GetOwner() ) then v:Remove() end end[/lua]
I've always taken the quick way out by using NMVars for all my player / entity data in a game mode, what would be the best way to store data on a player / entity and making it accessible from client and server ? Thanks
[QUOTE=Drakehawke;37168117][lua]for k, v in pairs( ents.GetAll() ) do if v:IsWeapon() and not ValidEntity( v:GetOwner() ) then v:Remove() end end[/lua][/QUOTE] Thanks. Before I start messing with manually spawning weapons, does anyone know which more more likely to cause lag: A) 30-40 gun spawns on restart, causing lots of inter-gun collisions or B) lots of players being re spawned at the same time If B, I was thinking of doing wave spawning, where say 5 players spawn, then a cooldown time of a second or so. But I don't even know if B would cause issues. I'm getting crazy new-round lag in my gamemode and so I've narrowed it down to A or B. Or game.CleanUpMap(), but I'm pretty sure that isn't it because TTT uses it and it doesn't cause problems Thanks very much!
[QUOTE=Jamies;37168286]I've always taken the quick way out by using NMVars for all my player / entity data in a game mode, what would be the best way to store data on a player / entity and making it accessible from client and server ? Thanks[/QUOTE] Someone correct me if I'm wrong, but NWVars are fine IF all the players need to know about the data. The other good thing about NWVars is it is sent to the players when they join. So NWVars are great for player stats. If you just need networked data for one player then use usermessages. For most of my networked data that is accessed throughout the game such as setting up class information for a player, I have a shared file in which I put all my usermessages in. IMO it is easier that way as it is more organized and kept together nicely. Here's the format i used for my usermessages for get/set functions. [lua] --[[ - @author - SW - @return data --]] function meta:GetData( class ) return self.Data or 0 -- 0 is the default value in this case end --[[ - @author - SW - @param data - data to set --]] function meta:SetData( data ) if not data then return end if SERVER then umsg.Start( "sendData", self ) umsg.Char( data ) umsg.End() end end if CLIENT then usermessage.Hook( "sendData", function( um ) if not LocalPlayer() then return end LocalPlayer():SetData( um:ReadChar() ) end ) end[/lua] The reason I use char and not long is because char is 1 byte while long is 4 bytes. So if you are dealing with data that doesn't go over 255d then char will work fine. Although know that you'll have to do adding/subtracting if the value is above 127. So if you are doing a setData often, then I'd assume it'd be quite a bit better to use a char instead of a long or even short.
So I want to try to spawn NPCs at info_targets in a map. How would I go about using these?
[QUOTE=Kidd;37170048]So I want to try to spawn NPCs at info_targets in a map. How would I go about using these?[/QUOTE] Loop through ents.FindByClass("info_target") and spawn your NPCs at those positions. eg [lua] for k, v in pairs( ents.FindByClass( "info_target" ) ) do local zombie = ents.Create( "npc_zombie" ) zombie:SetPos( v:GetPos() ) zombie:Spawn() end [/lua] Will spawn 1 zombie at every info_target on the map.
Is there a better solution than Networked Variables?
[QUOTE=Drakehawke;37173048]Loop through ents.FindByClass("info_target") and spawn your NPCs at those positions. eg [lua] for k, v in pairs( ents.FindByClass( "info_target" ) ) do local zombie = ents.Create( "npc_zombie" ) zombie:SetPos( v:GetPos() ) zombie:Spawn() end [/lua] Will spawn 1 zombie at every info_target on the map.[/QUOTE] I assume you can find info_target by their name set in hammer too?
[QUOTE=A Lost Sandwich;37173422]Is there a better solution than Networked Variables?[/QUOTE] Depends entirely on what you're trying to do What you just asked is a little like walking into a hardware store and saying "is there something better than an axe?" So, what are you trying to do?
[QUOTE=Kidd;37174432]I assume you can find info_target by their name set in hammer too?[/QUOTE] [lua] for k, v in pairs( ents.FindByName( "zombie_spawn" ) ) do local zombie = ents.Create( "npc_zombie" ) zombie:SetPos( v:GetPos() ) zombie:Spawn() end[/lua]
[QUOTE=Trumple;37174716]Depends entirely on what you're trying to do What you just asked is a little like walking into a hardware store and saying "is there something better than an axe?" So, what are you trying to do?[/QUOTE] Networked integers for points and bools to whether they are in a room or not.
[QUOTE=A Lost Sandwich;37173422]Is there a better solution than Networked Variables?[/QUOTE] Are you serious? Look 3 posts above yours?
What would cause a client to not run its end of a usermessage? I keep getting told that it is unhandled.
[QUOTE=Bletotum;37183744]What would cause a client to not run its end of a usermessage? I keep getting told that it is unhandled.[/QUOTE] It would cause it to be unhandled if you don't include the file with the usermessage hook.
or if the message is too large
How do I search for a brush entity (ex func_*) and draw/highlight the edges of it or make it viewable via a texture?
[QUOTE=brandonj4;37183809]It would cause it to be unhandled if you don't include the file with the usermessage hook.[/QUOTE] You're going to have to elaborate.
[QUOTE=Bletotum;37199599]You're going to have to elaborate.[/QUOTE] Check the file where usermessage.Hook is called is loading properly clientside.
It seems I can't add a usermessage hook, or any other hook for that matter, inside of an entity's initialize. What's up with that? [editline]12th August 2012[/editline] (clientside)
When I try to do [code]require("pimpmyride");[/code] it sais "NO ENTITY LIST ERROR [cpp]" then stops the entire init.lua to work.
[QUOTE=Bletotum;37200070]It seems I can't add a usermessage hook, or any other hook for that matter, inside of an entity's initialize. What's up with that? [editline]12th August 2012[/editline] (clientside)[/QUOTE] Why do it in Initialize and not just in the file?
[QUOTE=kragmars102;37200116]When I try to do [code]require("pimpmyride");[/code] it sais "NO ENTITY LIST ERROR [cpp]" then stops the entire init.lua to work.[/QUOTE] GM13 or GM12? Either way I think that pimpmyride is broken =\
[QUOTE=A Lost Sandwich;37200582]GM13 or GM12? Either way I think that pimpmyride is broken =\[/QUOTE] Edit: Just found out it is broken, however there is an fixed version for anyone that needs it: [url]http://gmodmodules.googlecode.com/svn-history/r200/trunk/gm_pimpmyride/Release/gm_pimpmyride.dll[/url] Can anyone please give me an example of setting the spingConstant for suspension via pimpmyride.
Anyone know the proper use of render.DrawSphere? I got it working once but for some reason deleted the code... and now I can't figure it out again.
[QUOTE=Drakehawke;37200344]Why do it in Initialize and not just in the file?[/QUOTE] This also does not work. Can anyone replicate this in gm13 or 12?
[QUOTE=Bletotum;37204703]This also does not work. Can anyone replicate this in gm13 or 12?[/QUOTE] Are you calling AddCSLuaFile("cl_init.lua") in the entities init.lua?
Yes. [editline]12th August 2012[/editline] Actually no, for some reason I've been getting an error when I do that, so I had commented the line. Found the problem.
Sorry, you need to Log In to post a reply to this thread.