Fortress Forever

Go Back   Fortress Forever > Projects > Fortress Forever > Feature

Adding custom LUA for all maps Issue Tools
issueid=147 04-11-2009 01:55 AM
QUAD ROCKET
Adding custom LUA for all maps
Using an lua on all maps

If we could use a custom lua for any map without including it in the <mapname>.lua file it could allow us to use plugin like features.

I tried including a custom lua via base.lua (because this is loaded every map) but some functions didn't work.

I was thinking there could be a file named 'custom_includes.lua', and any include path in this file would automatically be loaded every single map AFTER all other lua files are loaded.

Example if this idea was implemented:
- There is an lua that removed the conc effect and gave players quad damage.
- Then we include this lua in the 'custom_includes.lua'.
- This way a skills server admin could easily remove the conc effect and give players quad without editing the <mapname>.lua file.

That was only a simple example but I'm sure many of us could think of a lot more cool ideas.

How hard could this be to add in the next patch?!
Issue Details
Issue Type Feature
Project Fortress Forever
Category LUA (Map Scripting)
Status Implemented
Priority 4
Suggested Version 2.3
Implemented Version 2.42
Votes for this feature 5
Votes against this feature 0
Assigned Users Dexter
Tags (none)

04-11-2009 03:06 AM
Keep On Keepin' On
 
I approve this feature.
Reply
04-11-2009 02:44 PM
Pub Allstar!
 
+1
Reply
04-11-2009 03:11 PM
[AE] 0112 Ihmhi *SJB
 
One of the things in our pipeline is a sort of "Lua Switcher". So you could play 2fort, but from there you could decide how to play it. Do you want to play CTF, reverse CTF, or just plain team deathmatch? etc.

I don't think we'd have any set rules about it... basically you'd just drop the Lua in a certain place and then pick it out from a list. So yeah, this is on our to-do list for sure, trust me on that.
Reply
04-12-2009 04:53 AM
internet user
 
You're familiar with sv_mapluasuffix, correct? perhaps a ghetto approach would be a script to change it somehow before next map load.

edit: well, I misunderstood (ALL maps) but it still applies for a very ghetto approach XD
Reply
04-12-2009 11:42 PM
 
yeah, unless i've misunderstood you i think sv_mapluasuffix will do what you want but i suppose it's a bit messy (as it does more than you need, and example files aren't already in place for you). if you got any questions about sv_mapluasuffix then ask or pm me if you like.

if it's helpful then i guess we could make an example include "base_custom.lua" and a corresponding "ff_<mapname>__custom__.lua" file for each map, and put them in the next FF patch. i've assumed anyone competent enough to want to edit the lua would be capable of doing this themselves, but if it would be useful then it's v simple to do. whether an admin should be screwing with the lua on a non-map-dependant basis is another matter, but hey :) (i.e. surely on a skills map that map's lua should be configured appropriately already).
Reply
04-13-2009 06:56 PM
QUAD ROCKET
 
Doesn't sv_mapluasuffix just try to load a map specific lua with a suffix at the end?
Ex: ff_shutdown2__suffix__.lua

This won't work for what I'm talking about.

What I'm trying to say is any include path you add to custom_includes.lua will be loaded on EVERY SINGLE MAP!

So let's say in the custom_includes.lua we put the following:
IncludeScript("block_conc_effect");
IncludeScript("auto_reload_ammo");
IncludeScript("some_other_lua_loaded_on_each_map") ;

So now all 3 of these lua files will be loaded on EVERY MAP.

Like I said I tried doing this via base.lua (since it's loaded each map) but some functions didn't work as I guess other lua files had to be loaded first. So I'm assuming the custom lua files will need to be loaded after all other map specific lua files.
Reply
04-13-2009 07:12 PM
 
what i mean is:

1) copy each map's default lua file in your .../fortressforever/maps directory, and rename as "ff_<mapname>__custom__.lua".

2) edit each "ff_<mapname>__custom__.lua" you just created by adding the line "IncludeScript("base_custom");" right at the bottom.

3) create a new file called "base_custom.lua" in your .../fortressforever/maps/include directory.

4) edit the "base_custom.lua" to do whatever custom stuff you want. you can either directly write code here, or you could include other files (e.g. put "IncludeScript("block_conc_effect");" in your "base_custom.lua", then have a "block_conc_effect.lua" file in your .../fortressforever/maps/include directory).

you would then load your custom lua for all maps by having "sv_mapluasuffix custom". the custom stuff can easily be edited in a single file (base_custom.lua) either by writing code here or by including other files here. i don't see why this shouldn't work.

btw what i was suggesting was that we could do steps 1,2,3 so that it's easier for ppl like yourself.
Reply
04-13-2009 07:24 PM
 
I support this feature as well.
Reply
04-13-2009 07:28 PM
Ray Ray Johnson
 
Essentially sounds like a server-side global include.

sv_luaglobalinclude "blahblah"

Would look for and include blahblah.lua on every map load.

Something like that.
Reply
04-13-2009 10:43 PM
Time Lord, Doctor
 
Quote:
Originally Posted by trepid_jon
Essentially sounds like a server-side global include.

sv_luaglobalinclude "blahblah"

Would look for and include blahblah.lua on every map load.

Something like that.
Yea i was thinking either this or just toss a blank lua file that base teamplay or first include file will always include.
Reply
04-13-2009 10:51 PM
 
ideally that would be nice, sure, but imo there are so many far more important things waiting to be coded atm. what i posted above is a simple solution that you can use right now with no coding work required (along with a suggestion for a quick way to make this feature much simpler to use that also doesn't take up any coding time). when coding isn't such a precious resource (!) it would be good to have it coded tho, yep.
Reply
04-14-2009 01:19 AM
Ray Ray Johnson
 
Quote:
Originally Posted by ensiform
Yea i was thinking either this or just toss a blank lua file that base teamplay or first include file will always include.
The problem with the one file is that it's just that: one file. The cvar would allow you to have multiple "themes" so to speak. So one day you're doing anti conc effect, but then you change to a different mode without having to change any files other than using a different one. So you keep the different modes around and then easily switch in and out of them.

What caesium is suggesting is the easiest for now.

you can literally just do something like...

ff_2fort__custom__.lua

Inside that, include ff_2fort.lua, and then do your own stuff.

You have to do it for every map, which does suck. But it'll do until something can be coded in.
Reply
04-14-2009 02:39 AM
QUAD ROCKET
 
Quote:
Originally Posted by trepid_jon
What caesium is suggesting is the easiest for now.

you can literally just do something like...

ff_2fort__custom__.lua

Inside that, include ff_2fort.lua, and then do your own stuff.

You have to do it for every map, which does suck. But it'll do until something can be coded in.
Yeah I already knew about this. I was only suggesting this feature request so I don't have to edit every damn map lua to add the include line.

If there were a global include file it would be nice if it also had a suffix cvar as well.
Reply
04-14-2009 10:00 AM
 
Quote:
Originally Posted by hlstriker
Yeah I already knew about this. I was only suggesting this feature request so I don't have to edit every damn map lua to add the include line.
it would only take a few minutes to do if you know what you're doing, and i was offering to do all that bit for you if it would be helpful to ppl who aren't sure about what they're doing:
Quote:
Originally Posted by caesium
btw what i was suggesting was that we could do steps 1,2,3 so that it's easier for ppl like yourself.
^ i was hoping to get thoughts on that suggestion pls. you'd then have a single base_custom.lua (or whatever we want to call it) that you can put whatever you want in, and enable/disable it with a server settings. isn't that what you wanted? i'm confused :(

p.s. jon, afaik you can't include anything not in the include folder (well, i haven't found a way), so you'd have to copy/paste each map's lua not just include it. if there's a way it would be handy tho pls. ty.
Reply
04-14-2009 09:20 PM
QUAD ROCKET
 
Alright I had an even better idea for loading the global include files. What if you were to do it like SourceMod loads plugins. Just add the lua file(s) to lets say, 'FortressForever/maps/globals' directory, and every lua in this globals folder will automatically be loaded. This way server admins won't have to keep editing another file just to add/remove include path lines.

Quote:
Originally Posted by caesium
it would only take a few minutes to do if you know what you're doing, and i was offering to do all that bit for you if it would be helpful to ppl who aren't sure about what they're doing:
Yeah for people like us that know what we are doing could easily just make a batch file or something to go through and add the line to every lua in the maps directory. But what about the people that don't know stuff like that? It's for them (and the pure sake of simplicity) that I'm requesting this feature.

Quote:
Originally Posted by caesium
p.s. jon, afaik you can't include anything not in the include folder (well, i haven't found a way), so you'd have to copy/paste each map's lua not just include it. if there's a way it would be handy tho pls. ty.
This would also be very nice. Maybe change IncludeScript() so it can go back a directory with ../
Reply
04-14-2009 09:52 PM
 
i don't think you're understanding what i mean still. see the 1,2,3,4 post above for details, but what i'm suggesting is that devs do steps 1,2,3 for you and include all the "ff_<mapname>__custom__.lua" files with FF along with a blank "base_custom.lua" file with helpful comments. you'd then have a single file that you can put whatever you want in, and enable/disable it with a server setting. no batch files, no creating files, just a single file that ppl can edit.

it's not ideal because custom maps will need a __custom__.lua creating for them still (easy to do, just needs doing), but it's a working solution we can actually do that does not divert coding resources.
Reply
04-15-2009 12:09 AM
A Very Sound Guy!
 
isnt Lua supposed to be limited to map stuff anyway? i dont think it can edit weapons/grenades as such, and shouldn't.
Reply
04-15-2009 06:15 AM
Stuff Do-er
 
Quote:
Originally Posted by mervaka
isnt Lua supposed to be limited to map stuff anyway? i dont think it can edit weapons/grenades as such, and shouldn't.
Get with the times. Lua can do quite a bit (and should be able to do even more).
Reply
04-17-2009 05:53 AM
Community Member
 
Nice leak :D
Reply
04-17-2009 10:35 AM
 
ty, dexter :) problem solved hopefully
Reply
Reply

Issue Tools
Subscribe to this issue

All times are GMT. The time now is 07:35 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.