Monday, October 4, 2010

More LUA Scripting

Wow, I'm really excited to see more people interested in working on the game with me. I can't wait to get the project going. I would really like to setup a group meeting so we can help setup the game for everyone. We need to brainstorm on how we can make this game possible in Garry's Mod. I can provide the necessary addons and give out tutorials to anyone who would be interested in trying it out. If you're interested in trying out Garry's Mod on your computer, then let me know what your processor and video card is. As you may have seen already, Garry's Mod is a multiplayer game and I would love to have every group member meet up in my server. What we really need though is someone who is willing to learn LUA Scripting. LUA will give us the ability to add the rules and boundaries to the game. This webpage contains a lot of information about the available classes and methods:
http://wiki.garrysmod.com/?title=Lua
I found an interesting snippet of code. This snippet makes it so that you can only pick up a weapon when holding the use key and looking directly at the weapon within a certain distance. It also has a pickup interval to make sure you don't pick up a whole pile of weapons all at once.

hook.Add( "PlayerSpawn", "PickupTimeout", function( ply )
ply.PickupTimeout = CurTime() + 0.5
end )
function GM:PlayerCanPickupWeapon( ply, entity )
if ( ply.PickupTimeout or 0 ) > CurTime() then return true end
if ( ply.NextPickup or 0 ) > CurTime() then return false end

if ply:KeyDown( IN_USE ) then
local tr = ply:GetEyeTrace()
if ValidEntity( tr.Entity ) and
tr.Entity:GetPos():Distance(ply:GetShootPos() ) < 92 and
tr.Entity == entity then
ply.NextPickup = CurTime() + 0.5
return true
end
end
return false
end

I don't have any experience in LUA, but I would be interested in learning some of it. Any programmers interested in learning LUA, please contact me: Fenix37197@gmail.com

No comments:

Post a Comment