Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #51  
Old 04-27-2011, 04:53 PM
mcler002 mcler002 is offline
Approved Member
 
Join Date: Mar 2011
Location: UK
Posts: 277
Exclamation

Quote:
Originally Posted by FG28_Kodiak View Post
The % is the modulus operator in C# (C, C++ and others)
http://en.wikipedia.org/wiki/Modulo_operation
You trying to blow my brains out haha?
Reply With Quote
  #52  
Old 04-27-2011, 05:21 PM
ZaltysZ's Avatar
ZaltysZ ZaltysZ is offline
Approved Member
 
Join Date: Sep 2008
Location: Lithuania
Posts: 426
Default

Regarding ticks.

1) naryv (dev) said that 30 ticks are around 1 second. Because of that "around", you can get errors.

2) No one said that single tick always takes the same amount of time (if so, lag can screw your timing badly).
Reply With Quote
  #53  
Old 04-27-2011, 07:09 PM
mcler002 mcler002 is offline
Approved Member
 
Join Date: Mar 2011
Location: UK
Posts: 277
Thumbs down

Quote:
Originally Posted by ZaltysZ View Post
Regarding ticks.

1) naryv (dev) said that 30 ticks are around 1 second. Because of that "around", you can get errors.

2) No one said that single tick always takes the same amount of time (if so, lag can screw your timing badly).
Wants 30 ticks to equal 1 seconds on the dot ! or 1 tick to equal one second!

please
Reply With Quote
  #54  
Old 04-27-2011, 09:36 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

30 ticks ~ 1 sec

Tested this. Works most of the time I think ))

Thanks to all for scripts!

Code:
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/128BoFsmGroundv1_0.mis");
            GamePlay.gpHUDLogCenter("Protect friendly shipping in the channel near France!");
            }

            if (Time.tickCounter() % 72000 == 71999) // 40-40 
            {
                GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/128BoF/128BoFsmBombersv1_0.mis");
				GamePlay.gpHUDLogCenter("Intel: Enemy bombers are heading to blue airfields!"); 
			}
        
            if (Time.tickCounter() % 72000 == 45000) // 40-25
			{
                GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/128BoF/128BoFsmBombersv1_0a.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, () =>
            {
                (actor as AiAircraft).Destroy();
            });

        }
        else if (PlaneIsEmpty)
        {
            (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, () =>
        {
            aircraft.Destroy();
        });
    }
}
Runs at Repka server.
Reply With Quote
  #55  
Old 04-28-2011, 08:13 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Valuable note from a developer here

Quote:
Originally Posted by MuxaHuk View Post
With new engine you can create your own game inside our game, for example: you connect to server, and server sends to you completly new user interface (no restriction, but protected by sandbox, no one can read, write or modify your data that out border of game).
New GUI, new rules of game, new score system with ranks and etc.
It can do right now, anyone for their game server.
Of course you need some knowledge of scripting and design. We will assist wherever possible to all comers.
We are working to create examples.

Imagine in the future, each server will be unique, different battles on land, in air or under water, or global war
Anyone wants to write an interface for an online war?

ATM we have some knowledge on the following:
- triggers to check if mission objectives are complete
- scripts to load new mission objectives into a current mission based on triggers
- simple interface to give players new objectives GamePlay.gpHUDLogCenter

Say if enemy tanks are destroyed in a mission, we can move frontline, change one airfield spawnpoint from blue to red and load next mission objectives. But a good interface mod would be extremely useful to show different briefings based on airfields selected, to allow relocating airgroups from airfield to airfield, manage fuel resources, routes of supply convoys, voting for a commander, etc.
There is a great game-mode mod called "Warfare" in ArmA2. I hope we can create something similar and better.
Reply With Quote
  #56  
Old 04-28-2011, 08:34 AM
MuxaHuk MuxaHuk is offline
Approved Member
 
Join Date: Nov 2009
Posts: 19
Default

This sample to use Time.current()
count in seconds from started battle.
Code:
 private double nextMsgTime = 0;
 public override void OnTickGame() {
    base.OnTickGame();
    // Time. current() in seconds from Battle Start
    if ( Time.current() > nextMsgTime ) {
      nextMsgTime = Time.current() + 10.0; // 10 seconds to next message
      GamePlay.gpHUDLogCenter( "Time elapsed (in seconds) = " + Time.current() + ", next message will be at "+nextMsgTime);
    }
  }
Reply With Quote
  #57  
Old 04-28-2011, 03:09 PM
Flashman Flashman is offline
Approved Member
 
Join Date: May 2010
Posts: 109
Default

These all are very useful posts, in fact I have borrowed a bit of the script for my own mission that I hope will appear on the Syndicate Server soon.

I have a few questions as I know nothing about these scripts

1) If I want the text that comes up with the 'GamePlay.gpHUDLogCenter' command to show to only one team, can this be done and if so how?

2) I have noriced that using these scripts with the spawn removal stops the in game action and trigger events working where it spawns an aircraft. Is there a way of using both?

Keep up the good work, and thanks for your help in advance.
Reply With Quote
  #58  
Old 04-28-2011, 04:24 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by Flashman View Post
These all are very useful posts, in fact I have borrowed a bit of the script for my own mission that I hope will appear on the Syndicate Server soon.

I have a few questions as I know nothing about these scripts

1) If I want the text that comes up with the 'GamePlay.gpHUDLogCenter' command to show to only one team, can this be done and if so how?

2) I have noriced that using these scripts with the spawn removal stops the in game action and trigger events working where it spawns an aircraft. Is there a way of using both?

Keep up the good work, and thanks for your help in advance.
1) I asked devs the same question at Sukhoi.ru.

2) Did not quite get what you mean by "spawn removal" and "trigger events working where it spawns an aircraft". Could you clarify please.
Reply With Quote
  #59  
Old 04-28-2011, 05:00 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

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;

        }
    }

Last edited by Ataros; 04-28-2011 at 05:03 PM.
Reply With Quote
  #60  
Old 04-28-2011, 05:18 PM
Flashman Flashman is offline
Approved Member
 
Join Date: May 2010
Posts: 109
Default

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?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:54 AM.


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