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
  #1  
Old 10-16-2011, 02:10 PM
Osprey's Avatar
Osprey Osprey is offline
Approved Member
 
Join Date: Jan 2010
Location: Gloucestershire, England
Posts: 1,264
Default

It's ok, I found the problem! This is the trouble with no documentation, there's nothing to tell you the minor little bits and bobs. It was "Script spawn or" unchecked. It works now

I do find something weird though, don't know if others get it but seems that at some airfields when the AI spawn in they drop into the sea underneath the land. Ever seen it?
Reply With Quote
  #2  
Old 10-16-2011, 03:34 PM
David198502's Avatar
David198502 David198502 is offline
Approved Member
 
Join Date: Dec 2009
Location: Austria
Posts: 1,536
Default

hey Kodiak, godfather of COD scripting,how do i correctly combine two scripts?
i tried to kombine your script where the airplanes get destroyed after a certain period with the script which combines a main and three submissions....both of their own work well, but as soon as i paste the "destroying" script into the other, none of them will work....
__________________

Last edited by David198502; 10-16-2011 at 03:38 PM.
Reply With Quote
  #3  
Old 10-16-2011, 04:05 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Quote:
Originally Posted by David198502 View Post
hey Kodiak, godfather of COD scripting,how do i correctly combine two scripts?
i tried to kombine your script where the airplanes get destroyed after a certain period with the script which combines a main and three submissions....both of their own work well, but as soon as i paste the "destroying" script into the other, none of them will work....
Could you poste the code please?
Reply With Quote
  #4  
Old 10-16-2011, 04:45 PM
David198502's Avatar
David198502 David198502 is offline
Approved Member
 
Join Date: Dec 2009
Location: Austria
Posts: 1,536
Default

there it is...
Attached Files
File Type: txt totalwar.txt (4.8 KB, 10 views)
__________________
Reply With Quote
  #5  
Old 10-16-2011, 05:39 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Ok, i see couldn't work

this is the main block:

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

public class Mission : AMission
{


}
You must place your code between the two brackets { ... }

so you must place
public override void OnActorCreated(....)
{
.....
.....
}

and
public override void OnTickGame(...)
{
.....
.....
}
between the brackets.
Your fault was that you placed the OnActorCreated into the OntickGame and this is not allowed in C#.
Hint: Open your Clod Console and you will see error messages if anything goes wrong.

So should your code look like:
Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;

public class Mission : AMission
{

    public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorCreated(missionNumber, shortName, actor);

        if (actor is AiAircraft)
        {
            switch ((actor as AiAircraft).InternalTypeName())
            {

                case "bob:Aircraft.He-111P-2":

                    Timeout(600, () =>    // Time in Seconds
                         {
                             (actor as AiAircraft).Destroy();
                         });
                    break;
            }
        }
    }




    public override void OnTickGame()
    {

        // loads the 1st sub-mission in 10 min and repeates it every 60 min.
        if (Time.tickCounter() % 10800 == 180) // 108000 = 60 min repeat. 1800 = 10 min delay. 
        // pls. note!!! the 1st figure above must be always larger than 2nd!
        {
            GamePlay.gpPostMissionLoad("missions/Single/mission1.mis");

            // prints message on screen after mission load
            GamePlay.gpHUDLogCenter("Hello, world! Mission1.mis loaded!");

            // prints message on screen in 10 minutes
            double initTime = 0.0;
            Timeout(initTime += 600, () =>
            {
                GamePlay.gpHUDLogCenter("10 minutes into the 1st mission! Wow! It works!!!");
            });

            // prints message on screen in 5 minutes
            Timeout(initTime += 300, () =>
            {
                GamePlay.gpHUDLogCenter("Wholy s.. it works!!!");
            });

        }

        // loads the 2nd sub-mission, etc. the same way
        if (Time.tickCounter() % 10800 == 1000) //  108000 = 60 min repeat, 54000 = 30 min delay. 
        {
            GamePlay.gpPostMissionLoad("missions/Single/mission2.mis");
            GamePlay.gpHUDLogCenter("Mission2.mis loaded!");
            double initTime = 0.0;
            Timeout(initTime += 600, () =>
             {
                 GamePlay.gpHUDLogCenter("Mission2 10 min message!");
             });

            Timeout(initTime += 300, () =>
               {
                   GamePlay.gpHUDLogCenter("Mission2 15 min message!");
               });
        }

        // loads the 3rd sub-mission
        if (Time.tickCounter() % 10800 == 2000) // 60 min repeat, 50 min delay 
        {
            GamePlay.gpPostMissionLoad("missions/Multi/Single/mission3.mis");
            GamePlay.gpHUDLogCenter("Mission3.mis loaded!");

            double initTime = 0.0;
            Timeout(initTime += 600, () =>
            {
                GamePlay.gpHUDLogCenter("Mission3 10 min message!");
            });
            Timeout(initTime += 300, () =>
            {
                GamePlay.gpHUDLogCenter("Now it really works! You are a genius! Have fun!");
            });
        }
    }
}
btw i've not tested the script in Clod so may be there are other errors are present, but normaly it should work.
Reply With Quote
  #6  
Old 10-16-2011, 06:32 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Very interesting thread. Thank you, Kodiak.

I guess spawning the same group OnTrigger again and again may not work because when the group spawns the 2nd time it belongs to the second mission, etc. The game engine includes mission counter as far as I understand from naryv's examples. I think a long_name of a group may include a mission (submission) number.

Maybe the way to load the same group OnTrigger is to make a sub-mission which includes both an airgroup and a trigger. Then load the same submission OnTrigger. Can not grasp it 100% myself, just thinking aloud.
Reply With Quote
  #7  
Old 10-17-2011, 09:29 AM
SNAFU SNAFU is offline
Approved Member
 
Join Date: Feb 2011
Posts: 324
Default

No, that works, but you have to clear the trigger again, after it was triggered.

If you have the following for the trigger:
Code:
 if (("RedIntercept1".Equals(shortName) && active) && (CountAIAirplanes(1) <= maxRedAI)) 
          { 
                AiAction action = GamePlay.gpGetAction("RedIntercept1");
                if (action != null)
			MissionTimer1Int.Restart();
			MissionTimer1IntA.Start();			
			GamePlay.gpLogServer(null, "Intercept 1 triggered ", new object[] { }); //Testmeldung
                {
                     action.Do();
                }
                GamePlay.gpGetTrigger(shortName).Enable = false;            
          }
You can clear the trigger again by something like this:
Code:
if (MissionTimer1IntA.Elapsed.Minutes >= 30)   			//wieder freischalten des Triggers
    {
	GamePlay.gpGetTrigger("RedIntercept1").Enable = true; 
	MissionTimer1IntA.Reset();					
	GamePlay.gpLogServer(null, "Trigger 1 clear", new object[] { }); 		//Testmeldung
	}
__________________
http://cornedebrouwer.nl/cf48e
Reply With Quote
  #8  
Old 10-16-2011, 04:01 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

@David:
I use the InternalTypeName of the plane, here others for the flyable planes:
bob:Aircraft.Bf-109E-3
bob:Aircraft.Bf-109E-3B
bob:Aircraft.Bf-109E-1
bob:Aircraft.Bf-109E-4
bob:Aircraft.Bf-109E-4B
bob:Aircraft.Bf-110C-4
bob:Aircraft.Bf-110C-7
bob:Aircraft.Ju-87B-2
bob:Aircraft.Ju-88A-1
bob:Aircraft.He-111H-2
bob:Aircraft.He-111P-2
bob:Aircraft.SpitfireMkIa
bob:Aircraft.SpitfireMkI
bob:Aircraft.HurricaneMkI
bob:Aircraft.HurricaneMkI_dH5-20
bob:Aircraft.BlenheimMkIV
bob:Aircraft.SpitfireMkIIa

to figure this out the KI-Only Planes you can add:
Code:
GamePlay.gpLogServer(null, "InternalTypeName: {0}", new object[]{(actor as AiAircraft).InternalTypeName()});
to OnActorCreated(...) so you see the internal name in the chatbar and in the log (if enabled in conf.ini).

To destroy the planes from a specific Airgroup is not possible in OnActorCreated(..) at the time of creation there is no Airgroup.
But you can use the ActorName
Code:
GamePlay.gpLogServer(null, "ActorName: {0}", new object[] { (actor as AiAircraft).Name() });
If i use:
Code:
    public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorCreated(missionNumber, shortName, actor);

        if (actor != null && actor is AiAircraft)
        {

            GamePlay.gpLogServer(null, "InternalTypeName: {0}", new object[] { (actor as AiAircraft).InternalTypeName() });

            GamePlay.gpLogServer(null, "ActorName: {0}", new object[] { (actor as AiAircraft).Name() });
        }
}
i get this in the chatbar (from earlier example)
Server: InternalTypeName: bob:Aircraft.Bf-109E-4
Server: ActorName: 0:BoB_LW_LG2_I.000
Server: InternalTypeName: bob:Aircraft.He-111H-2
Server: ActorName: 0:BoB_LW_KuFlGr_706.000
Server: InternalTypeName: bob:Aircraft.He-111H-2
Server: ActorName: 0:BoB_LW_KuFlGr_706.001
Server: InternalTypeName: bob:Aircraft.He-111H-2
Server: ActorName: 0:BoB_LW_KuFlGr_706.002
Server: InternalTypeName: bob:Aircraft.He-111H-2
Server: ActorName: 0:BoB_LW_KuFlGr_706.010
Server: InternalTypeName: bob:Aircraft.He-111H-2
Server: ActorName: 0:BoB_LW_KuFlGr_706.011
Server: InternalTypeName: bob:Aircraft.He-111H-2
Server: ActorName: 0:BoB_LW_KuFlGr_706.012

so if you like to destroy planes from a Airgroup you could use:
Code:
        if (actor is AiAircraft && actor.Name().Contains("BoB_LW_KuFlGr_706"))
        {
             Timeout(60, () =>    // Time in Seconds
                         {
                             (actor as AiAircraft).Destroy();
                         });
        }
or a specific plane
Code:
        if (actor is AiAircraft && actor.Name().Contains("BoB_LW_KuFlGr_706.010"))
        {
             Timeout(60, () =>    // Time in Seconds
                         {
                             (actor as AiAircraft).Destroy();
                         });
        }
Reply With Quote
Reply

Thread Tools
Display Modes

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 03:37 AM.


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