Help build a game mode!

I have an idea for a game mode that in my mind would be lots of fun.

The idea is that players a split into two factions, each faction will have a Commander, a General, Soldiers, and Engineers. Within the first hour of a round the teams start building a base. When the game starts the Soldiers will push forward to destroy the other teams base as the General formulates an attack strategy that is displayed in the soldiers HUDs. The Commander will be the foundation of both teams he will pretty much have the ability to ruin a team financially, he buys and summons each unique weapons.

Commanders and Generals are voted upon in the pregame lobby.

Please feel free to build on to my idea and help this game mode become a reality, if some one would explain game mode hooks to me in detail I will be able to work on this game mode as well.

This is my first huge project and I intend to pull through on it, to quote a movie… “May be not today, may be not tomorrow, but some day.”

I have posted the original post HERE.

If you want to pull it through, try: lua.org/pil

Thanks that site will help allot but I also use… http://wiki.garrysmod.com/?title=Lua

I was hoping to get more replies in here…

If some one wants to contribute don’t hesitate to post. Also if this is in the wrong section I would like an admin to move it into the correct section.

sounds like fortwars if u ask me.

I like your idea, 30 minutes of building anything you dam well please then blowing eachothers shit up.

sounds fun.
To bad i dont have the time to help.

It may sound like FortWars but its not FortWars… -.-

Because Fort-Wars does not have many elements of my game mode, tho it may seem similar.
My Game-mode can easily be called an advanced version of Fort-Wars tho, so yes it may sound like Fort-Wars but its not Fort-Wars.

Currently I cant get a script to work, please do not bash me…



function GM:EntityTakeDamage( ent )
 
	if ent:IsPlayer() then
		Hp = ent:Health()
		if(Hp <= 41) then
			
			Mult = (200 - Hp - 159)
			
			local tab = {}
			tab[ "$pp_colour_addr" ] = 5 * Mult
			tab[ "$pp_colour_addg" ] = 0
			tab[ "$pp_colour_addb" ] = 0
			tab[ "$pp_colour_brightness" ] = 0
			tab[ "$pp_colour_contrast" ] = 1
			tab[ "$pp_colour_colour" ] = 1
			tab[ "$pp_colour_mulr" ] = Hp * 2
			tab[ "$pp_colour_mulg" ] = 1
			tab[ "$pp_colour_mulb" ] = 1 
 
			DrawColorModify( tab )
			DrawMotionBlur( 0.5, 0.5, 0.1)
			DrawBloom( 1, Hp/100, 3, 9, 9, 1, 255, 0, 0 )
		end
	end
 end

hook.Add( "RenderScreenspaceEffects", "RenderEFunc", RenderEFunc )


[lua\autorun\sh_damageeffect.lua:1] attempt to index global ‘GM’ (a nil value)

[editline]9th August 2011[/editline]

Also if you have any tips post them here…

use GAMEMODE instead of GM

Why are you using GM functions in autorun?

Why are you trying to add blur and bloom on serverside?

I am doing that to add a event to that function…

Use hook.Add, or edit it in the gamemode. Autorun doesn’t have access to GM functions, if I recall correctly.

hmm, if it would not work correctly in autorun where should I put the command?

Some one has recommended that I change GM to GAMEMODE and it now gives me a diffrent error…



ERROR: Hook 'RenderEFunc' Failed: [lua\autorun\client\cl_damageeffect.lua:24] attempt to call global 'DrawColorModify' (a nil value)
Removing Hook 'RenderEFunc'
ERROR: GAMEMODE:'EntityTakeDamage' Failed: [addons\ulib\lua\ulib\shared\hook.lua:173] attempt to index local 'gm' (a function value)


This is my current code…



function GAMEMODE:EntityTakeDamage( ent )
 
	if ent:IsPlayer() then
		Hp = ent:Health()
		if(Hp <= 41) then			
			hook.Call( "RenderScreenspaceEffects", RenderEFunc, ent, Hp )
		end
	end
end

function RenderEFunc( ent, Hp )
	
	local tab = {}
		tab[ "$pp_colour_addr" ] = 5
		tab[ "$pp_colour_addg" ] = 0
		tab[ "$pp_colour_addb" ] = 0
		tab[ "$pp_colour_brightness" ] = 0
		tab[ "$pp_colour_contrast" ] = 1
		tab[ "$pp_colour_colour" ] = 1
		tab[ "$pp_colour_mulr" ] = Hp * 2
		tab[ "$pp_colour_mulg" ] = 1
		tab[ "$pp_colour_mulb" ] = 1 

	DrawColorModify( tab )
	
	DrawMotionBlur( 0.5, 0.5, 0.1 )
	DrawBloom( 1, Hp/100, 3, 9, 9, 1, 255, 0, 0 )
				
end

hook.Add( "RenderScreenspaceEffects", "RenderEFunc", RenderEFunc )


[editline]13th August 2011[/editline]

I am no longer doing that, I changed my code and I am running it in shared, I have tried running it on client but now I get this error,


 autorun/client/cl_damageeffect.lua...
ERROR: Hook 'RenderEFunc' Failed: [lua\autorun\client\cl_damageeffect.lua:24] attempt to call global 'DrawColorModify' (a nil value)
Removing Hook 'RenderEFunc'
ERROR: GAMEMODE:'EntityTakeDamage' Failed: [addons\ulib\lua\ulib\shared\hook.lua:173] attempt to index local 'gm' (a function value)


I have tried some variations but they all seem to fail.

#1. DrawColorModify is clientside, you’re probably attempting to run it on the server.
#2. You’re trying to say with line 6 that RenderEFunc is gm. It isn’t. The second argument needs to be nil.