Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   FMB, Mission & Campaign builder Discussions (http://forum.fulqrumpublishing.com/forumdisplay.php?f=203)
-   -   Online War - FMB scripting (http://forum.fulqrumpublishing.com/showthread.php?t=21518)

TheEnlightenedFlorist 05-18-2011 11:35 PM

Quote:

Originally Posted by Ataros (Post 284761)
Attached is original mission. It is supposed to do as follows: on a flyby above an airfield a new enemy aircraft is spawn there and the af changes color to friendly.
Actions are listed in the mission file not the script. A surprise of the month for me! lol

Just tried this mission. It exhibits the same behavior as mine. :(

Edit:

This code will loop through all BirthPlaces and print a message to the screen if a BirthPlace is on the opposite side of the front line.

Code:

foreach (AiBirthPlace bp in GamePlay.gpBirthPlaces())
        {
            if (GamePlay.gpFrontArmy(bp.Pos().x, bp.Pos().y) != bp.Army())
                GamePlay.gpHUDLogCenter("Front and BirthPlace do not match!");
        }

I'm having fun. :)

Ataros 05-19-2011 07:13 AM

Quote:

Originally Posted by TheEnlightenedFlorist (Post 285129)
Salt Lake City, Utah, USA. Opposite side of the planet. :grin:

The planet becomes smaller and smaller )
Moscow, Russia here.

Quote:

Originally Posted by TheEnlightenedFlorist (Post 285151)
This code will loop through all BirthPlaces and print a message to the screen if a BirthPlace is on the opposite side of the front line.

So we can change bp army if we find such a contradiction. Just great!


Another idea I have:

If we can track a ground group position we can simplify ground mission creation to the following:

- submission loads group of tanks with waypoints
- script reads current frontmarker positions from the mission
- every minute the game tracks tanks position and moves a frontmarker to this pos with say 3 minutes delay. if all tanks are killed within this 3 minutes the marker is not moved.
- thus several groups of tanks will move the frontline in real time
- enemy tanks will do the same pushing it backward
- if tanks are dead a new group is spawn on trigger in some distance behind frontlines
- tank battle will go on forever if players do not kill tanks themselves
- after a frontline moves further than an enemy airfield the airfield turns to friendly in say 10 minutes (to allow recapture within this period) and then AAA and new tanks spawn near it to patrol it killing enemy players if spawned there (new submission loaded)


If the above is possible a mission maker would have to manually create say only 10-20 tank spawning missions to have a huge battle for 10-20 cities/airfields.

I think we have to place tanks waypoints manually at this point because there are no bridges at some rivers and tanks may get stuck in some villages/cities making it impossible for tanks to get from one waypoint to another if the waypoints are generated 100% automatically. But I am sure a solution to this problem can be found in the future.

Have you heard of mission generator for original IL-2 by Starshoy? It automatically created online missions for IL-2 and was used in the majority of online war projects. I do not know if it is possible to convert it to C# to be used with CloD. At least some ideas can be borrowed for now I think.

And another one for offline I think http://www.lowengrin.com/news.php?90

Ataros 05-19-2011 09:06 AM

Some help from the devs.

File here http://www.sukhoi.ru/forum/attachmen...2&d=1305794840

Link http://www.sukhoi.ru/forum/showthrea...=1#post1622955
Quote:

Try, if you want to mission with the movement of the front line and the seizure of airfields:
CTF_cross_roundel.rar

There are four airfields on the map. They are your primary capture locations.
An aircraft is considered captured once the opposing sides armor enters its perimeter. The airfield perimeter is defended with artillery and flak. Once attacking armor is destroyed, a new group of armor will be spawned to continue the assault. Destroyed artillery and flak are not restored.
Once an airfield is captured, the front line will move and the airfield will change sides allowing the new owner to spawn there. Defending artillery will also spawn for the new owner, while the old owner will spawn an attacking armor group. Finally, capturing an airfield will spawn an AI-controlled aircraft group for the enemy, attacking both air and ground targets.
Capturing the most airfields is the overall objective for this mode.
The score system is simple. Capturing an airfield awards 10 points to the victorious side. Defending an airfield, that is, destroying an enemy armor group, awards 1 point.

To work correctly, the archive should be unpacked in the folder \ missions \ Multi \ Dogfight, whose mission should be run - \ missions \ Multi \ Dogfight \ CTF_cross_roundel.mis.
Podmissii are located in CTF_submissions.

MadTommy 05-19-2011 09:30 AM

Great thread.. very helpful. Personally not really interested in any capture the flag kind of gameplay, just not my thing, but i am playing with the random mission selection.

To this i have a question.

How do i alter ths code to add a case? I could guesses and i'm sure i would get there through trial & error, but i'm sure someone here can show me ;)

Can someone add a case to the below script so i can see how it is done? Thanks!

Code:

// randomly selects 1 of several submissions excluding the recent one

            Random RandomIncident = new Random();
            int CurrentMissionSelected;

            do
                {
                CurrentMissionSelected = RandomIncident.Next(1, 4);
                }
            while (LastMissionLoaded == CurrentMissionSelected);

            LastMissionLoaded = CurrentMissionSelected;

            switch (CurrentMissionSelected)

            {
            case 1:
                GamePlay.gpPostMissionLoad("missions/Multi/15Sept1940/15Sept1940_R1.mis");
                /*
                GamePlay.gpHUDLogCenter("mission objectives updated.");
                    //600
                initTime = 0.0;
                Timeout(initTime += 600, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! Enemy activity is expected at E3!");
                });
                Timeout(initTime += 600, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! Help is needed at E3/D4!");
                })*/
                ;
               
                break;
            case 2:
                GamePlay.gpPostMissionLoad("missions/Multi/15Sept1940/15Sept1940_R2.mis");
                /*
                GamePlay.gpHUDLogCenter("mission objectives updated..");
                    //500
                initTime = 0.0;
                Timeout(initTime += 500, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! Cover your shipping at C4!");
                });

                Timeout(initTime += 300, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! Ships are under attack at C4!");
                })*/
                ;
               
                break;
            case 3:
                GamePlay.gpPostMissionLoad("missions/Multi/15Sept1940/15Sept1940_R3.mis");
                /*
                GamePlay.gpHUDLogCenter("mission objectives updated...");
                    //600
                initTime = 0.0;
                Timeout(initTime += 600, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! Enemy activity is expected at E2!");
                });
                Timeout(initTime += 300, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! All airgroups please proceed to E2/D3!");
                })*/
                ;
               
                break;
        }

(i'm not using the message system presently)

FG28_Kodiak 05-19-2011 10:22 AM

it is easy

Code:


          switch (CurrentMissionSelected)

            {
            case 1:
                GamePlay.gpPostMissionLoad("missions/Multi/15Sept1940/15Sept1940_R1.mis");
                /*
                GamePlay.gpHUDLogCenter("mission objectives updated.");
                    //600
                initTime = 0.0;
                Timeout(initTime += 600, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! Enemy activity is expected at E3!");
                });
                Timeout(initTime += 600, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! Help is needed at E3/D4!");
                })*/
                ;
               
                break;
            case 2:
                GamePlay.gpPostMissionLoad("missions/Multi/15Sept1940/15Sept1940_R2.mis");
                /*
                GamePlay.gpHUDLogCenter("mission objectives updated..");
                    //500
                initTime = 0.0;
                Timeout(initTime += 500, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! Cover your shipping at C4!");
                });

                Timeout(initTime += 300, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! Ships are under attack at C4!");
                })*/
                ;
               
                break;
            case 3:
                GamePlay.gpPostMissionLoad("missions/Multi/15Sept1940/15Sept1940_R3.mis");
                /*
                GamePlay.gpHUDLogCenter("mission objectives updated...");
                    //600
                initTime = 0.0;
                Timeout(initTime += 600, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! Enemy activity is expected at E2!");
                });
                Timeout(initTime += 300, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! All airgroups please proceed to E2/D3!");
                })*/
                ;
               
                break;
     
  case 4:
            //your code
  break;

  case 5:
            //your code
  break;

   
}


Ataros 05-19-2011 10:54 AM

And in this line you put number of your cases+1

Code:

            do
                {
                CurrentMissionSelected = RandomIncident.Next(1, 4);
                }

4 for 3 cases
5 for 4 cases
etc

Ataros 05-19-2011 10:55 AM

Quote:

Originally Posted by Ataros (Post 285348)
Some help from the devs. Sorry no time to translate now.

File here http://www.sukhoi.ru/forum/attachmen...2&d=1305794840

Text googletranslated.
Link http://www.sukhoi.ru/forum/showthrea...=1#post1622955

Runs on Repka #3 now. just have a look ))

Flashman 05-20-2011 07:36 AM

Im having a bit of trouble with the command to load a new submission, and for it to load repeatedly. Here is the particular bit of script (pinched from an earlier Ataros script):

PHP Code:

    public override void OnTickGame()
    {

            if (
Time.tickCounter() % 216000 == 27000
            {
                
                
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/RaBv7/bomberred1_0.mis");
                
GamePlay.gpHUDLogCenter("Intel: British Bomber Formation, E13 at 4000 metres heading SE"); 
            } 


its this part that doesn't seem to work:
if (Time.tickCounter() % 216000 == 27000)

As i understand it this means that every 216000 tick (120 mins) the action should happen (spawns bombers and shows a message), but it is postponed for 27000 ticks (15 mins).

However when I run the mission what happens is after 15 minutes the bombers spawn and the message shows, but it never happens again. I have checked through the logs of various runs of this mission and it is always the same, it only runs once.

Am i doing something wrong, or am I mistunderstanding the settings? What I want to happen is this:

Server starts>at 15 mins-mission and message loads>2hrs after first mission loads (i.e. 2-15 server time)-mission reloads>2 hours later mission loads again... and so on as long as the main mission runs.

ANy help appreciated!

klem 05-20-2011 07:44 AM

Quote:

Originally Posted by TheEnlightenedFlorist (Post 284685)
Well, I've been messing around with changing spawn points for a while ..........

Hi TheEnlightenedFlorist

I'm pretty new to this but I see in your code you are playing with Spawn points. I see you creating new Mission markers (front line markers) but only destroying BirthPlaces, not creating them. I want to create a new BirthPlace, a Stuka Unit and waypoints including a shipping attack to an existing mission.

All this stems from the fact that I can't seem to set a delayed start time for a second sortie in FMB, I can't even see a start time for it in the .mis file, just the overall mission start time.

Ataros has suggested loading a second FMB mission at the appropriate time but I don't see how I can tie that to an existing mission i.e. an existing Convoy route that receives a second attack later on. It seems I would have to show the convoy route in the new mission to include the Attack and that would duplicate the one in the first misson.

Do you know the code for creating a new BirthpPlace and a Sortie in an existing mission?

Thanks

TheEnlightenedFlorist 05-20-2011 08:12 AM

Quote:

Originally Posted by klem (Post 285981)
Ataros has suggested loading a second FMB mission at the appropriate time but I don't see how I can tie that to an existing mission i.e. an existing Convoy route that receives a second attack later on. It seems I would have to show the convoy route in the new mission to include the Attack and that would duplicate the one in the first misson.

Hi klem, I think the best way to accomplish that would be to use a trigger, action, and a script. You would set a trigger to fire off after how ever many seconds you want, then create an airgroup to attack the convoy. In the airgroup's properties I believe you have to click a check box that says something like "script spawn only".

After that, create an action that will spawn the airgroup you just created. You could even make the action spawn the original airgroup if you want the second attack force to be exactly the same as the first. Just remember to uncheck "script spawn only" so that the airgroup spawns at the start of the mission like normal.

The script will look like this:

Code:

using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;

public class Mission : AMission
{
public override void OnTrigger(int missionNumber, string shortName, bool active)
    {
        //call base classes OnTrigger method.
        base.OnTrigger(missionNumber, shortName, active);

        //if the trigger that was called is the trigger that we're looking for
        if (shortName.Equals("attackConvoyDelay") && active)
        {
            AiAction action = GamePlay.gpGetAction("attackConvoy"));
            if (action != null)
                action.Do();

        }
}

So if you put this code into the mission's script file, it will trigger your action whenever your trigger... triggers.

Note that I've named the trigger "attackConvoyDelay" and the action "attackConvoy". You can change them to whatever you want, just make sure they are the same in both the mission and the script.

I hope this helps. :grin:


All times are GMT. The time now is 02:03 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.