[JASS] JJCP: NewGen

Cheatpacks and learning how to use them, as well as other guides for manipulating maps.

Moderator: Cheaters

User avatar
nuzamacuxe
Also Not an Admin, but closer than devoltz
Posts: 1655
Joined: February 14th, 2018, 5:35 am
Title: Just Another S.Mod
Been thanked: 6 times

[JASS] JJCP: NewGen

Post by nuzamacuxe »

Image
What is New Gen?
  • It's JJ2197's cheatpack remade by nuzamacuxe.
Why did you remade it?
  • Because the old one wasn't well coded, had potential leaks and some commands weren't working correctly (example: autoh).
But have you changed everything?
  • No. I tried to not change for example the command names since some people would be confused saying that x command isn't working.
    But I removed some useless commands like: area, noarea, dead, birth, stand, attack, regmin, regmax, reg, ground, spa, destid.
To check the command list you must input a space after list command. Example: -list 1
What changes were made then?
  • - Don't need to type "-note", "-nomana", "-cdon" to disable those commands anymore. To disable teleport command, for example, you just need to type "-tele" again;
    - Autoheal works properly and it's MUI now (can handle multiples units);
    - Code is way better than before;
    - Supports arrow activator;
    - Name activator is visible and easy to change;
    - It now uses group recycle instead of create and destroy group;
    - No leaks and lightweight;
    - Easy to add new commands;
    - New commands: stats (adds # to all your stats), clear (clear your screen), ploc (pings x y location);
    - Now you can change teleport key to A or M;
    - Compatible with latest Warcraft III version;
    - Now you can change the operator symbol easily.
Could you show me the code difference?
  • Sure.
Image

ACTIVATOR:
-wc3edit
You do not have the required permissions to view the files attached to this post.
owner123
Super Moderator
Posts: 1943
Joined: February 3rd, 2009, 11:28 pm
Been thanked: 1 time

Re: [JASS] JJCP: NewGen

Post by owner123 »

Very nice! Looks much cleaner even with just a quick glance over it. No more dynamic triggers and WaitForString calls.
Small efficiency comment: I'd make these commands use elseif rather than "endif/then" like this:

Code: Select all

				if command == "debuff" then
					call UnitRemoveBuffs( jjUnit, true, true )
				endif
				if command == "heal" then
					call UnitRestoreLife( jjUnit, UnitMaxLife( jjUnit ) )
				endif
That way we can save computation on evaluating these ifs
User avatar
Vegas
Shopping Maul USA Creator
Posts: 1759
Joined: January 18th, 2007, 11:07 am
Title: No Comment
Location: Calgary Canada
Has thanked: 44 times
Been thanked: 8 times

Re: [JASS] JJCP: NewGen

Post by Vegas »

Awesome job!!
owner123
Super Moderator
Posts: 1943
Joined: February 3rd, 2009, 11:28 pm
Been thanked: 1 time

Re: [JASS] JJCP: NewGen

Post by owner123 »

Here's a version of this with nice formatting (tabbed in on code blocks) for reading purposes.
JJCP-New-Formatted.j
And here's a version of this with the names scrambled up and randomized so that it won't collide with any variables/functions (avoids basic anti cheat)
JJCP-New-Scrambled.j
You do not have the required permissions to view the files attached to this post.
User avatar
devoltz
Co-Admin
Posts: 3127
Joined: March 23rd, 2016, 8:06 pm
Has thanked: 9 times
Been thanked: 53 times

Re: [JASS] JJCP: NewGen

Post by devoltz »

~nuza with time~
User avatar
nuzamacuxe
Also Not an Admin, but closer than devoltz
Posts: 1655
Joined: February 14th, 2018, 5:35 am
Title: Just Another S.Mod
Been thanked: 6 times

Re: [JASS] JJCP: NewGen

Post by nuzamacuxe »

Thanks guys.
owner123 wrote:Very nice! Looks much cleaner even with just a quick glance over it. No more dynamic triggers and WaitForString calls.
Small efficiency comment: I'd make these commands use elseif rather than "endif/then" like this:

...

That way we can save computation on evaluating these ifs
Thanks for suggestion. I got what you mean, but grouping commands (at least when we are talking about Warcraft) in general is useless. xD
User avatar
haxorico
Super Moderator
Posts: 3197
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND
Been thanked: 1 time

Re: [JASS] JJCP: NewGen

Post by haxorico »

Good job, great to see updates to old CPs and keeping it alive!

nuzamacuxe wrote:- It now uses group recycle instead of create and destroy group;
Why not destroy the group after use?
From what I read in the code (and I could be wrong as I looked at a notepad on my phone..), the group is now a global variable that keeps on getting the units called upon and then removing the units (as was previously).

Isn't that a "waste of space" - as while the variable isnt being used it is still taking place (also taking space in the heap and not the stack? not sure how jass works but meh).

Just curious as I have NOT been using jass for some time now. Seems like a lot of new optimization have been made :)
User avatar
nuzamacuxe
Also Not an Admin, but closer than devoltz
Posts: 1655
Joined: February 14th, 2018, 5:35 am
Title: Just Another S.Mod
Been thanked: 6 times

Re: [JASS] JJCP: NewGen

Post by nuzamacuxe »

Thanks, haxorico.

Because it's inefficient.

No, using a global group more than once by emptying it everytime will not cause any leaks nor "waste of space". Since I use pure jass to code, it's just better to use a global group and recycle it. GUI is different though.
User avatar
haxorico
Super Moderator
Posts: 3197
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND
Been thanked: 1 time

Re: [JASS] JJCP: NewGen

Post by haxorico »

nuzamacuxe wrote:Thanks, haxorico.

Because it's inefficient.

No, using a global group more than once by emptying it everytime will not cause any leaks nor "waste of space". Since I use pure jass to code, it's just better to use a global group and recycle it. GUI is different though.
Not talking about leaks, more about general coding.
For example, if I have a program with many different functions and loops (as many big projects have).
I will not use a single global integer called "i" or "index" that will be set to a starting value (like 0) at the beginning of each loop. As while no loop is using it, it is just some data that is sitting waiting and taking space.

When I need to use some data, I create it and when it is finished, destroy it.

Example for a cheatpack, is aslong as the game is running, even if I am not using the cheat-pack (as I am a user who is unaware), there is data taking space (the group is still being created, an empty group is still taking some space).

Anyway i'm just rambling, just my two cents, need someone like Dekar who will probably have more formal information on the matter (maybe Ken/FatherSpace?).
User avatar
Unryze
Member
Posts: 75
Joined: October 21st, 2013, 4:18 pm

Re: [JASS] JJCP: NewGen

Post by Unryze »

owner123 wrote:Very nice! Looks much cleaner even with just a quick glance over it. No more dynamic triggers and WaitForString calls.
Small efficiency comment: I'd make these commands use elseif rather than "endif/then" like this:

Code: Select all

				if command == "debuff" then
					call UnitRemoveBuffs( jjUnit, true, true )
				endif
				if command == "heal" then
					call UnitRestoreLife( jjUnit, UnitMaxLife( jjUnit ) )
				endif
That way we can save computation on evaluating these ifs
Well, WC3 has a limit of about 50 elseifs or maybe a bit higher, I have actually run into a limit, when I was rewriting VIP system for NRPG, so I would actually suggest avoid using it, instead it's better to add return in the if statement to exit from the thread upon completion, or just leave it as is. Aka in WC3 elseif is still read as a separate if, and the lower you go the more "paths" it generates.
haxorico wrote:Not talking about leaks, more about general coding.
For example, if I have a program with many different functions and loops (as many big projects have).
That is not really correct, every time a CreateGroup or DestroyGroup is called, WC3 is re-allocating memory, aka trying to free whatever was occupied and shifts it, to the changes. That also includes the shifting of arrays and so on, which is not really ideal.
Don't forget JASS only stores pointers, not the "objects" themselves. A Group is simply a dynamic array, that doesn't accept repeating entries, so there is no real point in destroying it, if it is used as a temporary group, which we can see in:

https://www.hiveworkshop.com/threads/ja ... st-2458284

The point is, you don't need to destroy a group that will be used frequently, but you should destroy a group that probably will never be used again, if it is used in something like MUI spells. The same reasoning applies even to C++, you generally want to avoid re-creating variables if they don't really serve any purpose (although C++ has a much better garbage collector than what Warcraft 3 has, but oh well).

And now for the natives, I am using 1.26a offsets, CreateGroup ( GameDll + 0x3D2900 ) and DestroyGroup ( GameDll + 0x3C3FA0 ):
Spoiler for CreateGroup:
CreateGroup.png
Spoiler for DestroyGroup:
DestroyGroup_2.png
DestroyGroup.png
haxorico wrote:I will not use a single global integer called "i" or "index" that will be set to a starting value (like 0) at the beginning of each loop. As while no loop is using it, it is just some data that is sitting waiting and taking space.
When I need to use some data, I create it and when it is finished, destroy it.
You are comparing completely different types of variables, however, yes, with this example it is indeed better to get rid of unused variables, which I have stated above
haxorico wrote:Example for a cheatpack, is aslong as the game is running, even if I am not using the cheat-pack (as I am a user who is unaware), there is data taking space (the group is still being created, an empty group is still taking some space).
Well, same goes for any of the code, right? User will never be aware of what is happening "under the hood" until he takes a peek.
You do not have the required permissions to view the files attached to this post.