Jump to content

Request for help. I'm trying to put observers in the mission instead of radars.


Recommended Posts

312_Forrest
Posted

I have a problem and need some advice on whether it even has a solution. We're using PWCG. I wanted to use observers instead of radars in missions. I know how to remove radars from the mission. My idea is to create a program that loads the mission, identifies the front line, and places observers about 10 km behind the front on our side. When entering the observer's area, a message would appear in the title like, "enemy aircraft in grid XX."

I tried Lua, but I don’t know how to write the script that the game would run. There's a mission editor in the game directory, but I can't enable the Toolbar option in the View menu. I even did a clean install.

There has to be a way since there are mods like PWCG and Easy Mission Generator. Is it something simple, or does it require more advanced programming skills? Thanks.

 

 

AEthelraedUnraed
Posted (edited)

First of all, welcome to the forums :)

 

A little bit of semantics. Radars as they're implemented in game are observeres. There's no separate functionality for radars right now.

 

Having a CheckZone MCU in the center of each grid as you suggest should be possible. However, the problem is detecting if it's located in a friendly area. There's no uniform way of defining a front line. The official way is by InfluenceArea MCUs for each of the involved countries (IL2 supports more than 2 belligerent factionss), in combination with a line of connected Icon MCUs to display each front on the in-game map (the InfluenceAreas themselves are invisible in-game). However, many mission creators forgo the former since they're somewhat of a hassle to work with and the only effect they have is that the player can be captured. I don't know if PWCG uses them; it can easily be seen from loading up a PWCG in the mission editor. If the whole map (or at least the area where the mission is taking place) has a blue tint, then it uses them.

 

If it does, then you first need to find which influence area belongs to the player's side. There's one ugly shortcut you can take here: if PWCG uses the exact same conventions as the Mission Editor for the .mission files (which it probably does, but not 100% sure), you don't need to program an actual parser for these files. You can just search for "AILevel = 0;", then the "Country =" before that and take the value between that and the ";" sign after. Next find the "Name = "InfluenceAreas";" whose country code matches that of the player. In this block, you'll find a sub-block "Boundary" which contains the 2D coordinates of the corners of the InfluenceArea polygon (a small aside; for 3D coordinates, IL2 swaps the map axes, i.e. X is the vertical map axis and Z the horizontal. Not sure if it does this in 2D too, but be prepared).

 

From here on it's simple. Now that you have a polygon, all you have to do is shrink this 10km inward (or whatever you decide as the closest range for your observer) and for each candidate check if it falls within the resulting polygon and if so, delete it. These are just geometric algebra problems and I'm sure ready-made solutions exist for whatever language you decide to program in. Then write the leftover candidates to the .mission file, taking care to use the exact same syntax as the .mission system can be finicky at times. Also don't forget to start the CheckZoneMCUs or they won't do anything. Lastly, remember to convert the mission back from .mission  to .msnbin.

 

2 hours ago, 312_Forrest said:

I tried Lua, but I don’t know how to write the script that the game would run.

AFAIK, IL2 doesn't use Lua. I think the name of the LuaScripts directory is just a leftover from a long-forgotten time when either they did, or they were planning to.

Edited by AEthelraedUnraed
312_Forrest
Posted

Thank you for the response. Unfortunately, I couldn't find AILe vel = 0 or InfluenceAreas in the mission.

velky cirkus 1944-09-02.zip

AEthelraedUnraed
Posted
20 minutes ago, 312_Forrest said:

Thank you for the response. Unfortunately, I couldn't find AILe vel = 0 or InfluenceAreas in the mission.

velky cirkus 1944-09-02.zip 230.24 kB · 1 download

Is it a multiplayer mission? Not sure how these work but they might not have AILevel = 0. Anyhow, you can manually specify the correct country code.

 

If there's no InfluenceAreas, it gets hard. You might hard-code it in the templates PWCG uses, but that only works for PWCG missions.

312_Forrest
Posted

Yes, it's a multiplayer mission. Thanks for the help - it seems it's beyond my capabilities. I've been trying to figure this out for a week now.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...