Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline fleetatks  
#1 Posted : Wednesday, March 26, 2008 3:42:36 PM(UTC)
fleetatks
Colonel
Joined: 6/2/2006(UTC)
Posts: 961
Location: USA

Was thanked: 3 time(s) in 2 post(s)
[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--- Sec1
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.
Folders
Neutral - 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 lists
Attack 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--- Sec2

Step 1: Make sure that you have Finalbig, you can get it here

Step 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\Maps

Other 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--- Sec3
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
'true'

THEN
(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
'True'

THEN
(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
'True'

THEN
(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
'True'

THEN
(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
'True'

THEN
(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
'True'

THEN
(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--- Sec8

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
"True"

THEN
(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--- Sec9
Here 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--- Sec10
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

Email me if you ever need help (edited signature November 6th, 2014)
Sponsor
Offline Think Twice  
#2 Posted : Thursday, March 4, 2010 11:39:01 PM(UTC)
Think Twice
Private
Joined: 8/21/2009(UTC)
Posts: 17
Location: sleeping

Hey when I transfer a unit to one of the "player1-7" teams it works but comes up with a meassage and coutdown timer in the top right hand corner?
also do these values refer to start point, position on start screen, or team?
No. 7
Offline Drummin  
#3 Posted : Friday, March 5, 2010 5:25:38 AM(UTC)
Drummin
General
C&C Labs Staff: Labs Staff MemberThe Forgotten Staff: The Forgotten StaffMaps Staff: Maps Staff MemberRed Alert Staff: Red Alert Staff Member
Joined: 12/11/2007(UTC)
Posts: 1,622
Location: CA, USA

Was thanked: 16 time(s) in 15 post(s)
*Find the script, "Hide Special Countdown Timer" and add it to your transfer script.
*The names player0 through player7 represent non of those you mentioned. They are the slots in the game room where pick the faction, color, player alliance and position on the map. The host or you if playing skirmish is always player0. The next player listed would be player1 etc.
Offline DaGrooveNL  
#4 Posted : Sunday, May 8, 2011 12:43:08 PM(UTC)
DaGrooveNL
Private
Joined: 5/8/2011(UTC)
Posts: 2

Hello,

I am trying to create a multiplayer compstomp map. The idea is that the 3 human players (or 2 human players) vs 5 comps get a few units extra at some point during the game. Now, I am used to scripting in Zero Hour (so the time stamps n stuff are not the problem), I have made a few maps, but I have never been able to transfer control of a unit to a player. I did exactly as stated below, but somehow I do not get control of the units. I think I am making a mistake with the teams or something (in the script I get the error "player0 does not exist"). When I manually make a player0 in the playerlist, the error goes away, but it still does not work. I have also tried using the transfer to localplayer option, which did not work either.

Quote:
---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
'True'

THEN
(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."



For me it is unclear if there needs to be a skirmish player added player0 (and more) or just a team created player0 (and more) (I tested both, to no succes). Can you maybe help me out? I am willing to send you a copy of the map if needed so you can help me out!

Also, I am not entirely sure about what you mean with
Quote:
use "player#" as the team type in the script

Thanks in advance!

DaGroove

Edited by user Sunday, May 8, 2011 12:52:22 PM(UTC)  | Reason: Not specified

Offline DaGrooveNL  
#5 Posted : Friday, May 13, 2011 3:23:34 AM(UTC)
DaGrooveNL
Private
Joined: 5/8/2011(UTC)
Posts: 2

To solve this problem, you have to make sure that you have the following things correct:

NO player0, player1, player2 etc in the teams list (DO NOT REMOVE SKIRMISH TEAMS, NEUTRAL AND PLYRCIVILIAN!!).
Next to file, click Edit > Edit Teams
NO player0, player1, player2 etc in the player list (DO NOT REMOVE SKIRMISH TEAMS, NEUTRAL AND PLYRCIVILIAN!!).
Next to file, click Edit > Edit Player List

This fixed the problem for me, also make sure that (even though the script will tell you by the use of the ??? next to the script that the player does not exist) you use the player0 format in the script.

For example: Unit "Carrier_01" is transferred to the command of Player "player0"

Above example will give player 1 (the host of the game, or you in skirmish) the control over the unit Carrier_01.


I hope this helps other people who might run into the same problem! ;-)

Greets,

DaGroove

Edited by user Friday, May 13, 2011 3:27:44 AM(UTC)  | Reason: Not specified

Offline Drummin  
#6 Posted : Sunday, July 10, 2011 11:09:59 AM(UTC)
Drummin
General
C&C Labs Staff: Labs Staff MemberThe Forgotten Staff: The Forgotten StaffMaps Staff: Maps Staff MemberRed Alert Staff: Red Alert Staff Member
Joined: 12/11/2007(UTC)
Posts: 1,622
Location: CA, USA

Was thanked: 16 time(s) in 15 post(s)
Please see this thread.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.