[Reposted from before]
This is a Frequently Asked Questions table for those of you seeking knowledge of accomplishing things using scripts in zero hour maps. I have updated this from before, and will continue to add to it. If you have suggestions for how-tos or comments, feel free to post and ask.
FAQ's Table of contents. (use ctrl+F with the code to the right to skip to it)
1.Finding what you need in scripts--------------------- Sec1
2.Openning & editting official maps--------------------- Sec2
3.Making unit(s) unmanned---------------------------- Sec3
4.Making unit(s) spawn later in the game--------------- Sec4
5.Making unit(s) move to a location-------------------- Sec5
6.Making unit(s) follow a waypoint path---------------- Sec6
7.Transfering unit(s) to a Player----------------------- Sec7
8.Removing Units/Buildings----------------------------- Sec8
9.Displaying Messages in Map-------------------------- Sec9
10.Map.ini Files for more changes---------------------- Sec10---1. Finding what you need in scripts---
The first step is to ask yourself is, what do you want to be done? Do you want the computer to do something? Do you want something to blow up? Do you want to do something after a period of time, or after something has happenned?
After you know what you want, put it in the "IF/THEN/ELSE format." 'IF' is the factor that determains if and when the script is activated. 'THEN' Is the action that takes place when the 'IF' statement is met. 'ELSE' is the action that takes place if the action is wrong (careful how you use ELSE, for example a simple script with "IF Timer expires ELSE do this" will automatically use the ELSE action at the start of the game since the timer hasn't expired yet).
The Next step is to find where the action/condition you're looking for is located. Generally the Folder a script is in can mean nothing, or everything.FoldersNeutral -
anything to do with neutral units, like a tree or weather.Plyrcivilian -
Anything to do with the Player(s) in game that are not controlled by skirmish players. This includes camera movements for the player(s) and special effects.TeamSkirmish_____ -
anything to do with that particular Skirmish player. Note: scripts only work in that particular folder if that AI player is present (AOD maps use the "IF True, THEN players lose" generic script inside skirmish players that they don't want to be on the map).Others (Created teams)
- Use what seems fits best.
Anything that seems not to fall into these categorys should either be in Neutral, Plyrcivilian, or a created team's folder. Now onto the actual script...Scripts listsAttack Priority set -
Tells the Skirmish players (or the chosen enemy for single player maps) what they should attack first.Camera -
Mostly used in intro movies and cut scenes, tells the camera were to go.Camera_ -
Usually unused settings for camera.DEBUG -
Fix the game and prevent problems with map.Map -
Things that have to do with the map Ex: water, border, tech level.Multimedia -
Play songs or movies (go to unused... full screen or radar) or taunts/speech files.Multiplayer -
Announce defeat, victory, or local defeat. (good for single player maps)Player -
Things that have to do with the players that arent neutral.Radar -
Things to do with radar, ex: force radar to be enabled.Scripting -
Things that don't belong in any other script list.Skirmish -
Things to do with skirmish players&their abilities.Skirmish Only -
Tell the skirmish player weather or not he can build, or were he should move to.Team -
Things to do with teams of units/building on the map.Unit -
tell a named unit to do something, or do something with specific units.Unused -
Things that are uncommonly used, but are still able to do things that are important.User -
Flash: Used in single player missions to give hints. Input: make him able/unable to do anything. String: I have never tested this, but might have something to do with the beginning/ending of generals' challenges were it tells you "you have won/been defeated" along with a picture.
If you can't seem to find what you need you can try openning another map and see how they did it. See The Table of Contents or scroll down to find out how to open official maps, because they are very good references.---2. Openning and Editting Official Maps---
Make sure that you have Finalbig, you can get it hereStep 3:
Open the file "MapsZH.Big" (located at C:\Program Files\EA Games\Command & Conquer Generals Zero Hour)Step 5:
Click the MapName.Map that you wish to edit (Can preview map from TGA).Step 6:
Go to Edit->Extract and extract it to your desktop as a .map file.Step 7:
Create a new folder on your desktop and name it the same as the MapName.map file.Step 8:
Place the MapName.map inside the folder (TGA and other files related to it optional to put in) and move the folder to the location My Documents\Command and Conquer Generals Zero Hour Data\MapsOther steps:
You can now edit the map in worldbuilder and add things such as player spots and more units. You can also delete things that have to do witht he mission if you want the map purely for the terrain. Note that it is impossible as of yet to play a multiplayer mission map exept for scripted defense (AOD; Art of Defense) type maps.---3.Making Unit(s) Unmanned---
An "unmanned" object in Generals/Zero Hour means that an object has no driver or "Man" inside and so any infantry unit can enter inside and the player will gain control of it. You can apply this to object types listed as Building or Unit/Vehicle/Tank/(Aircraft?).
Click on each unit or building you wish to make unmanned and give it a name inside the object property box (Example: unit001)
Then go to Edit->Scripts and make a new script inside the folder plyrcivilian or neutral with these settings:IF
(Make a new action and go to Unit->Status->Make unmanned)
"Make unit 'unit???' unmanned"
Click on 'unit???' and change it to the name of the unit, it should be in the list.
Copy the new actions and click Edit on the copyed action, and change the name of the unit. Repeat this until all the units have been made unmanned in the script.
(the reason you copy and edit it, is because it's faster then going to "new" each time.)---4. Making a Unit Spawn Later in the Game---
Sec4*Requires you to go to Edit->Players->Add skirmish players.
"Spawning" a unit refers to making a person/unit/building appear on the map at a location marked with a waypoint, or a location with specific X,Y,Z coordinates. To Start, place a waypoint on the map were you want your unit(s) to spawn later in the game (place about 1 waypoint per 5 units so they don't get stuck) and then you can do this in one of two ways.The first method is:
Go into scripts and create a new script with these settings:IF
(Go to Scripts->Timer->Set timer to expire)
"Set timer 'Timer01' to expire in '##' seconds."
Then create another script (not action) with these settings:IF
'Timer01 has expired'THEN
(Go to unit->Spawn->(Select the one that best suites you.) (Team= Will spawn on a team, <thisplayer'senemy> is you, and for the computer pick one like 'SkirmishAmerica' and it will spawn for the computer that is USA.) (Named= Create a named object, like if you had placed it in worldbuilder and givin it a name, so you could do soemthing to it in scripts.)
(orientation= What angle it's facing)
And pick the unit by clicking "unit/object of type '???'"The second method is:
Go to teams, click the faction that you want to give the unit(s) to (example: SkirmishAmaerica) and create a new team. Then choose the unit(s) you want and the number of them you want to apear each time you tell them to in scripts.
Then go to scripts and create a new script with these settings:IF
(Go to scripts->Timer->Set timer to expire)
"Set timer 'Timer01' to expire in '##' seconds."
Then create another script (not action) with these settings:IF
"Timer01 has expired"THEN
(Team->Spawn->Spawn an instance of team??? at a waypoint)
"Spawn an instance of team 'Your team name' at waypoint 'Waypoint you placed'"---5. Making Unit(s) Move to a Location---
Sec5*Requires you to go to Edit->Players->Add skirmish players.
Place your units on the map and give them each a unique name. Place a waypoint to were you want them to move, and give it a name.
Then go into scripts and make a new script in plyrcivilian with these settings:IF
(Go to Unit->Move->Move a specific unit to a location)
'Move unit <Pick unit's name> to <Pick waypoint>'---6. Make Unit(s) Follow/Patrol a Waypoint Path---
Sec6*Requires you to go to Edit->Players->Add skirmish players.
A "waypoint path" refers to the arrows that connect each waypoint to eachother. They show units how to move from place to place using waypoints as the places to move to and the arrow as the order and direction in which to move. Waypoint paths can be used instead of "move to location" for a more in-control path. Units only follow these waypoints when told to in scripts.
Place your unit(s) were you want them to move to/patrol (perferable close together, or on the same path it leads on)
Then Place a Waypoint Path (place a waypoint then click and drag from that waypoint to new one) Note: If you want them to patrol an area forever (or until told to stop) Make the last waypoint connect to the first (or if you want them to move to an area then patrol that one put it so its connected to the waypoint you want)
Then click on one of your waypoints and in the object property box, you should see "Waypoint Labels" and 4 spaces under it. Click in the first input area and type in something (example: Patrol).
Then click your unit(s) and give them each a unique name.
Then in scripts create a new script in plyrcivilian with these settings:IF
(Go to Unit->Move->Set a specific unit to EXACTLY Follow a Waypoint path.)
"Unit <pick unit's name> exactly follow waypoint path <Pick the path name>"
Then repeat until all the units have been set to patrol/follow path.
Extra: If you want a unit to move to a waypoint and then patrol a path; Place an area around the waypoint and give it a name, then do the same scripts for Sec5, but change the scripts in Sec6 from 'true' to (Unit->Area->Unit enters an area)"'Unit' enters 'area.'"---7. Transfering Unit(s) to a Player---
Sec7*Requires you to go to Edit->Players->Add skirmish players.
To make A unit be Transfered to a player in the begginning of the game, (or for a different reason ex: enter area, time expired...) first start by placing the units/buildings you want on the map and give them a name (ex: Unit001.) Give each of the units/building their own unique name and then go into scripts.
For the condition you can do what you want, but for this I'll make it as if you wanted it at the begginning of the game.IF
(Player->Transfer->Transfer Unit to player) 'Unit "Unit001" is transfered to the control of player "(LocalPlayer or ThisPlayer'sEnemy for Player1/host, Teamplayerskirmish____ for that specific AI, player0 to player7 for players 1-8.)"'
To give units/buildings to players in the form of player1, player2, ect.. use "player#" as the team type in the script, where "player0" is player 1, and "player7" is player 8, and ect.
Note that having 2 or more of the same skirmish player will result in a crash when using teamplayerskirmish___.
Another way of doing this is in the form of if you wanted to make a single player mission. Click the Build list tool and inside the Build list tool options Select which building you want to create for the player. After that Select the Player you wish to give the buildings to. Place the building and then you can select it from the object property box to change its options.
You can choose weather or not the AI will rebuild it and weather or not it starts built (ex: if you don't want a superweapon to just start on the map, but then later you want the AI to create it.)
If when you exit out of the build list tool you don't see your building, it's because you didn't select "Structure starts built."---8. Removing Units/Buildings as Buildable from Map---
To Remove Superweapons (Or any unit or building) from the map load your map and open scripts. In the PlyrCivilian or neutral folder, make a new script and have these settings:IF
(Map->Modify->Adjust the tech tree for a specific object type)
Then Pick the name of the first unit/building and set the availability to "Buildable(No)"
Do this for each object for each general. To do it faster press copy and then hit edit on the copied action.
If you are making an infantry only map, you may want to download This
file and save some time. Inside is full instructions. It also contains scripts to remove superweapons and some other various things.---9. Displaying Messages in Your Map---
is a link to my tutorial which gives the basic grap of displaying messages in your map. However, using this method makes the message appear as "Missing: " in-game. To fix this you can use a Map.str (string) file and your messages will be displayed normally without the "Missing" message appearing before it.
You can also take this a step further by having your text "scroll" in-game. This allows you to have more text on screen at once, and prevent text from being cut out or overlapped. Here
is a link to download a map.str file with full instructions on how to accomplish the "Scroll-Effect."---10. Use Map.INI's for More Map Modding---
A Map.ini file is placed inside the map folder along with the .map and the .tga. It can be used to edit certain settings that are impossible or take too long to do with scripts in worldbuilder. To make your own map.ini file, all you need is a .Big extracting program (such as FinalBig
), knowledge, and a text edtting program (such as notepad or wordpad). The basics of making a map.ini are: Acquire lines of code from the game's directory (files: INI.big or INIZH.big) and changing certain areas in the code. Map.ini's don't require all of the code, only the parts you are changing. Some examples are below.
It is possible to remove the superweapons as buildable, but then China is at an upgrade-building disadvantadge. To fix this, you can use a Map.ini to make the Upgrade buttons inside of the Propaganda center (Or airfield for Nuke Gen's Nuclear Migs upgrade). I have already created such a Map.ini
file, which you may use for yourself.
Using a Map.ini you can also change the timing and cash amount that oil derricks give. You can have them give small amounts quickly, or large amounts slowly, or anywhere inbetween. I have a Map.ini
that will let you easily change the values. It should be self explanitory in what you need to change, also note the timing is in miliseconds (1000ms=1second).
[Edits thus far: 7]
Edited by moderator Saturday, April 23, 2011 7:45:43 PM(UTC)
| Reason: Not specified