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)

mcler002 04-28-2011 05:31 PM

I was just looking at the .mis files in notepad...


Example
Code:

[PARTS]
  core.100
  bob.100
[MAIN]
  MAP Land$English_Channel_1940
  BattleArea 200000 160000 120000 100000 9000
  TIME 5
  WeatherIndex 0
  CloudsHeight 1000
  BreezeActivity 1
  ThermalActivity 1
[GlobalWind_0]
  Power 3.000 0.000 0.000
  BottomBound 0.00
  TopBound 1500.00
  GustPower 5
  GustAngle 45
[splines]
[AirGroups]
  gb02.0F
[gb02.0F]
  Flight0  1 2 3
  Flight1  11 12 13
  Flight2  21 22 23
  Flight3  31 32 33
  Class Aircraft.BlenheimMkIV
  Formation VIC
  CallSign 31
  Fuel 86
  Weapons 1 1 2 1 1
  Detonator Bomb.Bomb_GP_250lb_MkIV 2 130 11
  Skill 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
[gb02.0F_Way]
  NORMFLY 224480.60 255230.91 500.00 230.00
  NORMFLY 254029.14 255139.99 1000.00 230.00
  NORMFLY 274678.41 250003.49 1500.00 230.00
  NORMFLY 290803.61 240345.28 1500.00 230.00
  GATTACK_POINT 290788.83 215917.45 1500.00 230.00
  NORMFLY 290883.76 208132.47 1500.00 230.00
  NORMFLY 265387.72 208373.88 1500.00 230.00
  NORMFLY 246038.12 228039.38 1500.00 230.00
  NORMFLY 224003.28 252601.51 1500.00 230.00
[CustomChiefs]
[Stationary]
[Buildings]
[BuildingsLinks]
[Trigger]
  trigger TTime 1200

Is there any way of adding a line to prompt "end mission" at time #### ???

Also looks like we can edit aircraft here much "easier"... if you know what your doing! :D

NOTE - not at home to test it myself lol

Ross

Flashman 04-28-2011 05:31 PM

Quote:

Originally Posted by Ataros (Post 275269)
New bits of code from devs.

Shows mission objectives to players depending on side and aircraft type (fighter/bomber).

"hitler caput" lol

Code:

public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceEnter(player, actor, placeIndex);
        AiAircraft aircraft = actor as AiAircraft;
       
        if (aircraft != null)
        switch (aircraft.Army())
        {               
            case 1:
                if (aircraft.Type() == AircraftType.Bomber)
                { GamePlay.gpHUDLogCenter(new Player[] {player},"Red Bomber, Bomb it all, hitler caput"); }
                else { GamePlay.gpHUDLogCenter(new Player[] { player }, "Red Fighter, fight them all"); }
                break;
            case 2:
                if (aircraft.Type() == AircraftType.Bomber)
                { GamePlay.gpHUDLogCenter(new Player[] { player }, "Das bomber!"); }
                else { GamePlay.gpHUDLogCenter(new Player[] { player }, "Das jager!"); }
                break;

        }
    }

    public override void OnAircraftTookOff(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftTookOff(missionNumber, shortName, aircraft);

        if (GamePlay.gpPlayer().Place() != aircraft)
            return;
       
        switch (aircraft.Army())
        {
            case 1:
                if (aircraft.Type() == AircraftType.Bomber)
                { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Red Bomber, Bomb it all, hitler caput"); }
                else { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Red Fighter, fight them all"); }
              break;
            case 2:
                if (aircraft.Type() == AircraftType.Bomber)
                { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Das bomber!"); }
                else { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Das jager!"); }
              break;

        }
    }


THis is an interesting one, just tried it! The only thing is that for me the german one says 'Das jager' even when I am in a bomber such as the Ju87 or Ju88. Is there any setting I need to apply?

FG28_Kodiak 04-28-2011 06:28 PM

Argh german language:

Das bomber! -> (singular) Der Bomber! (plural) Die Bomber!
Das jager! -> (singular) Der Jäger! (plural) Die Jäger!

Next time i fly a bombing raid over the translator. :grin:

AircraftType could be:
AmphibiousPlane
BNZFighter
Bomber
DiveBomber
Fighter
Glider
HeavyFighter
JaBo
SailPlane
Scout
Sturmovik
TNBFighter
TorpedoBomber
Transport
UNKNOWN

So if you are in a Ju87 or Ju88 there should be Bomber or DiveBomber to Show that you are in a Bomber
Code:

      if ((aircraft.Type() == AircraftType.Bomber) || (aircraft.Type() == AircraftType.DiveBomber))  // if Bomber or Divebomber
              { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Der Bomber!"); } // show Der Bomber!
                else { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Der Jäger!"); } //in all other cases show Der Jäger!


Ataros 04-28-2011 08:08 PM

Quote:

Originally Posted by Flashman (Post 275280)
Any ideas what i am doing wrong?

I did not learn how to use triggers yet but if you paste here a complete script I am sure someone would help.

Ataros 04-28-2011 08:13 PM

Quote:

Originally Posted by mcler002 (Post 275287)

Is there any way of adding a line to prompt "end mission" at time #### ???

Depends on what you mean by end mission. It is like in real life when one mission is over you have another one if you are alive or if you have none you have a vacation.

I think you can shut server down with .cmd file.

mcler002 04-28-2011 08:47 PM

Start mission... plays... End mission... Start mission again... etc etc
 
Well as you know we both start a mission through the script, but i want to know if we can stop it... as we had already discused :S

But as we dont know how to do this via scipt, i was woundering is we could do it through the .mis file...

ATAG_Bliss 04-28-2011 09:12 PM

Yeah, I would like to know this as well. The way the MP missions are designed are amazing (with missions able to be loaded into missions etc.) but, for instance, lets say you want an ongoing war, how are you going to stop it from going into the night?

Or could you just load a mission and make the sun appear again out of nowhere, without missing a beat, while others are playing at the same time?

More testing I guess :)

Ataros 04-28-2011 09:25 PM

I wish I were a part of the dev team and know all the answers :grin:

Meanwhile another script destroying abandoned planes from ru forums. Tell me what you think of it.

Code:

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

public class Mission : AMission
{
        private bool isAiControlledPlane (AiAircraft aircraft)
        {
                if (aircraft == null)
            {
                        return false;
                    }

                Player [] players = GamePlay.gpRemotePlayers ();
                foreach (Player p in players)
        {
        if (p != null && (p.Place() is AiAircraft) && (p.Place() as AiAircraft) == aircraft)
            {
            return false;
            }
            }
                   
                return true;
            }

        private void destroyPlane (AiAircraft aircraft)
    {
                if (aircraft != null) {
                        aircraft.Destroy ();
                }
        }

        private void explodeFuelTank (AiAircraft aircraft)
    {
                if (aircraft != null)
        {
                        aircraft.hitNamed (part.NamedDamageTypes.FuelTank0Exploded);
                        /***
                        aircraft.hitNamed (part.NamedDamageTypes.FuelTank1Exploded);
                        aircraft.hitNamed (part.NamedDamageTypes.FuelTank2Exploded);
                        aircraft.hitNamed (part.NamedDamageTypes.FuelTank3Exploded);
                        aircraft.hitNamed (part.NamedDamageTypes.FuelTank4Exploded);
                        aircraft.hitNamed (part.NamedDamageTypes.FuelTank5Exploded);
                        aircraft.hitNamed (part.NamedDamageTypes.FuelTank6Exploded);
                        aircraft.hitNamed (part.NamedDamageTypes.FuelTank7Exploded);
                        ***/
                }
        }

        private void fuelTankFire (AiAircraft aircraft)
    {
                if (aircraft != null)
        {
                        aircraft.hitNamed (part.NamedDamageTypes.FuelTank0Fire);
                        /***
                        aircraft.hitNamed (part.NamedDamageTypes.FuelTank1Fire);
                        aircraft.hitNamed (part.NamedDamageTypes.FuelTank2Fire);
                        aircraft.hitNamed (part.NamedDamageTypes.FuelTank3Fire);
                        aircraft.hitNamed (part.NamedDamageTypes.FuelTank4Fire);
                        aircraft.hitNamed (part.NamedDamageTypes.FuelTank5Fire);
                        aircraft.hitNamed (part.NamedDamageTypes.FuelTank6Fire);
                        aircraft.hitNamed (part.NamedDamageTypes.FuelTank7Fire);
                        ***/
                }
        }

        private void destroyAiControlledPlane (AiAircraft aircraft)
    {
                if (isAiControlledPlane (aircraft))
        {
                        destroyPlane (aircraft);
                }
        }

        private void damageAiControlledPlane (AiActor actor)
    {
                if (actor == null || !(actor is AiAircraft))
        {
                        return;
                }

                AiAircraft aircraft = (actor as AiAircraft);

                if (!isAiControlledPlane (aircraft))
        {
                        return;
                }

                if (aircraft == null)
        {
                        return;
                }

                aircraft.hitNamed (part.NamedDamageTypes.ControlsElevatorDisabled);
                aircraft.hitNamed (part.NamedDamageTypes.ControlsAileronsDisabled);
                aircraft.hitNamed (part.NamedDamageTypes.ControlsRudderDisabled);

                aircraft.hitNamed (part.NamedDamageTypes.FuelPumpFailure);
                // aircraft.hitNamed (part.NamedDamageTypes.Eng0TotalFailure);
                // aircraft.hitNamed (part.NamedDamageTypes.Eng1TotalFailure);

                /*** Tank fire doesn't work after engine total failure - ???
                Timeout (15, () =>
                                {fuelTankFire (aircraft);}
                        );
                ***/

                /*** Cool, but kills fps
                Timeout (25, () =>
                                {explodeFuelTank (aircraft);}
                        );
                ***/

                Timeout (90, () =>
                                {destroyPlane (aircraft);}
                        );
        }

//////////////////////////////////////////////////////////////////////////////////////////////////

        public override void OnPlaceLeave (Player player, AiActor actor, int placeIndex) {
                base.OnPlaceLeave (player, actor, placeIndex);
                Timeout (1, () =>
                                {damageAiControlledPlane (actor);}
                        );
        }

        public override void OnAircraftCrashLanded (int missionNumber, string shortName, AiAircraft aircraft) {
                base.OnAircraftCrashLanded (missionNumber, shortName, aircraft);
                Timeout (30, () =>
                                {destroyAiControlledPlane (aircraft);}
                        );
        }
       
        /**
        public override void OnAircraftTookOff (int missionNumber, string shortName, AiAircraft aircraft) {
            base.OnAircraftTookOff (missionNumber, shortName, aircraft);
            ...
        }
        **/       
}

Quote:

Originally Posted by SYN_Bliss (Post 275443)
for instance, lets say you want an ongoing war, how are you going to stop it from going into the night?

I think just like in real life you order (with a script) your units to rtb when it is getting dark. Then they have a rest till early morning.

Quote:

Originally Posted by mcler002 (Post 275427)
But as we dont know how to do this via scipt, i was woundering is we could do it through the .mis file...

I think you can stop mission with a script like you can stop real life: kill all units, stop time and that's it.

Quote a Dev:
Quote:

Выгрузить - это сложно, миссия же может по скрипту кого-то нарожать, что-то в себя подгрузить и т.д
"To unload (a mission) - it is difficult, because a mission can give birth to something using scripts, upload smth into itself, etc."

My guess is you can switch server off, but you can not unload a mission as you can not unload life as it gives birth to smth :grin: This is not a game this is real life simulator.

FG28_Kodiak 04-28-2011 09:35 PM

Problem with exploding fuel tanks could be that other players also get damaged.

Flashman 04-29-2011 08:42 AM

Hi Guys, im having some fun with this scripting business and have finally got a script that works, however I could do with some help with the timing commands:

I know that 1800 ticks = 1 minute but im not entirely sure what these two number cause to happen. From my script file:

if (Time.tickCounter() % 126000 == 18000)

When this counts down a mission is launched but im unsure as to the significane of the two timings:

does the 126000 give the time between each repeat operation of the operation?

I have found the second number, 18000 in this case appears to set the time for the first operation. Is this correct?

SO, if i want the operation (in this case a mission starts within themain mission and planes spawn) to repeat every 2 hours, but the first operation is 10 minutes after the main mission begins would this be correct?

if (Time.tickCounter() % 216000 == 18000)

Thanks!


All times are GMT. The time now is 08:22 PM.

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