Cheating 101 (For noobs)

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Cheating 101 (For noobs)

Post by Aero »

Table of Contents:

Code: Select all

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1.0  | Introduction        |.................Complete
|1.1  | Using the MPQ Tools |.................Complete
|1.2  | Basics of WC3 files |.................Complete
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|2.0  | Editing the .j      |.................Complete
|2.1  | Implementing Cheats |.................Complete
|2.2  | Editing Functions   |
|2.3  | Object Editor       |
|2.4  | Enabling 1-Player   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|3.0  | Protecting a Map    |
|3.1  | Suggested Methods   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|4.0  | Changelog/Other     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1.0 Introduction

This tutorial is meant to teach you (or help you) with the basics of "cheating" a "protected" map. Through "cheating" a map, you can expand and learn how to modify any aspect of a protected map to your liking. Not to mention that you're also bound to pick up a bit of Warcraft 3's language "JASS" and how it works! In this tutorial, I'm going to show you some simple, "noob-proof" techniques to do anything from adding cheats to enabling single player to editing units and abilities! (Unfortunately, it involves reading... -I apologize :wink: ). For those new to the whole "cheating" perspective and even those who are very experienced, I hope you enjoy reading this tutorial and maybe even learn a thing or two! However, before we can cut to the chase, we need a few tools...

1.1 Using the MPQ Tools

Before we start learning about the tools, make sure you have the following:

MPQ Recover
MPQ Master
JassCraft (Strongly Recommended)
WinMPQ (Optional) - For compression purposes only

Note: The downloads WILL require a password and ID which can be obtained in the Members Only Section

Important: ALWAYS...ALWAYS make a copy of the map you wish to edit first (and make all changes to the copy). Once copied...The first step to editing a map is obtaining a listfile. We do this by opening up MPQ Recover. Once open, use the top right file icon to open up your copied map. You can "Add File" to open up a previous listfile you might have which can improve your results.

First begin by clicking "Brute Force" which may or may not return results. Next click "Deep Scan" and hit the Scan button. It will either have a fatal error and crash (Which is because of a form of protection) or it will be fine. If it does crash, repeat the same steps but don't click "Deep Scan".

Finally, once that is complete, hit "Save List" and save the listfile to the folder called "Listfiles" (Which is located in the folder called "MPQ Master" if you didnt extract it already!) -I usually call it by the map name, but you can call it whatever you want!

Note: There's no "X" on MPQ Recover so just hit Esc or Alt-f4 to exit!

Congrats! You are now down with MPQ Recover...Moving on to MPQ Master....

Open up MPQ Master and select File: Open
Now open your copied map and then a popup window containing all the listfiles in the "Listfiles" folder. Check off the listfile you obtained from MPQ Recover plus any other listfiles that are warcraft 3 related.

Once opened, there's a good chance you'll see subfolders, noteably one called "Scripts". Other than those you're going to see something that resembles this:

Code: Select all

war3map.j (Or Scripts\war3map.j)
war3map.doo
war3map.mmp
war3map.shd
war3map.w3a
war3map.w3b
war3map.w3c
war3map.w3e
war3map.w3h
war3map.w3i
war3map.w3q
war3map.w3s
war3map.w3t
war3map.w3u
war3map.wpm
war3map.wtg
war3map.wts
war3mapMap.blp
war3mapMisc.txt
war3mapPreview.tga
Of course, it might not (or shouldnt) look EXACTLY like this but if it does, you're doing something right!

Now you might be saying... ,"Ok...I see the files but what do they mean?..."

1.2 Basics of WC3 Files

Well, each file mentioned above has a specific function!
But we'll only be looking at the major ones!

You can edit the following using JassCraft

war3map.j --> The main script file...when you save a map this is where all your triggers go including unit data and some other goodies!

war3map.wts --> This file contains trigger string data (ex: You have a trigger that says "Hi" to all players..."Hi" will generally be stored in this file. This file also contains map name and other related information AND you can also find custom object tooltips, information and names here)

You can edit the following using WorldEdit.exe (World Editor)

war3map.w3a --> All the custom ability data is stored in this file

war3map.w3t --> All the custom item data is stored in this file

war3map.w3u --> All the custom unit data is stored in this file

Now, using MPQ master, you can extract any of these files to a specific folder by right clicking them and selecting "Extract". So, depending on what you want to edit, you have to extract the right files! For now, let's stick to editing the main body of your map! (The amazing war3map.j file :wink: )

2.0 Editing the .j

Note: Easy part is over! This rest of the tutorial involves some common sense and a general understanding of JASS functions!

Now that you've extracted the war3map.j from your map and have opened it in JassCraft, you'll see at the top "globals". After this you'll see all the global variables (the variables you make in trigger editor) and then "endglobals"
It should look somewhat like this:

Code: Select all

globals
integer (name of variable) = 0
boolean (name of variable) = false
unit array (name of variable)
trigger (trigger name) = null (or = CreateTrigger())
endglobals
There will obviously be varying amounts of variables and triggers based on the size of the map and number of functions!

After the global declarations, you'll see all the functions.
They should look something like this:

Code: Select all

function (name) takes nothing returns nothing
----What the function does goes under it----
endfunction
Note: "takes nothing returns nothing" --> It's NOT always "nothing", you could have "function z takes unit u, player p returns boolean"

Anyhow, after you see all the function and endfunction stuff, near the bottom you'll see "function main" (Or you can just search for it *Cntrl-f*)

Under it is basically the "map setup"
This sets up weather, units and initiates your triggers and other goodies.

The global declarations, the functions and function main are your .j script in a nutshell.

Now moving on...How do I add cheats?

2.1 Implementing Cheats

Adding a cheat requires 3 things:

1. The trigger (which is the cheat) must be declared in globals
2. Your trigger functions must exist and be in the correct spot in the script
3. Your trigger must be initiated


The easiest way to add a cheat into the .j script is this:

Open world editor and make a cheat using Trigger Editor. In the example I used the trigger is called "Cheat" which will end up being called "gg_trg_Cheat" in custom text. So anyways, you make a cheat in Trigger Editor. The following is an example:

Code: Select all

Cheat
    Events
        Player - Player 1 (Red) types a chat message containing -test as An exact match
    Conditions
    Actions
        Player - Set Player 1 (Red) Current gold to 1000000
Next you select your trigger, click Edit and then select "Convert to Custom Text"
A message box will pop up asking you if you really want to convert. Click yes.

Using my example, you now have this:

Code: Select all

function Trig_Cheat_Actions takes nothing returns nothing
    call SetPlayerStateBJ( Player(0), PLAYER_STATE_RESOURCE_GOLD, 1000000 )
endfunction

//===========================================================================
function InitTrig_Cheat takes nothing returns nothing
    set gg_trg_Cheat = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Cheat, Player(0), "-test", true )
    call TriggerAddAction( gg_trg_Cheat, function Trig_Cheat_Actions )
endfunction
The trigger is now in custom text (JASS -- Hurray!)

Now that we have this new trigger ("cheat") we must follow the 3 steps to putting it in the .j script.

1. Declare the trigger in globals.

This is very very easy. All you need to do is go to the very top of the .j script where it says "globals". Then, somewhere under it BUT before "endglobals" type in the following:

Code: Select all

trigger gg_trg_yourtriggername=null

In my example. it would look like this

trigger gg_trg_Cheat=null
2. Putting in the actual trigger into the .j script

This is just as easy. Find your trigger that you made and converted to custom text and copy the whole thing. Next, scroll down to about the middle of the .j script and find an "endfunction". Doesn't matter which endfunction you use AS LONG AS the "endfunction" is BEFORE "function main". Next, paste the entire trigger under the "endfunction".

Example:

Code: Select all

endfunction <-- The endfunction you're pasting under
function Trig_Cheat_Actions takes nothing returns nothing
    call SetPlayerStateBJ( Player(0), PLAYER_STATE_RESOURCE_GOLD, 1000000 )
endfunction

//===========================================================================
function InitTrig_Cheat takes nothing returns nothing
    set gg_trg_Cheat = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Cheat, Player(0), "-test", true )
    call TriggerAddAction( gg_trg_Cheat, function Trig_Cheat_Actions )
endfunction
Tah-Dah! That's it. Onto step 3.

3. Your trigger must be initiated.

This is just as easy as step 1. All you need to do is search for "function main". Once you've found this, chances are you'll see "local variable this" and "local variable that". If this is the case, scroll down to AFTER the locals. If there are NO LOCALS, then scroll right down under "function main". Type in the following code in the correct spot under function main.

Code: Select all

call InitTrig_your_trigger_name_without_the_gg_trg_()

Following my example, you would type in:

Case #1

function main <-- The "function main"
call InitTrig_Cheat()

Case #2

function main <-- The "function main"
local variable this=something
local variable that=something else
call InitTrig_Cheat()
All you have to do now is save the edited .j script and then using MPQ Master, reimport into the map overlapping the old .j script! If there is an "Attributes" file, delete it!

All you have to do now is play your newly cheated map!

Unfortunately, importing files using the .j script makes your map bigger :(. To fix this, open the cheated map with WinMPQ and hit Control-P--selecting Yes. This will conpact your map again.

For cheatpacks that are ready and easy to import try this link:
Cheat Packs

2.2 Editing Functions

To be continued...
Last edited by Aero on May 15th, 2007, 10:03 pm, edited 1 time in total.
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Info

Post by Aero »

I have finally decided to finish my totorial. This tutorial will remain locked until it is complete.

Chances are I made some errors or slipped up somewhere. Since tutorial is locked, send me suggestions with PM.