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-29-2011 08:49 AM

1st number = repeat i.e if it was 108000 - the map/ mission should load every 1hour...

2nd number = start time i.e. if it was 18000 = the map/mission should start within 10 minutes of the game start, or repeat interval...

But i dont think it works 100%... but as i have been told 1800 ticks "roughly" equals a minute...

Flashman 04-29-2011 09:24 AM

Quote:

Originally Posted by mcler002 (Post 275689)
1st number = repeat i.e if it was 108000 - the map/ mission should load every 1hour...

2nd number = start time i.e. if it was 18000 = the map/mission should start within 10 minutes of the game start, or repeat interval...

But i dont think it works 100%... but as i have been told 1800 ticks "roughly" equals a minute...

Cool, thanks.

I actually did some offline testing and set the timings to minutes adn sped things up! It appears to work roughly as you say... it will do for now!

mcler002 04-29-2011 09:30 AM

Quote:

Originally Posted by Flashman (Post 275705)
Cool, thanks.

I actually did some offline testing and set the timings to minutes adn sped things up! It appears to work roughly as you say... it will do for now!

Yea i did offline testin as well... but x16 is just not fast enough lol! only went a couple of hours in...

mcler002 04-29-2011 11:15 AM

AI damage & destory
 
Ive tested and tested... its not working :S

Help !

Ataros 04-30-2011 12:58 AM

Just to have it all in one thread

Quote:

Originally Posted by MuxaHuk (Post 274954)
Code:

public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceLeave(player, actor, placeIndex);
        Timeout(1, () =>
        {
            AiAircraft CurAircraft = player.Place() as AiAircraft;
            AiAircraft PrevAircraft = actor as AiAircraft;
            if (CurAircraft != PrevAircraft) 
                { (actor as AiAircraft).Destroy(); }
        });
    }



Ataros 04-30-2011 01:09 AM

Quote:

Originally Posted by Flashman (Post 275280)
Hi Ataros,

Hopefully I will be a little more clear this time!

I used the in-game script system using a Trigger to cause an Action to happen. Eg in my missions if a plane I select is shot down, it triggers the spawn of another plane.

EDIT>Script

Trigger: Walrus 1= Target Group destroyed (Walrus flying boat selected)
Action: Walrus 1= Air spawn group (second walrus selected)

This system works in single player, so that when the first walrus is shot down a second spawns at a preselected place. However, when I include the scripts you guys have been developing to despawn empty aircraft (for use online) the ingame script above does not work in either single or multiplayer.

Any ideas what i am doing wrong?

Checked ingame trigger system. Did not work with external scrips but it is by itself just fantastic! I think it is possible to achieve what I tried to do loading sub-missions into a mission with this trigger system only. I'll switch to it for a while from scripting as I do not know C#. Very helpful thread on this http://forum.1cpublishing.eu/showthr...builder&page=2

However we should try:

1) make a mission with internal triggers without script
2) make a mission with script that loads the first mission in.
3) load more missions when needed.
I will not have time to try this for a couple of days however ((

Alternatively you can program all the triggers in a script by hand. Check links in the 1st message of this thread for examples.

e.g.
Code:

  / / $ Reference Campaign.dll
 / / - $ Debug
 using System;
 using maddox.game;
 using maddox.game.world;

 public class Mission: maddox.game.campaign.Mission {

        public override void OnTrigger (int missionNumber, string shortName, bool active)
        {
            if ("trigger". Equals (shortName) & & active)
            {
                GamePlay.gpHUDLogCenter ("Triggers trigger");
            } 
        }
 
 }

Code:

  using System;
 using maddox.game;
 using maddox.game.world;


 class Mission: maddox.game.AMission
 {
        public override void OnActorDead (int missionNumber, string shortName, AiActor actor, System.Collections.Generic.List <DamagerScore> damages)
        {
                base.OnActorDead (missionNumber, shortName, actor, damages);
                AiAction action = GamePlay.gpGetAction ("TestAction");
                if (action! = null)
                {
                        action.Do ();
                }
        }
 }

Code:

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

    public class Mission : maddox.game.AMission
    {
        private List<AiAction> actions = new List<AiAction>();
        private int round = 1;
        private bool completed = false;
       
        public override void OnBattleStarted()
        {
            AiAction action = GamePlay.gpGetAction("startGroup2");
            if (action != null) actions.Add(action);
            action = GamePlay.gpGetAction("startGroup3");
            if (action != null) actions.Add(action);
            GamePlay.gpHUDLogCenter(String.Format("Раунд {0}", round));
        }

        public override void OnActorDead(int missionNumber, string shortName, AiActor actor, System.Collections.Generic.List<DamagerScore> damages)
        {
            base.OnActorDead(missionNumber, shortName, actor, damages);
            if (!(actor is AiAircraft))
                return; // Не самолет

            int army = (actor as AiAircraft).Group().Army();
            if (army == 1)
            {
                if (!completed)
                {
                    bool fail = (actor as AiAircraft).AirGroup().DiedAircrafts >= (actor as AiAircraft).AirGroup().InitNOfAirc;
                    if (fail)
                    {
                        GamePlay.gpHUDLogCenter("Миссия провалена.");
                    }
                }
            }
            else
            {
                bool next = (actor as AiAircraft).AirGroup().DiedAircrafts >= (actor as AiAircraft).AirGroup().InitNOfAirc;
                if (next)
                {
                    if (round == 3)
                    {
                        completed = true;
                        GamePlay.gpHUDLogCenter("Поздравляем, миссия пройдена!");
                    }
                    else
                    {
                        round++;
                        startNewRound();
                    }
                }
            }
        }

        private void startNewRound()
        {
            GamePlay.gpHUDLogCenter(String.Format("Раунд {0}", round));
            if (actions.Count > 0)
            {
                actions[0].Do();
                actions.RemoveAt(0);
            }
        }
    }


http://translate.google.com/translat...hp%3Ft%3D68369

Quote:

Originally Posted by mcler002 (Post 275763)
Ive tested and tested... its not working :S

Help !


Would you tell us what exactly you are trying to do and what does not work. Run my script it loads missions on timing more or less. Does not always destroy planes on the server however.

mcler002 04-30-2011 05:17 AM

I have pretty much copied and pasted your scripting ...

I always right click and compile to see if the script is OK, which it is ... So when ever I try and test it ... My ai bots are still flying

At the current time I am in the middle of making a new online map with less 'repeat mission' loading, and more internal triggers

But as you have posted above, I will need script for 'triggers' to flash messages on the screen about incoming planes etc ...

I shall give the above a try when I'm on my pc later!

Ataros 04-30-2011 02:25 PM

Quote:

Originally Posted by mcler002 (Post 276219)
So when ever I try and test it ... My ai bots are still flying

Ahh, if you mean bot removal script, it works on my PC when I create a server, but does not work on a dedi server somehow ((
The issue reported to the devs already.

Try the second script I copied from sukhoi.ru.

Just uploaded a new mission into missions thread. http://forum.1cpublishing.eu/showpos...3&postcount=31

FG28_Kodiak 04-30-2011 03:10 PM

Do you try ABattle and not AMission?

Ataros 04-30-2011 04:19 PM

Quote:

Originally Posted by FG28_Kodiak (Post 276418)
Do you try ABattle and not AMission?

This is the latest script I used. Do you mean I should change
public class Mission : AMission
to
public class Mission : ABattle
Should I?
Every script I have seen uses AMission I think.

Code:

// v.1.6.14

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

public class Mission : AMission
{

    // loads my sub-missions
    public override void OnTickGame()
    {

            if (Time.tickCounter() % 72000 == 18000) // 40-10
            {
            GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/128BoF/128BoFv1_6Ground1.mis");
            GamePlay.gpHUDLogCenter("Protect friendly shipping in the channel near France!");
            }

            if (Time.tickCounter() % 72000 == 71999) // 40-40
            {
                GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/128BoF/128BoFv1_6Bombers1.mis");
                                GamePlay.gpHUDLogCenter("Intel: Enemy bombers are heading to blue airfields!");
                        }
       
            if (Time.tickCounter() % 72000 == 45000) // 40-25
                        {
                GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/128BoF/128BoFv1_6Bombers2.mis");
                GamePlay.gpHUDLogCenter("Intel: Enemy bombers are heading to red airfields in France!");
                        }

       
    }

    // destroys aircraft abandoned by a player
    public void _DespawnEmptyPlane(AiActor actor)
    {
        if (actor == null)
        { return; }

        Player[] Players = GamePlay.gpRemotePlayers();

        bool PlaneIsEmpty = true;

        foreach (Player i in Players)
        {
            if ((i.Place() as AiAircraft) == (actor as AiAircraft))
            {
                PlaneIsEmpty = false;
                break;
            }
        }

        if ((PlaneIsEmpty) && (actor as AiAircraft).IsAirborne())
        {

            (actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsElevatorDisabled);
            (actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsAileronsDisabled);
            (actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsRudderDisabled);
            (actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng0TotalFailure);
            //for 2mots
            (actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng1TotalFailure);

            //then wait 10min
            Timeout(600.0, () =>
            {
                if (actor is AiAircraft)
                {
                    (actor as AiAircraft).Destroy();
                }
            });

        }
        else if (PlaneIsEmpty)
        {
                if (actor is AiAircraft)
                {
                  (actor as AiAircraft).Destroy();
                }
        };
    }

    public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceLeave(player, actor, placeIndex);
        _DespawnEmptyPlane(actor);
    }
    // destroys crushlanded aircraft in 10 minutes
    public override void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftCrashLanded(missionNumber, shortName, aircraft);
        Timeout(600, () =>

        {
            if (aircraft != null)
            {
            aircraft.Destroy();
            }
        });
    }
}



All times are GMT. The time now is 12:59 PM.

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