Author Topic: GRAW Map Making for Dummies  (Read 8742 times)

Fishmonger

  • Cantina Regulars
  • Jr. Member
  • *
  • Posts: 83
  • Karma: 2
  • Mapmaker in training
    • View Profile
Re: GRAW Map Making for Dummis
« Reply #15 on: February 12, 2018, 01:34:26 PM »
Of the soldier types on the list, you can see that there are three main categories: guerilla, infantry, and special forces. Their skill level and weapons skills go along with these levels. recon means mp5 or similar weapons, patrol means Scar or similar gun, heavy means light machine guns. The panhard crews are similar - three types for each as well as for their passengers. Use those only for Panhards or other vehicles which we will cover later. Also note that there are some "patrol" groups and panhard crews I marked as "do not use" - they absolutely do not work. Rule of thumb: if there's no number 1/2/3/4 behind it, you probably can't use it. Exception are snipers and RPG soldiers who only come in singles.
 
The naming box called "group ID" is very important, because the script that triggers the spawn of enemy soldiers needs to know which set of enemies to spawn at one time. When not using random spawns, I name each group after the area that triggers them. So for soldiers to trigger at the start of the game, I use "area01" as the group ID. All soldier groups labelled as area01 will be spawned by my script when a ghost walks into the area01 area trigger zone. For random spawn, I use area01easy, area01normal, area01hard and area01difficult, or a subset of those. This helps me sort out which set gets spawned but the name still has the area in it they belong to.
 
Once the ID is set, you can give the AI orders.
 

 
The order pull down is the first step - here I chose "patrol" which popped up the patrol type pulldown as well. For "guard" duty, you don't need to do anything else but pointing the AI in the proper direction, because they will not leave the area. Very good for AI on buildings, because they cannot move up there anyway. Very few buildings can be walked around on (only those you can get on top of as well)
 
Patrol types are important. Some mean they walk in a loop, others mean they run to the final location you direct them to and stay there and yet others mean they go slowly and then return back to origination point. I generally use "pingpong idle" for those guys that come forward from the back at higher speed. For patrols that wait for you in some area, I use the pingpong recon, which has them at a higher alert (guns ready) and they keep moving back and forth on the path you defined for them. Here's a good reference on what the different terms in the list mean:
 
https://www.ghostrecon.net/forums/index.php?showtopic=39722
 
The path is that green stuff to the right of the AI on the top view. How to do it?
 
Hit "Insert key" on the keyboard and start clicking the nodes onto the map. Make sure they can actually go to these places and no obstacles re in their path. To undo, use the right mouse button, to redo left button. when done you must hit "insert" again, because you cannot place another AI while in that mode (right mouse button will actually take away nodes then and not place a new guy on the map_). So if you are clicking the right mouse button and nothing happens, go back to your last guy and check his path - you probably just deleted the last node... Hit the insert key and you're back in business for the next guy.
 
When you place a group ending on e.g. heavy4, you are placing 4 soldiers with the same orders. This save time.
 
Sniper orders: usually you do that order type for a sniper but you can actually tell any soldier to behave like a sniper, even an RPG guy (I've done it...) What you do after orienting the soldier to face in the proper direction (again, red is right shoulder, green is front), is you hit the "INsert" key again, as if you were about to put a track for them on the map, but you have a yellow cone showing for the sniper orders. thiscone has a center dot that you can direct on the map. It tells the sniper where to focus. use the Mouse Wheel button to set that cone center to the direction you want the guy to look. At least that's what I think the key was - already forgot how to do it since I took the below picture:
 

 
 
as you can see all the other AI tracks show in the map all the time. This helps to see where you already placed some troops, but on big maps with multiple random group per area, it gets very dense and the fps in the editor drops massively at the end of the map. I now build the map in sections, cut the code of finished zones out, then build the next and at the very end when everything is tested, I paste all AI back into the very same world.xml to use for final export. For a simple map with just 100 soldiers you should not need to do that
 
Another important footnote to the above - when you give orders by hitting insert and clicking away with left or right mouse button to add or remove waypoints, you have to be extremely careful to NOT hit the right mouse button when there is no waypoint left to remove: it will crash the editor with some sort of cannot create in void error. Example, you place a sniper, don't need to place a waypoint, but you hit insert anyway. You then just aim the sniper cone with the center mouse button and want to move on placing the next enemy with the right mouse button before hitting insert again - kablammo, there goes the editor and all your changes since the last autosave... When in doubt what your insert key toggle is at, always click the LEFT mouse button, as it will add a waypoint when it's toggled on. You can remove that waypoint easily and toggle off, but when you try the right button and it's on, you crash without warning.
Don't eat food off the sidewalk, no matter how good it looks.

Fishmonger

  • Cantina Regulars
  • Jr. Member
  • *
  • Posts: 83
  • Karma: 2
  • Mapmaker in training
    • View Profile
Re: GRAW Map Making for Dummis
« Reply #16 on: February 12, 2018, 01:37:44 PM »
and in case you were wondering why I keep getting shot on maps I made: here's spawn zone area04 in my upcoming map - 4 different AI options on the same zone, and I have no clue what will happen with each spawn scenario it's RANDOM. OK, so after a while you learn all the random spawns, but I can make these maps quite unpredictable with some effort in the randomizer department (more work)
 

 
That is the skinny on placing regular AI soldiers. There's a little more to the MGs and Panhards. The info on that will follow as soon as I work on those in my new map and can take the screenies to show here. It's pretty simple and only needs one or two more things to be observed.
Don't eat food off the sidewalk, no matter how good it looks.

Fishmonger

  • Cantina Regulars
  • Jr. Member
  • *
  • Posts: 83
  • Karma: 2
  • Mapmaker in training
    • View Profile
Re: GRAW Map Making for Dummis
« Reply #17 on: February 12, 2018, 01:40:40 PM »
Let's have us some .50cals on our map!
 
What is different? To get a soldier to spawn with a /50 cal or MK19 launcher, you have to set up a set of area, AI human and gun prop with the same name and spawn this separately from a normal soldier group (easiest solution)
 
so first set up another trigger area, just for the MG coming up ahead. It can overlap with a group area, but can also be different to add some randomness. I sometimes make the zones not inclusive, allowing it to be bypassed by accident.
 
Anyway - for the coming pix, I set up "area_mg4" and then went to props and placed an MG on a building. This may be said easily, but your little green props pointer may refuse to "snap" to the roof of a building or the ground plane where you want to place the prop. That is because for prop placement there are two different modes in the editor. Hit the "N" key on the keyboard and see what it does to the placement tool - one mode automatically snaps to surfaces, while the other is locked at a fixed height. Most of the time you'll want the auto-snap, unless you want to override it and place an object half way below the main level (use the page up and page down keys in that mode to adjust height). Anyway - in this case and most of the time when you are placing props, use the N key to find the mode when the little green ball thingie snaps to the surface you want to snap to. Right click to place the MG, then go and name it "area_mg4" or whatever number MG you are working on.
 
See below what to choose from the props list and what I did to name the prop:
 

 
the legs of this thing are like the humans - use the arrow keys to rotate the legs so it points with the single leg in the direction it is supposed to shoot. The top part will point into all sorts of directions in the editor - ignore that and look at the red line at the base instead. It is the right side facing forward. I named it "area_mg4" to match the trigger zone name.
 
Now the human to operate it:
 

 
I chose a "mex_guerilla_Patrol1" for the job. It has to be a single user, so all the types ending on "1" are ok". Careful - if you use the soldier type ending on no number, your game will crash on load. The only OGR compatible types except for the Rangers all have a number at the end to designate the count. _1 is what you want on a fixed weapon, or you have a crowd of guys hovering over that gun.
 
I also named the soldier's group ID to match my trigger area name and mg name: "area_mg4" - point his face where he's supposed to shoot and leave orders on guard. This is it - as long as you don't mess any of this up, you will trigger one MG with one trigger zone. To do more than one you need to use some "trigger random event" logic in the script, but that will be in the advanced lesson.

 
Don't eat food off the sidewalk, no matter how good it looks.

Fishmonger

  • Cantina Regulars
  • Jr. Member
  • *
  • Posts: 83
  • Karma: 2
  • Mapmaker in training
    • View Profile
Re: GRAW Map Making for Dummis
« Reply #18 on: February 12, 2018, 01:41:36 PM »
Now to the vehicles, and since Panhards are the most common, let's do one of those. The vehicles get spawned by using orders inside the script that are different from the AI and you don't have to use the same group ID with a spawn area. You just name vehicle and crew alike to make sure they spawn together when called by the script.
 
First you need to place the panhard on the map. The vehicle layer is where you find those that can be loaded up with AI crew. The "Dynamic" layer has panhards as well, but those are only good as decoration and can't drive or haul enemy around.
 
So pick it off the list and right click on the map as you hover over where you want to place it. Rotate the thing with the cursor keys, and drop on the map with the left mouse button. Sometimes they bounce and you end up with a wreck - just hit delete and do it again, dropping from lower altitude (use flight keys to get where you need to be). Here is a panhard hovering before being dropped on the bridge:
 

 
 
Remember that vehicles must snap to the vehicle AI graph (N-key on AI Graph layer). When dropping it in the map, make sure the location is near the AI Graph for vehicles, or it won't work. Note the green ring around the AI Graph node here (select it to see the range): your vehicle should be in that range to be able to spawn or move or drive there.
 

 
 
I usually place a second Panhard for each actual vehicle I set up as destination marker. The world.xml file will have the exact coordinates for the destination panhard that I need for the mission script. I just delete those vehicles from the world file when I am making the script work. More on that later.
 
Next we need to fill in a few items in the box on the bottom left. I number my panhards from 0 through whatever (I heard 10 is the most you'd ever want on a map). This is Panhard2 on this map. Make sure it is set for "hostile" and check the "sequence spawn" if you don't want it to be sitting on the map from the start of the game, but be triggered by a spawn area (less AI on the map is always preferred)
 

 
Next we need to go over to the Human layer and set up some AI to operate this thing. The key is to make those soldiers "Group ID" and "Transport ID" match the Vehicle ID" you gave the panhard. Also, if it is the "crew" you must check the crew box. There is a Crew1 and crew2 option: only crew2 will man the machine gun.
 

 
After the crew, you can add passengers to the panhard. They need to be placed close to the vehicle just like the crew. You can put between one and 4 passengers in there, and they come in guerilla, infantry and special forces caliber with appropriate skill levels. Here is how I set up the 4 passengers on this vehicle to match the crew and vehicle IDs:
 

 
I read somewhere that crew and passengers should have "patrol" orders and it should be moveguard recon. Not sure why, but it works and they are nicely active when they unload from the vehicle, so why bother trying the other options?
 
This is all you need to do to get a fully loaded panhard on the map. The scripting for this are two lines of code you can copy paste in your mission script, change panhard ID and coordinates for the destination and you are all set. Rinse and repeat for the next one.
Don't eat food off the sidewalk, no matter how good it looks.

Fishmonger

  • Cantina Regulars
  • Jr. Member
  • *
  • Posts: 83
  • Karma: 2
  • Mapmaker in training
    • View Profile
Re: GRAW Map Making for Dummis
« Reply #19 on: February 12, 2018, 01:44:13 PM »
Time to recap what we have done here so far:
 
We first created a project with the editor by starting it and placing one static object, saving it and exiting.
 
We then grabbed the terrain (world.xml) file from an existing map using the Bundle Reader.
 
This world file then was used to replace the near blank world_1.xml in our editor project by deleting the small file and renaming the one we extracted from the TDM map to world_1.xml and replacing it.
 
Then we opened that world file by simply running the editor again, finding the large world from the TDM map in our editor. It was missing a few things we need for an OGRcoop map, so I went in and added AI graphs for human and vehicle AI. I also set up the "spawn dummies" and Base 1 and Base 2 (spawn and zulu) that are necessary for this type of map.
 
Then areas were created to set trigger zones to have AI groups spawn gradually. We can't have more than 15-20 of these guys walking around at one time without getting serious server lag.
 
Adding the human AI is the biggest job on these maps - you actually need to sit back and think about a) where they need to spawn so they aren't visible to the players, b) what they should do to become a force that you have to face on the map, and c) how strong to make these groups, by picking various caliber troops and weapon loadouts for the AI. That part is all for you to figure out. All I know is that I avoid "guard" orders for the most part, unless I really want these guys to sit on a roof and wait for enemies. On the ground, I have them walk around to become less predictable, even if they are supposed to be in a very small area.
 
Last we looked at setting up MGs and Panhards.
 
What is still missing is how to get this map to actually be playable to go in and test what you have just edited. In just about every case, you will need to make some changes, and in order to save time you'll need to figure out the "bundler" application (command line tool to make bundle files out of those XML files without using the editor). You do have to export the map once from the editor to create a few files that will never change, but you can do this at "draft quality" and with just 2 passes. This still will take about 20 minutes on a normal system. The result is a bundle file in your custom levels folder you could go in and play, except with fuzzy graphics. No worries, we will steal the nice graphics from the GRIN provided bundle file just like we took the world.xml file out of there.
 
The process to get a map exported from the editor is simple - just go to the main menu with ESC key and choose the export. Don't worry about level description and any of that other stuff. Just make sure you make the map an OGRcoop map and give it a name that won't mess up once on a server (avoid spaces!). The export from the editor will generate everything that makes the map playable, including the minimap image file (which can be edited after that export and rebundled as well - that's how I get my info text onto that map image)
 
Once the map is exported and you play it once and it doesn't crash, you're just about done (has any map ever worked for me without crashing? I don't recall...), even if you want to make additional changes, things from here on go very quickly, as most changes are probably to the mission script. If you need to make changes to the AI after testing the map, you should open the map in the editor again, however, don't bother with exporting any longer. Just save and exit - then "unbundle" your original export into a temp dir, replace the world and/or mission files, run the bundler, and 2 seconds later you have a new version of your map.
 
I'll show those things in detail with a few screen shots so you can follow the process. It was the hardest thing to figure out but only because there's no documentation out there that really tells you how to do it. Everything I ever found about this online was full of errors or incomplete, presented by somebody in a "why don't you get it?" manner rather than with explanations a non-insider could follow.
 
Expect the next update in this thread in 2 or 3 days - I want to get a map done right now and I am still 2 days away from getting to that part where I can take screen shots to illustrate the process I just described here. I really need to be doing those things to the new map before I can get you proper samples. I assume that if you are actually trying to make a map, the information provided so far will keep you busy for a few days.
 
Feel free to ask questions - I am sure I forgot to explain some stuff that didn't cause me any trouble understanding. Right now I am going back to the machine gun post to add one thing I forgot about...
Don't eat food off the sidewalk, no matter how good it looks.

Fishmonger

  • Cantina Regulars
  • Jr. Member
  • *
  • Posts: 83
  • Karma: 2
  • Mapmaker in training
    • View Profile
Re: GRAW Map Making for Dummis
« Reply #20 on: February 12, 2018, 01:47:39 PM »
Quote from: Thor3588;180932
Hey, I care too...
 
been waiting paitently for the next class. Still trying to get a handle on this. When I build out a map all the textures are blue and yellow boxes and it is night.
 

This is caused by incorrect texture_scope.xml entries - the editor is too dumb to combine more than one texture set in the game. GRIN limited textures to several subsets to make the game easier on lesser hardware back in 2006. You can override that after your export by going into the bundle file, where you can edit the text file that specifies what textures to load, or, if you have the time, just go into the /work subfolder inside /custom_levels where you can find it as a temp file from where the editor grabs it to make the bundle. Edit it there and make the file read-only so it wont' get blown away by the normal map export process.
 
Now - what do you edit in it? It depends on what you used in your map. If you combine historical, city, industrial and ghetto set items, you need all of them in there. Usually, the less, the better. I used Ghetto and Historical in Retirement_Party (the cemetery and a few walls didn't work with the ghetto texture set and turned blue/yellow)
 
these are the five lines you can put at the top of that texture_scope.xml file - you probably have only the /common and whatever you picked as your primary scope when you started the map:
 
Code: [Select]

<scope>
  <xi:include href="/data/settings/set_texture_scope_editor.xml#xpointer/include/common/*)"/>
  <xi:include href="/data/settings/set_texture_scope_editor.xml#xpointer/include/historical/*)"/>
  <xi:include href="/data/settings/set_texture_scope_editor.xml#xpointer/include/city/*)"/>
  <xi:include href="/data/settings/set_texture_scope_editor.xml#xpointer/include/industrial/*)"/>
  <xi:include href="/data/settings/set_texture_scope_editor.xml#xpointer/include/ghetto/*)"/>

if you can figure out the bundler program, you don't have to export the map again, although a quick test in draft mode with 1 pass will already show you if you picked the right settings. The export rendering does nothing to the texture quality - it only creates those shadow and light areas on the map, so if you have he right textures linked, you'll see that even in draft mode.
Don't eat food off the sidewalk, no matter how good it looks.

Fishmonger

  • Cantina Regulars
  • Jr. Member
  • *
  • Posts: 83
  • Karma: 2
  • Mapmaker in training
    • View Profile
Re: GRAW Map Making for Dummis
« Reply #21 on: February 12, 2018, 01:49:01 PM »
Quote from: sirgimmi;180946
Hallo
 
Nein ich bin neu hier Ihr kennt mich nicht. Leider ist meine Englisch sehr begrenzt deswegen bin ich froh dass jemand Deutsch kann :8-)
 
Fishmonger Dein turtorial ist perfekt, ich habe alles so gemacht wie Du es beschrieben hast aber leider komme ich nicht mehr weiter.
 
Wenn ich die Map exportiere ist die Map voller Farben und nicht so wie sie sein soll. Auch kann ich die Gegner nicht so einstellen so dass die Ghosts &#252;ber die Area01 gehen dann sollen doch die Gegener fortlaufend kommen? Muss ich hier irgendwas beim Scripten tun oder so?
 
Ich bin ein absoluter GRAW Spieler und m&#246;chte unbediengt eine Map erstellen.
 
Um jede Hilfe w&#228;re ich dankbar.
 
Danke SirGimmi

ok - zweisprachiges Tutorial :) Klar - das mission script ist noetig damit die Gegner ueberghaupt auf der Map auftauchen. "Vorlaufend" geht das aber nur mit mehr Areas fuer die anderen Gruppen. Ausnahme ist ein Trigger der sich "OnDeath" nennt - man kann damit ein Event starten sobald eine bestimmte Anzahl der Gegner in einer Gruppe getoetet worden sind. Ich habe das aber noch nie benutzt.
 
Ich habe gerade zwei Maps fertig gemacht die recht komplizert waren und sich nicht fuer das Tutorial geeignet haben. Die Karte die ich hier als Beispiel benutzt habe hatte einige ungewoenliche unsichtbare Waende die meine ganze Map blockiert haben. Das Ding habe ich mehr oder weniger zweimal bauen muessen.
 
In den naechsten Tagen werde ich damit weitermachen wenn ich eine kleine map vom originalen Spiel umbauen werde,.
 
Das beste ist das man das gleiche Script mit wenigen Aenderungen in jeder Map verwenden kann, solange man die gleichen Namen fuer Areas und Gruppen verwendet. Kommt alles in der naechsten Woche (auf English).
Don't eat food off the sidewalk, no matter how good it looks.

Fishmonger

  • Cantina Regulars
  • Jr. Member
  • *
  • Posts: 83
  • Karma: 2
  • Mapmaker in training
    • View Profile
Re: GRAW Map Making for Dummis
« Reply #22 on: February 12, 2018, 01:49:19 PM »
and the translation of the important part for everyone - I'll continue the tutorial with a different base map. The S01 map was a @&*%! to work with due to these invisble walls we got stuck behind the first time around. I'll prep a different map from the list on the first page of the thread to continue and focus on the mission script, rendering, bundling and debugging of the script or map.
Don't eat food off the sidewalk, no matter how good it looks.

Fishmonger

  • Cantina Regulars
  • Jr. Member
  • *
  • Posts: 83
  • Karma: 2
  • Mapmaker in training
    • View Profile
Re: GRAW Map Making for Dummis
« Reply #23 on: February 12, 2018, 01:50:14 PM »
time to continue with this - and with a slightly different approach than what I posted before. I said earlier:
 
Quote from: Fishmonger;180568

What is still missing is how to get this map to actually be playable to go in and test what you have just edited.

Well, based on my experience with the S01 mission map, I think this step has to come much earlier to avoid possible errors that will force you to redo the entire AI and trigger zones. You don't really know what happens on these maps you haven't built yourself until you walk around on them.
 
so instead of doing all the AI and then testing the map, the below step could be inserted at a very early stage - I'd say right at the point when you have your original game map world file entered in your editor, created the zones for spawn and zulu, and placed the spawn bots on the map. That's when you should export the map (just quick and dirty, draft mode or low rez, 1 or two passes, so that the editor creates a usable map you can spawn into and see if you can actually walk from spawn to zulu. On my modified S01 map there were invisble walls (they are still in that zip you can download) and they cannot be removed. They are NOT props you could remove in the xml file by searching for them, but part of the landscape file - at least that's what I think, since I never found them.
 
My first release of Left_Behind had these walls keeping everyone from getting from the spawn to the second trigger area. I should have caught that before spending lots of time on AI and scripts to make the map larger than the area the TDM map used... Lesson learned.
 
In my current map project, I walked every possible route to make sure nothing was blocking my path, and THEN started editing trigger areas and AI.
 
So once you have done the first draft map, just load it in multiplayer, join the server yourself and walk around. It's time well spent. It also is a good thing to do when you're doing something funky with the zulu zone or trigger areas in multi-floor buildings like the parking garage - you want to see for example if your presence on the floor below the trigger area causes a spawn, or ends the game too early.
 
I had one of those issues on Ghost_Behavior, where you are walking under the top floor zulu zone. setting the "Z" coordinate of the zone in the zones.xml to 830 (8.3 meters) made sure nobody ends the map before reaching the final group of bad guys on the top floor. However, the first time I did this it was set too high and never triggered. It still behaves a little strange as it now takes 20-30 seconds to realize that somebody has entered the zone. These are somewhat more advanced issues, but if you plan on doing things with buildings like the embassy or parking ramp, you should test this stuff before you fill the map up with bad guys and force yourself to shoot 100 guys to even get to the area that has to be tested.
Don't eat food off the sidewalk, no matter how good it looks.

Fishmonger

  • Cantina Regulars
  • Jr. Member
  • *
  • Posts: 83
  • Karma: 2
  • Mapmaker in training
    • View Profile
Re: GRAW Map Making for Dummis
« Reply #24 on: February 12, 2018, 01:50:58 PM »
Let's assume your map has no invisible walls and you have put all sorts of bad guys on the map, you've named them properly by area (e.g. group_id="area01" for the first spawn group), you need to create  mission script that actually uses your trigger areas to spawn these bad boys... 
 
The map editor in GRAW does not do any of this work for you. You have to do this in a text editor. The good news - unless you get fancy in your maps, the code for spawning enemy groups by area triggers is virtually identical for each map and can be reused as long as you name your areas and groups the same way it has been done in the mission script.
 
So to save you time and to allow you to use most of a basic mission script I'll provide here, here are the naming conventions I usually adhere to:
 
Areas:
 
I name the trigger zones for regular foot soldier enemy groups as follows
 
area01
area02
area03
...
area11
area12 etc
 
(reason - it sorts better in the map editor than the suggested area1, area2 etc - once you exceed 9 zones, which you will on most maps.
 
I name dedicated zones to trigger an MG or MK19 launcher
 
area_mg1
area_mg2
area_mg3  etc
 
 
since I never really have more than 5 or 6 of these on a map. If you go back in this thread, you will see that I use the same names for enemy group IDs and Machine gun IDs, so they do spawn together and I am able to spot what belongs to what on the map easier.
 
 
I name AI enemy groups
 
area01
area02
area03
 
 
for single spawns where there are no optional groups availble to random spawn and select from. when I have more than one version for a trigger, I use
 
area01easy
area01hard
area02easy
area02hard
area03easy
area03hard
etc.
 
On some maps I have 4 versions for each enemy area with the first part of the name to match the trigger zone, so things still are easily spotted on the map editor. You don't what an area03 guy to spawn in area04, as that may just drop some AI right in the face of a ghost.
 
I name all my panhards and panhard crews in group_id and vehicle_id fields as follows
 
panhard0
panhard1
panhard2
 
etc.
 
things like tanks, helis and c4 triggers are a different thing and rare enough to carry custom names. There really won't be any copy/pasting necessary on those rare items. The mission script pretty much deals with area triggers and AI groups and vehicle spawns.
 
Now, the first time you see one of those scripts you're gonna go "whoah - wtf?" since the format is XML and it's rather verbose for what really is a very limited amount of content. It also is an unforgiving format - one typo and the map will crash on load...
 
Next post will take a look at one of those scripts to show you why we are naming things the way I just explained.
Don't eat food off the sidewalk, no matter how good it looks.

Fishmonger

  • Cantina Regulars
  • Jr. Member
  • *
  • Posts: 83
  • Karma: 2
  • Mapmaker in training
    • View Profile
Re: GRAW Map Making for Dummis
« Reply #25 on: February 12, 2018, 01:53:56 PM »
so here it is - a mission script for a basic map. I'll post the whole thing first, then analyze what it does and what you may have to change to make it work for your map.
 
The file usually sits in the edit environment in the /work/yourmapname/script/  folder and is called mission.xml. However, when exported, the file structure in the bundle is changed and the file is renamed to yourmapname.xml and moves to the data/levels/custom_levels/yourmapname/ folder
 
Here's the script for my small sawmill map - it has two MGs and 10 trigger areas, so it should work for any small to medium map as a basis. I'll also color code the different sections of the code to be able to better explain what these things mean
 
 

<?xml version="1.0" encoding="ISO-8859-1"?>
<World>
 <!-- World -->
 <load_scene file="/data/levels/custom_levels/sawmill/sawmill.diesel" use_lightset="true" materials="/data/levels/custom_levels/sawmill/materials.xml">
 
  <object name="world_bb" hidden="true"/>
 
  <object name="room01" hidden="true"/>
  <object name="Plane01" hidden="true"/>
 
  <global_ambient color="60 60 40"/>
 
 </load_scene>

<load_scene file="/data/objects/lens/normal_lens.diesel">
  <object name="normal_lens" hidden="true"/>
 </load_scene>
 <load_scene file="/data/objects/lens/zoom_lens.diesel">
  <object name="zoom_lens" hidden="true"/>
 </load_scene>
 

 <script_data>
 
  <xi:include href="/data/levels/common/common.xml#xpointer(/common/*)"/>
 
  <area_group name="area01" area_name="area01" group="mp_players" interval="0.3" condition="1"/>
  <area_group name="area02" area_name="area02" group="mp_players" interval="0.3" condition="1"/>
  <area_group name="area03" area_name="area03" group="mp_players" interval="0.3" condition="1"/>
  <area_group name="area04" area_name="area04" group="mp_players" interval="0.3" condition="1"/> 
  <area_group name="area05" area_name="area05" group="mp_players" interval="0.3" condition="1"/>
  <area_group name="area06" area_name="area06" group="mp_players" interval="0.3" condition="1"/>
  <area_group name="area07" area_name="area07" group="mp_players" interval="0.3" condition="1"/>
  <area_group name="area08" area_name="area08" group="mp_players" interval="0.3" condition="1"/>
  <area_group name="area09" area_name="area09" group="mp_players" interval="0.3" condition="1"/>
  <area_group name="area10" area_name="area10" group="mp_players" interval="0.3" condition="1"/>
  <area_group name="area_mg1" area_name="area_mg1" group="mp_players" interval="0.3" condition="1"/>
  <area_group name="area_mg2" area_name="area_mg2" group="mp_players" interval="0.3" condition="1"/>

 
  <user name="wave01" type="once">
   <trigger type="UnitInArea" area="area01"/>
  <event name="activate_wave01"/>
  </user>
 
  <user name="wave02" type="once">
   <trigger type="UnitInArea" area="area02"/>
  <event name="activate_wave02"/>
  </user>
 
  <user name="wave03" type="once">
   <trigger type="UnitInArea" area="area03"/>
  <event name="activate_wave03"/>
  </user>
   
  <user name="wave04" type="once">
   <trigger type="UnitInArea" area="area04"/>
  <event name="activate_wave04"/>
  </user>
 
  <user name="wave05" type="once">
   <trigger type="UnitInArea" area="area05"/>
  <event name="activate_wave05"/>
  </user>     
 
  <user name="wave06" type="once">
   <trigger type="UnitInArea" area="area06"/>
  <event name="activate_wave06"/>
  </user>     
 
  <user name="wave07" type="once">
   <trigger type="UnitInArea" area="area07"/>
  <event name="activate_wave07"/>
  </user>     
 
  <user name="wave08" type="once">
   <trigger type="UnitInArea" area="area08"/>
  <event name="activate_wave08"/>
  </user>     
 
  <user name="wave09" type="once">
   <trigger type="UnitInArea" area="area09"/>
  <event name="activate_wave09"/>
  </user>     
 
  <user name="wave10" type="once">
   <trigger type="UnitInArea" area="area10"/>
  <event name="activate_wave10"/>
  </user>
     
  <user name="mg1" type="once">
   <trigger type="UnitInArea" area="area_mg1"/>
  <event name="activate_mg1"/>
  </user>     
 
  <user name="mg2" type="once">
   <trigger type="UnitInArea" area="area_mg2"/>
  <event name="activate_mg12"/>
  </user>     
 


  <event name="start_game">
   <element type="UnitInArea" area="area01" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area02" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area03" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area04" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area05" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area06" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area07" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area08" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area09" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area10" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area_mg1" state="activate" start_time="0.2"/>
   <element type="UnitInArea" area="area_mg2" state="activate" start_time="0.2"/>

  </event>

  <event name="activate_wave01">
   <element type="ActivateGroup" group_id="area01" start_time="1.0"/>
   <element type="UnitInArea" area="area01" state="deactivate" start_time="1"/>
  </event>


   <event name="activate_wave02">
   <element type="ActivateGroup" group_id="area02" start_time="3.0"/>
   <element type="UnitInArea" area="area02" state="deactivate" start_time="3"/>
  </event>
 
  <event name="activate_wave03">
   <element type="ActivateVehicle" vehicle_id="panhard1" start_time="1"/>
   <element type="ActivateGroup" group_id="area03" start_time="5.0"/>
   <element type="UnitInArea" area="area03" state="deactivate" start_time="3"/>
  </event>


  <event name="activate_wave04">
   <element type="ActivateGroup" group_id="area04" start_time="2.0"/>
   <element type="UnitInArea" area="area04" state="deactivate" start_time="1"/>
  </event>

   <event name="activate_wave05">
   <element type="ActivateGroup" group_id="area05" start_time="2.0"/>
   <element type="UnitInArea" area="area05" state="deactivate" start_time="1"/>
  </event>
 
  <event name="activate_wave06">
   <element type="ActivateGroup" group_id="area06" start_time="1.0"/>
   <element type="UnitInArea" area="area06" state="deactivate" start_time="1"/>
  </event>
 
   <event name="activate_wave07">
   <element type="ActivateGroup" group_id="area07" start_time="1.0"/>
   <element type="UnitInArea" area="area07" state="deactivate" start_time="1"/>
  </event>
   
  <event name="activate_wave08">
   <element type="ActivateGroup" group_id="area08" start_time="2.0"/>
   <element type="UnitInArea" area="area08" state="deactivate" start_time="3"/>
  </event>
 
  <event name="activate_wave09">
   <element type="ActivateGroup" group_id="area09" start_time="2.0"/>
   <element type="UnitInArea" area="area09" state="deactivate" start_time="3"/>
  </event>

    <event name="activate_wave10">
   <element type="ActivateGroup" group_id="area10" start_time="2.0"/>
   <element type="ActivateVehicle" vehicle_id="panhard0" start_time="1"/>
   <element type="OrderCar" vehicle_id="panhard0" order="move" position="-1337 -1138 1095" start_time="3"/>
   <element type="UnitInArea" area="area10" state="deactivate" start_time="3"/>
  </event>


    <event name="activate_mg1">
   <element type="ActivateGroup" group_id="area_mg1" start_time="4.0"/>
   <element type="UnitInArea" area="area_mg1" state="deactivate" start_time="6"/>
  </event>

 
  <event name="activate_mg2">
   <element type="ActivateGroup" group_id="area_mg2" start_time="3.0"/>
   <element type="UnitInArea" area="area_mg2" state="deactivate" start_time="1"/>
  </event>

  <player name="player1" mod_name="OnFoot">
   <spawn unit_name="ghost_player" object="spawn_player1"/>
  </player>
  <player name="player2" mod_name="OnFoot">
   <spawn unit_name="ghost_player" object="spawn_player2"/>
  </player>
  <player name="player3" mod_name="OnFoot">
   <spawn unit_name="ghost_player" object="spawn_player3"/>
  </player>
  <player name="player4" mod_name="OnFoot">
   <spawn unit_name="ghost_player" object="spawn_player4"/>
  </player>
 
 
  <gametype_info name="enemies_to_kill" value="50"/>
 
  <spawn_manager>
   <!--<xi:include href="/data/levels/merge_xml/common_spawn.xml#xpointer(/to_include/spawn/*)"/> -->
  </spawn_manager>
 
 </script_data>
</World>

 


Even thought his is a lot of stuff at one glance, you're probably able to spot some repetition here.
 
 
Text in this color is code that always remains the same.
 
It's just fluff that we don't really need to care about except for the words in red text -that is where the file has to have the name of your map in it. If you copy paste these scripts from one map to another, this is an area you must modify to match your map. 
 
If you were to write the above all from scratch into the blank placeholder mission.xml the editor creates for you, these words are usually "my_map" or your map's name. In any case, double check there to make sure it matches the map name. Also - always name maps and folders the same, never use spaces, etc - it'll save you and server administrators headaches later on.
 
The code in green is where the mission script tells the game engine that you want to use the listed areas as triggers. If you don't set them up like this, the game won't care to use them and nothing will ever trigger.   Again, note my naming convention.
 
And since computers are stupid or programmers want flexibility, you also have to use another batch of code marked in orange to tell the server what to do with the above areas - in this case and so far in all maps I have made the code is to tell the server that we are about to use the areas as triggers based on "UnitInArea" - i.e. if anyone of us should walk into it, go do something. One can also use "VehicleInArea" to trigger things, or, which I am working on in my next map, create a trigger based on the condition of an enemy unit (number of casualties equals a certain number, spawn something else, etc).  For now, stick to the code shown here, as it will serve you well in just about any map you'll make. These triggers also tell the server what "events" to run when they do get triggered. I named mine based on the area number e.g. "activate_wave01"
 
Pink text is where the first event of the script is defined. "Start_Game" is an event that happens on every map and in most maps it is used to activate the trigger zones. Yeah, we have defined them and we have told the server what to do when they get walked into, but hey, we did not tell the server to actually listen to anyone walking into those. Why is this necessary? Well, on really large maps and with slow computers, you don't want the server to be checking all these trigger areas for units walking into them. To cut down the load, you can activate the zones gradually, as folks wander across a map. However, I have never noticed any performance issues on servers by activating them all at once. The only maps that do it gradually are the single player missions by GRIN.
 
Green Text is the first real trigger event - this is where stuff is happening. The following area02 trigger event is more or less identical, and so are most of those following, except for area03 and area10, which both spawn a panhard.
 
The "activate_wave03" event launches a few AI soldiers like the two events above it, but it also spawns an stationary panhard (the one in the tunnel on that map) The code for that spawn is a single line  and if you named the crew and the vehicle as outlined earlier, they all should spawn together.
 
To make a Panhard actually go somewhere, we need another line of code in the event. The wave10 event in bright yellow is such an event. Note the coordinates in the line that gives the panhard a "move" order. That value comes from the world.xml file. As pointed out earlier, I simply place an extra panhard on my maps when editing them to create an object that has the exact coordinates I can use in the mission script. When I edit the script, this is where I use the coordinates.
 
The activation event for one of the MGs can be seen in blue - it is virtually identical to the regular AI group spawn events such as wave01, except the group name is different and matches exclusively the prop name of the MG and the group name you gave that single soldier to man the gun.
 
And there is one more line that needs to be edited: The number of enemies that can be killed on this map is shown in purlpe. This value works best for maps without random spawns. Otherwise, you just have to enter the highest value that can possibly be killed. If you leave the number too low, you will get things like 50 of 50 kills even if you shoot 124 enemies.
 
So much for the overview. Next some detail on each section.

Don't eat food off the sidewalk, no matter how good it looks.

Fishmonger

  • Cantina Regulars
  • Jr. Member
  • *
  • Posts: 83
  • Karma: 2
  • Mapmaker in training
    • View Profile
Re: GRAW Map Making for Dummis
« Reply #26 on: February 12, 2018, 01:54:38 PM »
Let's take a closer look at some of these sections that may need manual editing
 
This code
 
<area_group name="area01" area_name="area01" group="mp_players" interval="0.3" condition="1"/>
 
at the beginning sets up a trigger area. What this tells the server in detail is the name of the area, in this case our "area01" which has to match those boxes you set up in your map. If you have a typo in here, the map will crash when you load it.
 
The "group=mp_players" pretty much stays the same at all times for our OGR maps. I think it means that it has to look for the ghosts to walk in there, and not AI. Interval is a value I have changed at times to make a trigger less likely to cause a spawn - it's a timer that looks for the length of the area penetration. If set to a higher value such as 10 seconds, a ghost has to actually be in the area for 10 seconds for the event to fire.
 
If the area is small and not necessarily on your route where all ghosts will walk, you can use it to randomize things such as a small sniper group or additional surprise ground troops. Leaving it at 0.3 seconds pretty much guarantees the event to fire immediately.
 
Condition? I think that's the number of ghosts that have to be in the area for this to fire. I've never used that to alter the effect, but it may be a nice touch for the end of a long map when you can adjust the level of opposition based on that counter, e.g. only trigger the dozen special forces if 4 ghosts walk into the zone.
Don't eat food off the sidewalk, no matter how good it looks.

Fishmonger

  • Cantina Regulars
  • Jr. Member
  • *
  • Posts: 83
  • Karma: 2
  • Mapmaker in training
    • View Profile
Re: GRAW Map Making for Dummis
« Reply #27 on: February 12, 2018, 01:55:24 PM »
Setting up a trigger:
 
  <user name="wave01" type="once">
   <trigger type="UnitInArea" area="area01"/>
  <event name="activate_wave01"/>
  </user>


Here you have not much to do - the "user name=" thing is just for you - name it what you want, as it is not used anywhere else. I think it makes sense to keep things numbered so you know what is what matching our areas.
 
The trigger line is where you tell the thing what to do - "UnitInArea" tells it to look for somebody walking it. Key value to enter correctly is "area01" for your "area01" in the map.
 
Event name is what is supposed to happen when a trigger condition happens. Again, you can pick whatever you want to call these events. I just used "activate_wave01" for this area, as it pretty much tells me what it's doing. Wave01 goes with area01, wave02 with area02, etc. You can call the event "idwic01" or whatever else fancies your mind, but you have to remember to use that exact term later in the script to identify the event.
Don't eat food off the sidewalk, no matter how good it looks.

Fishmonger

  • Cantina Regulars
  • Jr. Member
  • *
  • Posts: 83
  • Karma: 2
  • Mapmaker in training
    • View Profile
Re: GRAW Map Making for Dummis
« Reply #28 on: February 12, 2018, 01:55:51 PM »
The "start_game" event
 
 
  <event name="start_game">
   <element type="UnitInArea" area="area01" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area02" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area03" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area04" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area05" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area06" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area07" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area08" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area09" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area10" state="activate" start_time="0.1"/>
   <element type="UnitInArea" area="area_mg1" state="activate" start_time="0.2"/>
   <element type="UnitInArea" area="area_mg2" state="activate" start_time="0.2"/>

  </event>

 
Nothing much to edit here on a normal map. All I am doing is "turning on" the areas as triggers, and I do it within 0.1 or 0.2 seconds of the map start. You could again get fancy here and change the area01 trigger activation time to something much higher. Combined with a small trigger zone that may surround the ghosts at spawn, this may mean if they leave quickly, they never get a chance to trigger that area as it won't listen for anyone being in there until your start_time counter runs down.
 
The only other code I have ever put into the start_game event is the stuff you need to do to prepare items to be blown up by C4 - that's for the advanced class, though.
Don't eat food off the sidewalk, no matter how good it looks.

Fishmonger

  • Cantina Regulars
  • Jr. Member
  • *
  • Posts: 83
  • Karma: 2
  • Mapmaker in training
    • View Profile
Re: GRAW Map Making for Dummis
« Reply #29 on: February 12, 2018, 01:56:27 PM »
Launching the first batch of enemy AI
 
  <event name="activate_wave01">
   <element type="ActivateGroup" group_id="area01" start_time="1.0"/>
   <element type="UnitInArea" area="area01" state="deactivate" start_time="1"/>
  </event>



This event follows the "start_game" event and it is what our area01 trigger activates once a ghost is found for more than 0.3 seconds within the boundaries of the area01 box(es) you put on your map in the editor.
 
The event_name line has to match the trigger setup from above in the script.
 
The elements listed here are first the one that makes the bad guys spawn. "ActivateGroup" is the type that looks in your world.xml files for all AI soldiers that were labelled with the group_id "area01" - if you have a typo in their group id, they simply won't spawn, but no harm done.  Start_time is the time between ghost walking into the trigger area and the server taking action to spawn the enemy AI. In some cases you may want to delay that time - really depends on the map and where your zone is and where the AI spawns.
 
The second element listed here,  <element type="UnitInArea" area="area01" state="deactivate" start_time="1"/>, was quite confusing to me at first. Turns out, all this line of code does is turn off the trigger. This saves some cpu on the server as the mission progresses. It also eliminates the chance for this area to trigger again, although I think that by default they only trigger once. I usually set the deactivate time to come after the last element has started, but I think it doesn't really matter.
 
Also, note the syntax of many of these entries: The event tag on the first line has no "/" before the end tag, but it has a matching full </event> tag at the bottom of the segment that allows it to bracket the stuff happening in between. The element tags on the other hand both end on a "/>" and thus don't need a </element> to follow them. Saves space, but it has caused some crashes on a recent map I made when I hand-typed the tags and didn't get that stuff right... the error was something about "expected element" or something else that didn't really tell me what was wrong.
Don't eat food off the sidewalk, no matter how good it looks.