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
  #161  
Old 05-24-2011, 03:09 PM
ZaltysZ's Avatar
ZaltysZ ZaltysZ is offline
Approved Member
 
Join Date: Sep 2008
Location: Lithuania
Posts: 426
Default

"active" is boolean (logical true or false). You should check "active" to see if trigger is active.

Code:
if (shortName.Equals("attackConvoyDelay") && active)
means: if trigger name is "attackConvoyDelay" AND (&&) this trigger is active, then do something...
Reply With Quote
  #162  
Old 05-24-2011, 03:54 PM
klem's Avatar
klem klem is offline
Approved Member
 
Join Date: Nov 2007
Posts: 1,653
Default

Aaahh! Got it. Thanks
__________________
klem
56 Squadron RAF "Firebirds"
http://firebirds.2ndtaf.org.uk/



ASUS Sabertooth X58 /i7 950 @ 4GHz / 6Gb DDR3 1600 CAS8 / EVGA GTX570 GPU 1.28Gb superclocked / Crucial 128Gb SSD SATA III 6Gb/s, 355Mb-215Mb Read-Write / 850W PSU
Windows 7 64 bit Home Premium / Samsung 22" 226BW @ 1680 x 1050 / TrackIR4 with TrackIR5 software / Saitek X52 Pro & Rudders
Reply With Quote
  #163  
Old 05-24-2011, 07:41 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by TheEnlightenedFlorist View Post

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.
Getting back to moving frontline.
Does GamePlay.gpFrontArmy(bp.Pos().x, bp.Pos().y) work at any point of map or only at frontline/border?

Where can I see the complete list of such commands/functions like GamePlay.gpFrontArmy(bp.Pos().x, bp.Pos().y)? Should I add some game files to my project in Visual Studio? Till now I only opened separate .cs files with it.
Reply With Quote
  #164  
Old 05-24-2011, 11:18 PM
TheEnlightenedFlorist TheEnlightenedFlorist is offline
Approved Member
 
Join Date: May 2011
Location: SLC, Utah, USA
Posts: 143
Default

Quote:
Originally Posted by Ataros View Post
Getting back to moving frontline.
Does GamePlay.gpFrontArmy(bp.Pos().x, bp.Pos().y) work at any point of map or only at frontline/border?

Where can I see the complete list of such commands/functions like GamePlay.gpFrontArmy(bp.Pos().x, bp.Pos().y)? Should I add some game files to my project in Visual Studio? Till now I only opened separate .cs files with it.
Yes, it should work for any point on the map.

Visual Studio will let you see all of the methods in roundabout way. Try this:

1. File >> New >> Project Type in a name and solution name at the bottom. Don't worry about what kind of project you create.

2. On the right side under "Solution Explorer", right click on "References", "Add Reference..."

3. Click on the "Browse" tab, navigate to "Steam/steamapps/common/il-2 sturmovik cliffs of dover/parts/core"

4. Go through each .dll file in that list and try to add it. Some will give you an error, just skip those.

After you've added all the .dll files, right click on the name of your project and do "Add Existing Item". Find one of your script files and add it. Now Visual Studio will show you all the possible methods as you're typing your code. You can also go to View >> Object Browser and have a look in there.

Important: When you import an existing item, Visual Studio makes a copy of the file so any changes you make won't be reflected in the original file, you'll have to copy the new one over it. If anybody knows how to change this, I'd be quite grateful.
Reply With Quote
  #165  
Old 05-25-2011, 07:34 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Thanks a lot for detailed explanation.

BTW did you see the scripting in this mission from the devs http://forum.1cpublishing.eu/showpos...&postcount=133

I was reading it yesterday and it just blows my mind away. There are some great pieces everyone should use:

- airfield capture with removal of old arty
- generating triggers names with variables (string str = "changeArmy" + i.ToString() + "_" + (j).ToString()
- generating waypoints for bombers to attack the most close ground target
- scoring system
etc.

I'll try to convert this mission to the Channel map when I have time. Probably will need a lot of help on C# ))

Devs confirmed that there is a bug not allowing to use captured airfields before switching sides. They are working on it.
Reply With Quote
  #166  
Old 05-25-2011, 07:51 AM
TheEnlightenedFlorist TheEnlightenedFlorist is offline
Approved Member
 
Join Date: May 2011
Location: SLC, Utah, USA
Posts: 143
Default

Quote:
Originally Posted by Ataros View Post
Devs confirmed that there is a bug not allowing to use captured airfields before switching sides. They are working on it.
Cool. All of this would be in vain otherwise.

I've only glanced at that mission, but I've already learned a few things that will make things easier.
Reply With Quote
  #167  
Old 05-25-2011, 07:57 AM
klem's Avatar
klem klem is offline
Approved Member
 
Join Date: Nov 2007
Posts: 1,653
Default

I'm having trouble giving messages to a particular side under OnTickGame because I don't know how to find out which side I am on (" 'aircraft' is not valid in this context"). Any ideas please?

Code:
public override void OnTickGame()

       {

	   if (Time.tickCounter() % 115200 == 1980) // Testing, reduced to 1 min. 1980 = 60secs delay.
	   {
		GamePlay.gpHUDLogCenter("1 minute Timetick message.");
               //issue message after further 30 seconds (test)
		double initTime = 0.0;
		Timeout(initTime += 30, () =>
		     if (aircraft != null)     //error the name aircraft does not exist in the current context
		           {
		           switch (aircraft.Army())		           {                
		    	    case 1:
			      { GamePlay.gpHUDLogCenter("Red side message."); }
             	            break;
	            	    case 2:
			      { GamePlay.gpHUDLogCenter("Blue side message"); }               
			    break;
	    	          }
                     });
           }

      }
__________________
klem
56 Squadron RAF "Firebirds"
http://firebirds.2ndtaf.org.uk/



ASUS Sabertooth X58 /i7 950 @ 4GHz / 6Gb DDR3 1600 CAS8 / EVGA GTX570 GPU 1.28Gb superclocked / Crucial 128Gb SSD SATA III 6Gb/s, 355Mb-215Mb Read-Write / 850W PSU
Windows 7 64 bit Home Premium / Samsung 22" 226BW @ 1680 x 1050 / TrackIR4 with TrackIR5 software / Saitek X52 Pro & Rudders
Reply With Quote
  #168  
Old 06-18-2011, 04:23 AM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default I converted the Dynamic campaign onto the Channel map. Works great.

I am trying to build a Falcon 4 type game where Germans advance towards cahnnel and English must drive them back.
Reply With Quote
  #169  
Old 06-21-2011, 12:48 PM
SNAFU SNAFU is offline
Approved Member
 
Join Date: Feb 2011
Posts: 324
Default

Hi all, and sorry Klem, I can´t help you...

I started now with my attempt to get familar with scripting and C#...

I read through this thread a several times and copied some samples of the outlined scripts.

The problem at hand now, is that I want to include a script in the submissions, which will be loaded into a main, basic-map. This submission script shall contain

Sec 1- the trigger messages,

Sec 2-the instruction messages for new players and players which just took off (WIP:Message shall only be shown, if trigger is not activated yet)

Sec 3- a count of trigger states, so very time a victory-trigger is set to true a counter raises the number for the side, which activated the trigger

Sec 4- clean up procedure at a certain time from begin of submission, removing all AI loaded into the basic map with the submission

Following questions appeared now at this stage:

(A) I already found out how to theoretically get the trigger messages running, still have to get it right, how to show the message only if the otherside (red/blue) has not activated their trigger yet.
Is thiss possible by something like this?

if (<Trigger Red won> == active || <Trigger Blue won> == acitve)
<message red won>


(B) How do I get rid off of all the AI loaded on the basic map, when the submission has done its job?

I wanted to try following script sample to remove the AI after an hour into the submission:

//////////////// Section 4: get rid off all AI loaded with submission

//mod-start by SNAFU -> ZIEL: nach 1h AI-Flieger entfernen

public override void OnTickGame()
{
double initTime;

if (Time.tickCounter() % 108000 == 10799) // 108000=1h
{
//mod-end by SNAFU

foreach (int army in GamePlay.gpArmies())
{
foreach (AiAirGroup group in GamePlay.gpAirGroups(army))
{
if (ActorName.MissionNumber(group.Name()).Equals(Miss ionNumber)) /// <- delete line to kill all
{
AiActor[] members = group.GetItems();
for (int i = members.Length - 1; i > -1; i--)
{
(members[i] as AiAircraft).Destroy();
}
}
}
foreach (AiGroundGroup group in GamePlay.gpGroundGroups(army))
{
if (ActorName.MissionNumber(group.Name()).Equals(Miss ionNumber)) /// <- delete line to kill all
{
AiActor[] members = group.GetItems();
for (int i = members.Length - 1; i > -1; i--)
{
(members[i] as AiGroundActor).Destroy();
}
}
}
}
}


(C) I now loaded a briefing message into the basic map, so every player joining and taking off, will be briefed into the actual ongoing submission. The basic map listens to all events introduced with the submissions, ok. But...

If the the submission is over, how does the main script notice the that the submissions states, messages (f.e. the briefing messages) are not valid anymore? Ist that the "puplic override" I see everywhere?

Here the template for the submission script and sorry for all the silly questions:
Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;

public class Mission : AMission

//////////////////////////////////////////////////////////////////////////////////////
///////////Section 1: Trigger messages

///to copy into

/////////////////////////////////////////////////Section 3: Briefing for new players

///WIP		if (<Trigger missions success red/blue> = false) /////WIP: Trigger Condition for Mission red/blue != true

{
	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)				/////////////Nachricht für neue Spieler
                { GamePlay.gpHUDLogCenter(new Player[] {player},"Red Bomber Task"); }		/////////roter Bomber
                else { GamePlay.gpHUDLogCenter(new Player[] { player }, "Red Fighter Task"); }	///////////roter Jäger
                break;
            case 2:
                if (aircraft.Type() == AircraftType.Bomber)
		{ GamePlay.gpHUDLogCenter(new Player[] { player }, "Blue Bomber Task"); }                 ////////////blauer Bomber
                else { GamePlay.gpHUDLogCenter(new Player[] { player }, "Blue Fighter Task"); }            //////////// blauer Jäger
                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)							/////////////Nachricht für neue Spieler
                { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Red Bomber Task"); }			/////////roter Bomber
                else { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Red Fighter Task"); } 		///////////roter Jäger
              break;
            case 2:
                 if ((aircraft.Type() == AircraftType.Bomber) || (aircraft.Type() == AircraftType.DiveBomber)) 
              { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Blue Bomber Task"); }       		////////////blauer Bomber
                else { GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Red Bomber Task"); } 		//////////// blauer Jäger
              break;

       	 }
    }

///WIP }

//////////////////////////////////////////////////////////////////////////////////////
//////////////// Section 3: Trigger count for overall win condition


// still no idea


//////////////////////////////////////////////////////////////////////////////////////
//////////////// Section 4: get rid off all AI loaded with submission

//mod-start by SNAFU -> ZIEL: nach 1h AI-Flieger entfernen

public override void OnTickGame()
{
   double initTime;    

    if (Time.tickCounter() % 108000 == 10799) // 108000=1h 
  {
//mod-end by SNAFU

foreach (int army in GamePlay.gpArmies())
            {
                foreach (AiAirGroup group in GamePlay.gpAirGroups(army))
                {
                    if (ActorName.MissionNumber(group.Name()).Equals(MissionNumber)) /// <- delete line to kill all
                    {
                        AiActor[] members = group.GetItems();
                        for (int i = members.Length - 1; i > -1; i--)
                        {
                            (members[i] as AiAircraft).Destroy();
                        }
                    }
                }
                foreach (AiGroundGroup group in GamePlay.gpGroundGroups(army))
                {
                    if (ActorName.MissionNumber(group.Name()).Equals(MissionNumber)) /// <- delete line to kill all
                    {
                        AiActor[] members = group.GetItems();
                        for (int i = members.Length - 1; i > -1; i--)
                        {
                            (members[i] as AiGroundActor).Destroy();
                        }
                    }
                }
            }
}

Last edited by SNAFU; 06-21-2011 at 02:45 PM.
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 02:18 AM.


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