PDA

View Full Version : Moving frontline and capturing airfields script sample


Ataros
06-02-2011, 12:55 PM
Here is a sample script from a member of the dev team.

Script does the following:
- reads frontline markers from the main mission file
- creates spawns at each airfield of the map depending on side
- creates 2 triggers at each frontline marker for ground group passthrough (for both sides)
- checks if enemy ground group gets to the trigger and
then based on trigger:
- changes marker side and as a result moving frontline
- destroys remaining enemy units near marker to prevent immediate recapture (not working sometimes)
- changes airfields side and planeset if they are left behind frontline
- changes score
- loads defending and attacking submissions.

To understand the principals of naming submissions please study this mission carefully: http://forum.1cpublishing.eu/showpost.php?p=285348&postcount=133
It uses an earlier version of this script.

Now everything a mission maker has to do is select several frontmarkers and create submissions spawning ground groups attacking these markers. The rest is done automatically.
To find out the number of a marker I plan to attack I place a camera unit on top of the frontline marker, save and then open the mission file in notepad to compare camera coordinates with markers coordinates. Devs mentioned that marker numbers will be shown in FMB in the future.

There is a known bug that prevents players to spawn at captured airfields. Devs will try to fix it by next patch so get your missions ready )

The script is attached as a .txt file.

FG28_Kodiak
06-02-2011, 01:01 PM
Thanks!

May be it's possible for you to ask the dev about Addin development for CoD? A Piece of Sample Code would be very helpfull ;)

Ataros
06-02-2011, 01:07 PM
Some guys at sukhoi.ru came to conclusion that there is a chance that interfaces for addins are not finished yet. The good news is that they found many of them )

If you can explain in detail for what to ask in particular I may try to ask. However I have no idea of what piece of code can be helpful. Thus you have to explain it to me first or I can mess up the translation ))

FG28_Kodiak
06-02-2011, 01:24 PM
Can you please ask him, if it's possible to modify the Multiplayer Plane Selection Menu.

So its possible to select a Airfield on the left side and then show a list of the available Planes (park spawn and idle) on the right, where a Player can choose one.
At the moment it's only possible if you scroll in and select the plane icon (if in Game Icons are on).

Ataros
06-02-2011, 02:06 PM
I am sure it is possible.

Do you mean you are prepared and ready to write this interface mod/Addin if he explains how to switch it on and connect it to the game?

FG28_Kodiak
06-02-2011, 02:25 PM
I think so ;)

Ataros
06-03-2011, 06:51 PM
I think so ;)

OK, we have an answer from MuxaHuk, who is a mod of this very forum section btw and speaks English. I think if you start a new thread named Questions to MuxaHuk he might give some answers if and when he has time.

Интерфейс компилится в dll, которая передаётся с сервера на клиент. Пока не могу предоставить примеров, но это обычный интерфейс на WPF.


Translation:
Interface should be compiled into a dll which is downloaded from server to a client. I can not provide any examples at the moment but this is an ordinary WPF interface.

Small_Bee from sukhoi has some success getting into game interfaces. E.g.
http://www.sukhoi.ru/forum/attachment.php?attachmentid=135354&d=1307046290
http://www.sukhoi.ru/forum/attachment.php?attachmentid=135355&d=1307049528
And his advice is: study how offline campaigns are connected to the game engine. In fact a campaign is an example of game add-in.

I guess you can also use keygetis mod and extract tool to see how the game looks from the inside.

All info comes from here. Feel free to register and participate or PM Small_Bee for details. http://translate.google.com/translate?hl=en&sl=ru&tl=en&u=http%3A%2F%2Fwww.sukhoi.ru%2Fforum%2Fforumdispla y.php%3Ff%3D234
naryv at that forums is also one of the devs

Ataros
06-06-2011, 07:28 AM
Can anyone advise the best way to calculate game score for sides for the script in the 1st post?

I have 2 sides fighting for 4 frontMarkers atm. Start with 2 markers per side.
I want the score counter increase score say every minute for each marker owned by side.
When marker changes from blue to red (there are triggers for this) we have to stop blue counter and start red counter for it, etc, etc.
Then total score per side is calculated as a sum of score at each marker / 10.

I know more or less how to do this via including this counter into onTickgame method but I would like to have it as a separate method (or class?) that can be called from onTrigger method for instance with stopScoreCounter(marker, army) and startScoreCounter(marker, army) or something like that. Unless it would be much more complicated than using inTickgame method.

I want to have more readable code than if it is split into existing methods (ontickgame, ontrigger, etc.)

Ataros
07-11-2011, 07:05 AM
Another brilliant piece of code by naryv. If you like ground attack missions you will have a lot of fun with it. It is ready to use.

How to play an attached sample mission.
Put both files from the attached archive to Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight
You can start the mission from Multiplayer >> Server section and play alone or with friends. Set password protected server if you do not want others to join it. Select side and airfield and create aircraft to play.

How to create your own mission with this script.
Open FMB and place objects called Frontline Markers for both red and blue side as you like. The markers create a frontline. This is all editing that is required. The rest is done automatically by the script. Name your mission file MF_any2.mis and save it to the following directory:
Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight
(If you want to save your mission with a different name in the future and/or change the path you can edit the following line in the script file: ISectionFile missFile = GamePlay.gpLoadSectionFile("missions\\Multi\\Dogfight\\MF_any2.mis"); . Do not forget to rename the .cs file to exactly match the name or your mission file but with .cs extension in this case. )
Put the .cs file from the attached archive to the same directory. That's all. You can start your mission from Multiplayer >> Server section and play alone or with friends. Set password protected server if you do not want others to join it. Select side and airfield and create aircraft to play.

Alternatively you can just open the attached sample file in FMB and move available Frontline Markers according to your preference.

How the script works.
- reads FrontlineMarkers positions from your mission file
- creates triggers at each marker position to change marker side/colour based on which ground units captured the marker
- creates AT and AAA arty at each marker after capture
- creates tank groups at each marker
- tank groups attack enemy markers or enemy tank groups whichever is more close
- when tanks capture enemy marker it changes its colour and becomes a friendly marker and the frontline moves.
- all enemy airfields and spawnpoints that turned out to be on a friendly territory after the frontline moved become friendly, available planeset changes.
- when a friendly group of tanks is killed a new group of tanks is spawned at the most close friendly marker.

Please give you comments and report bugs in this thread: http://www.sukhoi.ru/forum/showthread.php?t=68629&p=1647624&viewfull=1#post1647624
As you can see the author answers in English there.

If you are thinking of writing a small online war like ADW it is a great code to manage ground attacks in your war. BTW dynamic air attacks generation can be found in that mission http://forum.1cpublishing.eu/showpost.php?p=285348&postcount=133 If you can combine both in one script the war code can be considered almost ready :)

upd. The mission is being tested on Repka #2 server ATM please give it a try and report bugs.

hc_wolf
07-12-2011, 03:05 AM
LEGEND! I was waiting for this.

I have combined my moving front-line script with this Ground troop script and an auto generation Plane seek and hunt script (fighters CAP, Bombers Bomb, Stukas dive bomb). I saw the script in action on my server last night with the Stuka taking off and attacking a marker behind enemy lines, bombing ground troops and then it stuck around and hunted for air targets and dived on a human and then an AI bomber trying to land.

Now I have random columns of Vehicles (tanks, support groups etc) generating from taken over air bases with missions to seek and destroy nearest enemy markers and take over air bases. On take over of an airbase then there are random set of AA spawned also for defence.

All kills add to red or blue side points, take over of bases also get points

Combining all 3 scripts + some preloaded missions also, I now have a full Falcon4 type dynamic campaign. I also have checks to ensure the units are kept to controlled levels on each side to stop the server having a heart attack.

Online game play was smooth and even ran from my PC as Host server also.

THANKS GUYS!!!

Ataros
07-12-2011, 06:19 AM
Combining all 3 scripts + some preloaded missions also, I now have a full Falcon4 type dynamic campaign.



Congratulations and thanks a lot for feedback. What is the name of the server you are running? Is it up fulltime?

At Repka servers we are interested in a more or less professional programmer to combine various sample scripts kindly provided by developers into an Online War project which will be slowly but constantly improved. We have great communication channel with the devs at sukhoi.ru and they provide excellent sample scripts but naturally they do not have time to combine and finetune all the scripts to Repka server needs. If you are interested in joining our team you are very welcome.

Could you share your mission with us? I would talk to BigRepa about testing it on Repka #2 server. Current version running there lacks bombers activity.

slm
07-16-2011, 11:59 AM
Just a comment about "how to calculate the score" question in 6.6. post.
Maybe you were really asking how to do the technical part of calculation - no comment on that - but I think the calculation could be more complex:

you could add some points for owning a marker during the battle BUT
also more points for owning them in the end. I assume the mission has some fixed playing time.