UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

[script] Perk Watcher

HOT
broken avatar :(
Created 10 years ago
by daedra descent
0 Members and 1 Guest are viewing this topic.
11,789 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Comments, questions, suggestion's are all welcome.

I'm new at this. I don't even know C++. I know a little Python. It looks like hasperk(X) returns a true or false, right? If so then could you just:

Code Snippet
Plaintext
watch_player_perks()
{
while(1)
{
players = get_players();
for(k = 0; k < players.size; k++)
{
                        //Edit: Forgot players[k] and now I forgot the s
players[k].has_jug = players[k] hasperk("specialty_armorvest");
players[k].has_revive = players[k] hasperk("specialty_quickrevive");
players[k].has_rof = players[k] hasperk( "specialty_rof");
players[k].has_reload = players[k] hasperk( "specialty_fastreload");
}
wait(.1);
}
}

If so then this would be easy to read and add new perks later...
Last Edit: April 08, 2014, 05:58:10 pm by MakeCents
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
I'm new at this. I don't even know C++. I know a little Python. It looks like hasperk(X) returns a true or false, right? If so then could you just:

Code Snippet
Plaintext
watch_player_perks()
{
while(1)
{
players = get_players();
for(k = 0; k < players.size; k++)
{
                        //Edit: Forgot player[k]
players[k].has_jug = player[k] hasperk("specialty_armorvest");
players[k].has_revive = player[k] hasperk("specialty_quickrevive");
players[k].has_rof = player[k] hasperk( "specialty_rof");
players[k].has_reload = player[k] hasperk( "specialty_fastreload");
}
wait(.1);
}
}

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.  :D
broken avatar :(
×
broken avatar :(
[UGX] Maintainer (Admin & Programmer)
Location: deFriedrichshafen, Baden-Württemberg, Germany
Date Registered: 29 August 2012
Last active: 7 minutes ago
Posts
435
Respect
Forum Rank
Perk Hacker
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
Personal Quote
Dolphin!
Signature
changed one line of code, bug is fixed


Coming to work on monday morning.
When a bug mysteriously disappears.


:ugxmods: Developer ;)
×
Delta's Groups
UGX Administrator
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
UGX Chat Moderator Has the ability to mute, kick, or ban chat members for being abusive or breaking the rules of the forum.
UGX Site Moderator 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
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Delta's Contact & Social Linksthe-deltaugxDeltaItsDeltaigDelta igdeltaigdeltaUGX_DeltaDelta#6147Personal Site
Is this some kind of competition?

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.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
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.  :D

Oh, okay, I gotcha. Thanks.


Is this some kind of competition?

We're just talking man, ha ha.

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
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
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
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
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
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
if you want to make stuff if player has a perk couldnt you just check if the player has the perk?

Thats what this does... it checks if any of the players have any of the perks.

lol you could just edit the perks.gsc to make your wanted actions after player buyed the perk

This:

Quote
after player buyed the perk

Just because a player has bought a perk doesn't mean they'll always have it(i.e. if they get downed or die).
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 9 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
Signature
If Java had true garbage collection, most programs would delete themselves upon execution.
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator 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.
Thats just a slightly more efficient way of doing it.
It's also a smarter way to do it.

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.



I'm new at this. I don't even know C++. I know a little Python. It looks like hasperk(X) returns a true or false, right? If so then could you just:
Code Snippet
Plaintext
players[k].has_jug = players[k] hasperk("specialty_armorvest");
Yep, this works too and is shorter than the original code.

 
Loading ...