Raised This Month: $51 Target: $400
 12% 

Limit Hero Choices by Level


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
3volution
Junior Member
Join Date: Jun 2006
Old 03-28-2012 , 14:30   Limit Hero Choices by Level
Reply With Quote #1

I recently got inspired to re-create my old SH cs server and came across an issue that I have not been able to solve yet.

I am trying to find a way to only allow a specified amount of hero choices per hero level (I personally only want one choice per "level group," but might as well make it variable.).

After searching the forums a bit, I stumbled upon G-Dog's sample plugin to create groups of heroes that restrict each other. I messed around with that for awhile, but the indexing isn't correct and doesn't function properly. I figured the easiest way is to just manually change the core sh plugin itself (FYI, I have tried a few solutions myself, but they either completely turn off being able to choose a hero altogether (or even showmenu) or they only allow a single hero choice no matter what level).

Basically, I just need help changing sh_lvllimit to actually limit the total amount of hero choices per hero level, instead of it being a pyramid scheme.

Any help with this issue would be greatly appreciated. It is the last thing I need to get finished before my balanced play SH server is ready to go live.

Last edited by 3volution; 04-02-2012 at 02:21. Reason: Removed [code] as it is irrelevant and not the only spot that would need to be modified anyways
3volution is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 03-28-2012 , 18:27   Re: Limit Hero Choices by Level
Reply With Quote #2

I am not really sure what you are asking here.

You want people to be able to pick two heroes for each level they advance, or do you want it so you can choose like 3 heroes when you get level 2, then two more at level 3, then one at level 4, then two at level 5?
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
3volution
Junior Member
Join Date: Jun 2006
Old 03-28-2012 , 18:56   Re: Limit Hero Choices by Level
Reply With Quote #3

Quote:
Originally Posted by Jelle View Post
I am not really sure what you are asking here.

You want people to be able to pick two heroes for each level they advance, or do you want it so you can choose like 3 heroes when you get level 2, then two more at level 3, then one at level 4, then two at level 5?
I want it to be where you can only choose a certain number of heroes for each level based on a config.

So, let's say that sh_lvllimit is set to 1. If you are playerlevel 5 you could choose one level 5 hero, one level 4, one level 3, etc.. Though if it's easier to just hardcode it to only allow one hero choice per hero level, that is fine as well.

Last edited by 3volution; 03-28-2012 at 18:59.
3volution is offline
G-Dog
Senior Member
Join Date: Dec 2005
Location: Thunderstorm Central
Old 03-28-2012 , 19:20   Re: Limit Hero Choices by Level
Reply With Quote #4

well just to clarify that the group plugin updated would force a player to only be able to choose 1 hero in a group and can't be changed on the fly to allow 2 by simply changing sh_lvllimit, so just want to make sure that's what you want before I go through the trouble of trying to fix it. If on the other hand you wanted me to redesign it slightly to allow x heroes be chosen from a group where x is defined by a variable then I would probably end up redesigning it from scratch since I know what caused some of the errors as they were addressed in my adminrestrict plugin(which actually started off with the group plugin as the base that got reworked)
__________________
If at first you don't succeed, then skydiving isn't for you.
G-Dog is offline
Send a message via AIM to G-Dog
3volution
Junior Member
Join Date: Jun 2006
Old 03-28-2012 , 21:38   Re: Limit Hero Choices by Level
Reply With Quote #5

Quote:
Originally Posted by G-Dog View Post
well just to clarify that the group plugin updated would force a player to only be able to choose 1 hero in a group and can't be changed on the fly to allow 2 by simply changing sh_lvllimit, so just want to make sure that's what you want before I go through the trouble of trying to fix it. If on the other hand you wanted me to redesign it slightly to allow x heroes be chosen from a group where x is defined by a variable then I would probably end up redesigning it from scratch since I know what caused some of the errors as they were addressed in my adminrestrict plugin(which actually started off with the group plugin as the base that got reworked)
Either way is fine. I only need one choice per level myself but thought others may want it variable. One thing about using the sh_groups plugin over directly modifying superheromod though is that it requires you to have sh_alivedrop set to 1, which means there are lots of potential exploits.
3volution is offline
G-Dog
Senior Member
Join Date: Dec 2005
Location: Thunderstorm Central
Old 03-30-2012 , 13:39   Re: Limit Hero Choices by Level
Reply With Quote #6

well here you go then, the new cvar sh_group_num determines how many heroes from a group a player can select, let me know if you run into trouble as I don't really have anything to test this on myself(too lazy to redownload everything to run a hlds server just for this).
Attached Files
File Type: sma Get Plugin or Get Source (sh_group.sma - 670 views - 7.9 KB)
__________________
If at first you don't succeed, then skydiving isn't for you.
G-Dog is offline
Send a message via AIM to G-Dog
3volution
Junior Member
Join Date: Jun 2006
Old 03-31-2012 , 14:24   Re: Limit Hero Choices by Level
Reply With Quote #7

Thanks for the help G-Dog. I had a few errors with the functionality of the plugin, but I was able to sort it out after modifying some code and using ham_strip_weapon instead of sh_drop_weapon on certain heroes (some heroes didn't like being dropped that way and would still function/give weapons and change models/mess with picking heroes from that group again even if you tried to re-select the same hero).

I will test it more thoroughly later today, hopefully I can get a few people to join the server for that.

The only issue I still have at the moment is that with the increased characters in info, it is possible to block part of the menu from being displayed (e.g. instead of it saying "9. More Heroes ^ 0. Cancel" it cuts off at "9. More Her"). But, that's just cosmetic and can probably be fixed just by trimming or rewording some 'hero info's.

Once again, thank you so much for the help!
3volution is offline
3volution
Junior Member
Join Date: Jun 2006
Old 04-01-2012 , 00:27   Re: Limit Hero Choices by Level
Reply With Quote #8

Just got done with some more testing and I found an easily repeatable error. Powers are not resetting properly in certain circumstances.

As an example that I can display in game on my server right now:

I have two heroes set to the same group, Veronika and Hitman. ( in the file shgroups.ini, on its own line: !Veronika Hitman )

Starting with a fresh clearpowers and map change, I choose Hitman.

I then attempt to select Veronika.

I temporary recieve Veronika, which then prints the shgroups message and gets dropped (temporarily gives the weapon and then drops it on the ground if using default sh_give/drop...which also resets any switch models until that subroutine gets called again in the respective hero plugin).

I now clearpowers to attempt to change my choice and select Veronika instead of Hitman.

Upon trying to select Veronika, the shgroups message pops up again (incorrectly) and does the same as above.

I now showmenu and choose Hitman again. The shgroups messages pops up (again incorrectly) but still gives me the hero.

I now have Hitman powers, but it did not take up one of my hero choices, does not show up in a /playerskills @all, and can still see Hitman in the showmenu.

It does the same with other hero groups of the included standard heroes, so it's not an error in the gHasHero[id] for a set of custom heroes. Also, choosing the hero listed first in the group in shgroups.ini does gives the same results.

My hypothesis is that the override and/or plugin is not correctly forwarding SH_HERO_DROP (the switch case SH_HERO_ADD/case SH_HERO DROP that is standard practice for setting gHasHero[id]...but I'm not sure how to explain having a hero power for give_weapon heroes while it not showing up in /playerskills). Also, wherever the choice of a hero in a group is being stored, it is not being updated correctly when a hero is dropped.

EDIT: I ran more tests with heroes that have keybinds and heroes that do not give weapons, and I did not receive extra powers like in the example above. However, I was not able to pick back up the hero I dropped, or ever get the hero that shared a group with the original selection. I believe somehow the give_weapon heroes were still getting their power due to subroutines based on weaponID if you picked up the weapon for that hero. I'm not sure how they are getting past the gHasHero check though.

I also troubleshooted the shgroups.ini file to make sure it wasn't an invalid entry somewhere causing unintended functions. Even with a clean file with just one group of two heroes, that single group was not working correctly.

I am going to start again with a clean superheromod.sma off the SVN and make the changes according to the directions in sh_group.sma.

As always, any help trying to get this resolved and functional would be greatly appreciated!

Last edited by 3volution; 04-01-2012 at 00:33.
3volution is offline
G-Dog
Senior Member
Join Date: Dec 2005
Location: Thunderstorm Central
Old 04-01-2012 , 09:13   Re: Limit Hero Choices by Level
Reply With Quote #9

see if this helps, added a small delay to the drop to allow plugins to properly update before sending the drop message
Attached Files
File Type: sma Get Plugin or Get Source (sh_group.sma - 729 views - 8.3 KB)
__________________
If at first you don't succeed, then skydiving isn't for you.
G-Dog is offline
Send a message via AIM to G-Dog
3volution
Junior Member
Join Date: Jun 2006
Old 04-01-2012 , 12:38   Re: Limit Hero Choices by Level
Reply With Quote #10

Quote:
Originally Posted by G-Dog View Post
see if this helps, added a small delay to the drop to allow plugins to properly update before sending the drop message
Did some quick testing and works much better!

One cosmetic thing though is that if you pick a hero with a keybind that will get auto dropped, it will still incorrectly show the keybind at the bottom next to your level/xp until you either die or choose another keybind hero to update it. It's only cosmetic though, so not a significant issue at all.

I'll do more testing later if I can get some friends on my server to help test some stuff.

Thanks for everything so far, G-Dog!

EDIT: If anyone would like to help test or even just play on a balanced SH server, please add me on steam: http://steamcommunity.com/id/3volution

Last edited by 3volution; 04-02-2012 at 02:25.
3volution is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode