If so then this would be easy to read and add new perks later...
Well,
Code Snippet
Plaintext
player[k]
should be:
Code Snippet
Plaintext
players[k]
but yeah i don't really see why that wouldn't work. The only real difference is that your isn't defined in an array which is then filtered out by:
Code Snippet
Plaintext
if(players[k] hasperk(perks[i]) )
and then by:
Code Snippet
Plaintext
if(perks[i] == "Perk_name")
The reasoning for the way i did it is so you can do things like the Quick Revive example that i did without making a separate function or making a new if statement. Use whichever floats your boat.
Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Has the ability to mute, kick, or ban chat members for being abusive or breaking the rules of the forum.
Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Also why should people be like an ass when they make a optimized version of this? This is not rocket science nor a really complex thing.
I would understand if this is some kind of Framework or API but for such easy thing? Well Delta, you always see something new.
I'm also confused that this is in a section for mappers ready to use, but there are like 2-3 different versions of the script. Seems like there is some need for a better general system here. *delta has an idea* Also seems like the general "copyright" thing is a huge thing.
The reasoning for the way i did it is so you can do things like the Quick Revive example that i did without making a separate function or making a new if statement. Use whichever floats your boat.
Seems like there is some need for a better general system here. *delta has an idea* Also seems like the general "copyright" thing is a huge thing.
Like a "Critique my code" section? Or, "how would you tweak this" section. Warning: Everything posted here is free to use and subjected to criticism, lol. That way even people who know what they are doing could see how others would do it. More like a work group.
Last Edit: April 08, 2014, 06:26:56 pm by MakeCents
I'm also confused that this is in a section for mappers ready to use, but there are like 2-3 different versions of the script.
Quote
Like a "Critique my code" section? Or, "how would you tweak this" section. Warning: Everything posted here is free to use and subjected to criticism, lol. That way even people who know what they are doing could see how others would do it. More like a work group.
This. I posted it here so that if a mapper wants to use if they want, but also if anyone wants to give feedback.
Quote
Seems like there is some need for a better general system here. *delta has an idea*
Like i said, open for suggestions. Obviously this can be done in different ways and in no way am i saying mine is perfect.
Last Edit: April 08, 2014, 07:00:12 pm by daedra descent
if you want to make stuff if player has a perk couldnt you just check if the player has the perk? .-. lol you could just edit the perks.gsc to make your wanted actions after player buyed the perk
Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
my version is a bit easier on the eyes & easier to follow.
This is not the tutorials section, so you should be focused on improvements not how "easy on the eyes" the code is. In fact, "easy on the eyes" is completely relative to a person's coding skills. To someone who is experienced, shorter code is always easier to manage.
It really doesn't matter if the person knows how to read the code because if they did, they wouldn't need to be in the scripting section copy/pasting someone else's code - they would write it themselves. And for the people who do want to use this, I provided a MUCH simpler implementation for adding additional perks and taking advantage of the .currentPerks array outside of the function with a single line of code. The user no longer has to add 5 lines of code and a new player variable in order to check one additional perk. They simply add it to the list at the beginning of the function and voila.