Sentry Limit Mod
twiliteblue
bug stalker Join Date: 2003-02-04 Member: 13116Members, NS2 Playtester, Squad Five Blue
<div class="IPBDescription">Sentry, Sentry, Sentry and Spam is not on the menu</div><!--coloro:#FF0000--><span style="color:#FF0000"><!--/coloro-->(for Build 185)<!--colorc--></span><!--/colorc-->
I've created a mod for limiting Sentries.
The initial setting limits 3 Sentries in an area with radius of 21. (The range of Sentry is 20.)
To use this mod, first place the downloaded zip into your "natural selection 2" folder.
Then start your ns2.exe with the option "-game mod_sentrylimit" (or whatever you renamed the zip file.)
Second version: <a href="http://www.mediafire.com/?xc2a57y74y151zl" target="_blank">Download Sentry Limit mod v2</a>
Installation:
1. Extract zip into your "natural selection 2\ns2\lua" directory.
2. Edit your natural selection 2\ns2\lua\Shared.lua and add the following line:
Script.Load("lua/SentryLimitMod.lua").
Old working version: <a href="http://www.mediafire.com/?8e8yz0y91iy24ky" target="_blank">Sentry Limit mod v1</a> (replaces default NS2Utility.lua)
Notes: Server admin can tweak the two variables near the top of the file
<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->kSentryBuildRadius = 21
kMaxSentryInArea = 3<!--QuoteEnd--></div><!--QuoteEEnd-->
Thanks to <b>FocusedWolf</b>, for improvements to the mod! Hopefully it will continue to work beyond build 185.
I've created a mod for limiting Sentries.
The initial setting limits 3 Sentries in an area with radius of 21. (The range of Sentry is 20.)
To use this mod, first place the downloaded zip into your "natural selection 2" folder.
Then start your ns2.exe with the option "-game mod_sentrylimit" (or whatever you renamed the zip file.)
Second version: <a href="http://www.mediafire.com/?xc2a57y74y151zl" target="_blank">Download Sentry Limit mod v2</a>
Installation:
1. Extract zip into your "natural selection 2\ns2\lua" directory.
2. Edit your natural selection 2\ns2\lua\Shared.lua and add the following line:
Script.Load("lua/SentryLimitMod.lua").
Old working version: <a href="http://www.mediafire.com/?8e8yz0y91iy24ky" target="_blank">Sentry Limit mod v1</a> (replaces default NS2Utility.lua)
Notes: Server admin can tweak the two variables near the top of the file
<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->kSentryBuildRadius = 21
kMaxSentryInArea = 3<!--QuoteEnd--></div><!--QuoteEEnd-->
Thanks to <b>FocusedWolf</b>, for improvements to the mod! Hopefully it will continue to work beyond build 185.
Comments
I hope server admins will use your script! In my opinion it's much better to avoid sentry spam on the server side than kicking player after doing it.
I hope server admins will use your script! In my opinion it's much better to avoid sentry spam on the server side than kicking player after doing it.<!--QuoteEnd--></div><!--QuoteEEnd-->
I know, the function is called every tick, which isn't very efficient (not my code!). IMO it should only send an error when the client sends the command to place the entity (by LClicking). But I don't have the time to optimize it. I also tried to check its server load with the profiler, but it doesn't appear to be significant.
Yeah don't worry about that it's working good. I just saw that HBZ already installed it to their server and it didn't explode, so all fine there ^^
Thanks to the grenade launcher alien spam isn't a real problem. A few nades kill every hydra garden.
<!--quoteo(post=1872426:date=Sep 1 2011, 05:05 AM:name=aeroripper)--><div class='quotetop'>QUOTE (aeroripper @ Sep 1 2011, 05:05 AM) <a href="index.php?act=findpost&pid=1872426"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->You should go further. Have a hard limit of 4 sentries per robotics factory. Turrets should only augment base defense with your own marines, not be "the" base defense. This will also make it so commanders place them more wisely instead of spamming them everywhere as a strategy. Focus less on building turrets, and more on getting upgrades for your team.<!--QuoteEnd--></div><!--QuoteEEnd-->
No. Turret spam usually appears at the end game if the marines already have all upgrades. Besides the "turret factory" concept itself I don't think it's a good idea do make such an intervention in the current game play because I think it would disturb a realistic beta testing progress to much. Such changes should be better put in alternatives like Schimmels PT-mod.
No. Turret spam usually appears at the end game if the marines already have all upgrades. Besides the "turret factory" concept itself I don't think it's a good idea do make such an intervention in the current game play because I think it would disturb a realistic beta testing progress to much. Such changes should be better put in alternatives like Schimmels PT-mod.<!--QuoteEnd--></div><!--QuoteEEnd-->
What I meant was that Hydras spam can be abused to create unnecessary load on the server, as you can literally spam a hundred Hydras in each room, due to the lack of entity count checking mechanism.
I will say this though. People should be warned not to set kSentryBuildRadius to large or else it will prevent sentry building in adjacent rooms.
Also, i reduced your mods code if your're interested (it's certainly less likely to break now between versions): <a href="http://pastebin.com/gUH8YzkL" target="_blank">http://pastebin.com/gUH8YzkL</a>
This version has comments explaining the various changes: <a href="http://pastebin.com/L7P8BSFU" target="_blank">http://pastebin.com/L7P8BSFU</a>
Btw, is it really necessary to show the error message. I mean i guess it is because it's not the vanilla behavior and people will wonder why they can't build fields of turrents. But maybe they'll figure it out when the turrent doesn't drop?
I think the error message is essential for giving user feedback. It's a quicker way of giving info, than having to ask another player, or forum admin.
I've edited your code slightly. Here's my version: <a href="http://pastebin.com/ynQE6vkj" target="_blank">http://pastebin.com/ynQE6vkj</a>
Ya the XZ check makes sense, but i see GetTeamNumber() is back. It's easy to remove again by implementing the missing "GetEntitiesWithinXZRange" function: <a href="http://pastebin.com/ruLiA5Ws" target="_blank">http://pastebin.com/ruLiA5Ws</a> (i'm only light testing this but i'm not seeing any issues with skipping the team check... like it's not showing up when dropping 5+ whips... that's about the extent of my testing :P)
Ya the thing with the error message that i found annoying was how long that tooltip lingers. At first it seemed to be showing incorrectly despite the fact that a ghost sentry (indicating a valid placement) was visible, but if you wait like 5+ seconds the message will disappear, so it really is testing where the cursor is. Just seemed weird at first.
EDIT: Lol just noticed their's a sort of buzzing sound when trying to drop a turrent close to 4 sentries... it's the sound of a million tooltips getting shown.
Was GetTeamNumber() misbehaving? :P I don't seem to have any trouble running that code I posted.
No their's nothing functionally wrong with your code. It's just going to be slightly (unnoticeably) less efficient with the team check. That's assuming the team check is unnecessary.
You understand LUA a lot better than me. Looks like your solution is more efficient for our need (until both teams can build Sentries). :D
Aka i made more mistakes, and here's another xD: The sillyness i did with base_CheckBuildEntityRequirements wasn't necessary (wrapping with if statement). Updated code: <a href="http://pastebin.com/ruLiA5Ws" target="_blank">http://pastebin.com/ruLiA5Ws</a> In the past i needed to do something like that but i don't think it's needed for this situation.
For example, story time: <a href="http://www.unknownworlds.com/ns2/forums/index.php?showtopic=112425" target="_blank">http://www.unknownworlds.com/ns2/forums/in...howtopic=112425</a> I learned a lot of the techniques for overloading stuff from the Player_Client.lua of that mod. But in the process of saving changes to files i found that mods approach to not handle code reloads right.
Then through some trial and error i figured out a way that worked through reloads (this is for overloading member functions of a class only):
if not GUIMarineHUD.base_Initialize then
GUIMarineHUD.base_Initialize = GUIMarineHUD.Initialize
end
function GUIMarineHUD:Initialize()
GUIMarineHUD.base_Initialize(self)
... added code goes here
end
But i'm thinking for your mod it's not necessary because everything is global functions.
Oops looks like the link changed when I updated it. I'll put it back up shortly!
(Update: New version is up! Thanks FocusedWolf!)
But how can i integrate it. I mean, if i replace the original-one with this version, i think im going to break the game.
But how can i integrate it. I mean, if i replace the original-one with this version, i think im going to break the game.<!--QuoteEnd--></div><!--QuoteEEnd-->
Oops I forgot to mention that. :P
You have to run it as a mod, so it can load the original NS2Utility.lua.
I didn't test this, but i'm guessing it will work. Try copying the lua file to the NS2GmOvrmind\Lua folder.
A bit of a guess, but if you download the latest version, rename "SentryLimitMod.lua" to "NS2Utility.lua", and then place it in the NS2GmOvrmind/Lua-directory, it should properly override the default NS2Utility.lua (but still load it manually in the first line).
Structure Limit Mod for build 188:
- hydras are now affected by the global entity limit (same as commanders have)
- seperate hydra per area limitation
- mini cyst per area limitation
- sentry limitation
i already tried to optimize those numbers. if you want to keep your servers stable, you might only edit the sentry limitations and keep the cyst and hydra. Those two are responsible to some higher degree for bad server performance.
simply extract the files and overwrite the lua folder with the one in the zip, you can edit the limitations by:
for hydra open lua/Weapon/alien/HydraAbility.lua and change the variable on top of the file.
same for lua/Weapon/alien/CystAbility.lua
and sentry limitations are defined in lua/NS2Utility.lua on top of the file
i also included my hotfixes for build 188 (power node repair rate, GL / healspray bug, script errors fixes)
<i>update: I merged it with the hotfix release. it's serving the same purpose (improving server performance)</i>
<!--sizeo:4--><span style="font-size:14pt;line-height:100%"><!--/sizeo--><a href="http://www.mediafire.com/?lxp06ti7l3j5me3" target="_blank">Structure Limit Mod</a><!--sizec--></span><!--/sizec--> (188_fixes_b)
edit: before i get feedback that the cyst limitation is not working: it only applies to the mini cysts, and is therefor also only checking for mini cysts in a specific area! the commander can still place normal cysts as before, which i don't see as a problem because they tend to use their energy more wisely and i don't want to prevent the "cyst rush" tactic :D
this work with latest build ?
this work with latest build ?<!--QuoteEnd--></div><!--QuoteEEnd-->
Not really needed anymore since the latest build only allows 3 sentries per room.