I'm creating a map for my fretta gamemode which is quite similar to capture the flag. In the center of the map I want to have an object that can be interacted with by the player, the object would then spawn another object (the flag) and the players fight for that.
The only thing I have been able to find is the lua_run entity ([url]http://wiki.garrysmod.com/?title=Lua_run_%28entity%29[/url]), it works well, but what I need is it to execute a function that is defined in my gamemode scripts so that I can do things like "Someguy just picked up the flag" and more advanced things that require external variables.
If anyone could help me out or show me an alternative that would be awesome :)
You'd need this somewhere on the server:
[code]
function GM:PlayerPickedUpFlag( pl )
...
end
[/code]
And the Code property:
[code]
gamemode.Call( "PlayerPickedUpFlag", ACTIVATOR )
[/code]
[code]
hook.Call( "PlayerPickedUpFlag", GAMEMODE, ACTIVATOR )
[/code]
[code]
GAMEMODE:PlayerPickedUpFlag( ACTIVATOR )
[/code]
All of those should do the same thing. Only use the third one if you hate extensibility.
You'd probably be best off using a custom SENT.
Have a look at the ctf gamemode on the facepunch fretta SVN. It does a pretty similar thing.
I'd go with DEADBEEF's option, making a SENT like this is really easy.
Look into the FGD system Hammer uses so your mappers can put the SENT into the map directly.
[url]http://developer.valvesoftware.com/wiki/FGD[/url]
Wow, thanks for the quick replies
[QUOTE=DEADBEEF;18999028]You'd probably be best off using a custom SENT.
Have a look at the ctf gamemode on the facepunch fretta SVN. It does a pretty similar thing.[/QUOTE]
-snip-
Sorry, you need to Log In to post a reply to this thread.