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 09-13-2011, 03:24 PM
Lookaloft Lookaloft is offline
Approved Member
 
Join Date: Dec 2010
Posts: 38
Default

Unfortunately I can’t get the Naryv script to work. I copied the script in Notepad and saved it under ANSI as an cs mission. I did this several times but each time the scriptwindow in my test singlemission says: namespace cannot directly contain members such as fields or methods. CS- 0116.
I’m not familiar with C# but the scripts developed on this Forum are very interesting and absolutely impressive. I implement them in my single missions. Application of scripts is a must for the missionbuilder: it gives this beautiful COD-game an extra demension.

Hopefully someone can help me with this Naryv script
Reply With Quote
  #2  
Old 09-13-2011, 06:54 PM
Mington Mington is offline
Approved Member
 
Join Date: Apr 2008
Posts: 29
Default

I copied the script in Notepad and saved it under ANSI

You can use Notepad++ which is recommended by the RoF team so maybe Maddox coders are using it, and perhaps save documents in the Unicode Big Endian format, again I've seen the RoF devs recommend this format - because of the Cyrillic characters probably but anyway-

Did you create a mission and then did you paste the copied text into the Scripts window?

I say this because your error was '...cannot directly contain members' - you may be doing something else with the text than pasting it in

Have the script-page Internet Explorer (or whatever browser) open, have the FMB running too - use Alt + Tab to switch between them to paste the text into the SCript tab edit window. Copy the script text by using the Ctrl + c trick, then in the FMB open the Scripts tab and do the Ctrl + v trick to paste the text in there. Select the block of text before hitting Ctrl + c to copy selected text to your Clipboard. Sorry if the grandmothers and eggs rule applies!

Make a simple mission with just one plane ready to roll and set it to Player pilot and so on, takeoff and damage the plane, see if the vehicles turn up at your crashed plane

Give me a PM shout if you're stuck and I'll send the mission on to you

Ming
Reply With Quote
  #3  
Old 09-13-2011, 07:03 PM
Mington Mington is offline
Approved Member
 
Join Date: Apr 2008
Posts: 29
Default

the Brits had them on the coast

Frog I have a possible Coastal Command sighting for Thor

The rescue aircraft Walrus in there has the designation-

Class Aircraft.WalrusMkI

Doing the legwork, Igor the whip

Ming
Reply With Quote
  #4  
Old 09-13-2011, 08:25 PM
Das Attorney Das Attorney is offline
Approved Member
 
Join Date: May 2011
Posts: 142
Default

Thanks for the hard work and research on these scripts. Some really awesomesauce going on in this thread.

I was wondering if someone could help me though. I'm using naryv's script to dispatch ambulances etc in a MP dogfight. There's also AI planes that periodically spawn and then land. The problem is that everytime an AI plane lands, fire trucks etc will spawn and eventually lag the game out.

Is there a way of limiting the spawn to just players?

I used to do scripting for Arma 2 (sqf) and the following would be appropriate to filter out AI:

PHP Code:
if (_x == playerthen
{
     
// code 
}; 
I'm not used to C# yet and don't know the syntax well at this point. How could I filter out the AI so firetrucks etc only spawn and deploy for human controlled planes?

I've looked in the examples, but I can't 'get it' yet. I know you're busy guys so even a basic example/link would get me started.

Thanks
Reply With Quote
  #5  
Old 09-14-2011, 06:02 AM
fearlessfrog fearlessfrog is offline
Approved Member
 
Join Date: Jul 2010
Posts: 64
Default

Quote:
Originally Posted by Das Attorney View Post
Thanks for the hard work and research on these scripts. Some really awesomesauce going on in this thread.

I was wondering if someone could help me though. I'm using naryv's script to dispatch ambulances etc in a MP dogfight. There's also AI planes that periodically spawn and then land. The problem is that everytime an AI plane lands, fire trucks etc will spawn and eventually lag the game out.

Is there a way of limiting the spawn to just players?

I used to do scripting for Arma 2 (sqf) and the following would be appropriate to filter out AI:

PHP Code:
if (_x == playerthen
{
     
// code 
}; 
I'm not used to C# yet and don't know the syntax well at this point. How could I filter out the AI so firetrucks etc only spawn and deploy for human controlled planes?

I've looked in the examples, but I can't 'get it' yet. I know you're busy guys so even a basic example/link would get me started.

Thanks
On a quick peek, I think there may be a bug around line 212, i.e. this bit:

Code:
                        if (!CurTechCars.Contains(TmpCar))
                             CurTechCars.Add(TmpCar);
                        MissionLoading = false;
..in that it's adding new cars even if they exist as it doesn't find a match for the existing object.

Another way to do this would be an 'if (CurTechCars.count < MAX_CARS) in before the CurTechCars.Add(TmpCar)

Hopefully that's a few clues, as I'm away from a computer (typing this on a pad)
Reply With Quote
  #6  
Old 09-14-2011, 01:46 PM
Lookaloft Lookaloft is offline
Approved Member
 
Join Date: Dec 2010
Posts: 38
Default

Mington, thanks for your detailed advice, and you too Sokol1 for your response. No grandmothers and eggs rule applied here, Ming. On the contrary I’m very happy with your suggestions, pleased as Punch as people say. Put them already into practice and all went very well now! What a terrific script this Naryv script, and what a fantastic game this Cliffs of Dover!
Reply With Quote
  #7  
Old 09-16-2011, 12:01 AM
Das Attorney Das Attorney is offline
Approved Member
 
Join Date: May 2011
Posts: 142
Default

Quote:
Originally Posted by fearlessfrog View Post
On a quick peek, I think there may be a bug around line 212, i.e. this bit:

Code:
                        if (!CurTechCars.Contains(TmpCar))
                             CurTechCars.Add(TmpCar);
                        MissionLoading = false;
..in that it's adding new cars even if they exist as it doesn't find a match for the existing object.

Another way to do this would be an 'if (CurTechCars.count < MAX_CARS) in before the CurTechCars.Add(TmpCar)

Hopefully that's a few clues, as I'm away from a computer (typing this on a pad)
Thanks

I managed to modify the script to only work on player planes by adding a condition to ignore AI planes - using !isAiControlledPlane(aircraft)

It's working for player planes only now quite nicely.

I'd like to have a go at adding in some code to rearm/refuel/repair. Off the top of my head, it could probably work by automatically setting fuel etc to 1 when the relevant truck completes it's last waypoint. Or when it completes it's last waypoint, then it activates the Mission menu for the player to select the appropriate emergency service. I'm not sure if these solutions would be possible as I don't know many of the scripting commands.

How can you see the API? Do you have to run kegetys -dump command or is there a different way to look at the API (in the COD folder somewhere maybe)?

EDIT: I suspect it's in the maddox.dll....

Last edited by Das Attorney; 09-16-2011 at 12:31 AM.
Reply With Quote
  #8  
Old 09-16-2011, 04:48 AM
fearlessfrog fearlessfrog is offline
Approved Member
 
Join Date: Jul 2010
Posts: 64
Default

The API is written using Microsoft .Net libraries, so you can examine them in things like Visual Studio (there is a free edition called Express). The 'object browser' shows the signatures and symbols of the files like game.world.dll that you reference in your project.
Reply With Quote
  #9  
Old 09-16-2011, 09:25 AM
SNAFU SNAFU is offline
Approved Member
 
Join Date: Feb 2011
Posts: 324
Default

Quote:
Originally Posted by Das Attorney View Post
Thanks

I managed to modify the script to only work on player planes by adding a condition to ignore AI planes - using !isAiControlledPlane(aircraft)

It's working for player planes only now quite nicely.
Would you be so kind and check the code below, in which I tried to modify the script according to your hint (at the end of the original script) and tell me if this is the right direction?


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

	if (!isAiControlledPlane(aircraft))	// SNAFU
 	{   	//SNAFU

        Timeout(5, () =>
        {
            aircraft.Destroy();
        });
    	}

	return; 	// SNAFU
    }	// SNAFU

  public override void OnAircraftLanded(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftLanded(missionNumber, shortName, aircraft);
 
	if (!isAiControlledPlane(aircraft))	// SNAFU
 	{   	//SNAFU
    
        AiAirport NearestAirport = FindNearestAirport(aircraft);          
        if (NearestAirport != null)
        {
            PlanesQueue CurPlane = new PlanesQueue(aircraft, NearestAirport, 0);
            int ArmyPos = 0;
            CurPlane.health = (float)aircraft.getParameter(part.ParameterTypes.M_Health, -1);  
            if (GamePlay.gpFrontExist())
            {
                ArmyPos = GamePlay.gpFrontArmy(NearestAirport.Pos().x, NearestAirport.Pos().y);
            }
            else { ArmyPos = aircraft.Army(); };
            if (CurPlane.health < 1f)  
            {
                CurPlane.State |= ServiceType.EMERGENCY;
                CurPlane.State |= ServiceType.FIRE;
            }
            else if (aircraft.Army() == ArmyPos)
            {
                CurPlane.State |= ServiceType.FUEL;
                CurPlane.State |= ServiceType.AMMO;
                if (aircraft.Type() == AircraftType.Bomber) CurPlane.State |= ServiceType.BOMBS;
            };
            if (!(aircraft.Army() == ArmyPos)) CurPlane.State |= ServiceType.PRISONERCAPTURE;
            if (!CurPlanesQueue.Contains(CurPlane))
            {
                CurPlanesQueue.Add(CurPlane);
                CheckEmrgCarOnAirport(CurPlanesQueue.Count - 1);                
            }
            else
            {
                for (int i = 0; i < CurPlanesQueue.Count; i++)
                    if (CurPlanesQueue[i] == CurPlane)
                    { 
                        CheckEmrgCarOnAirport(i);                        
                        break;
                    }
            }
            CurPlane = null;
        };
    }
	return; 	// SNAFU
    	}	// SNAFU
}
__________________
http://cornedebrouwer.nl/cf48e
Reply With Quote
  #10  
Old 09-13-2011, 06:55 PM
Vengeanze Vengeanze is offline
Approved Member
 
Join Date: Apr 2011
Location: Stockholm
Posts: 837
Default

This gives me wood. I'm stunned that this thread hasn't got like zillions of replies as this is solely such a friggin kewl feature.
Is this what Luthier is talking about?
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 04:29 PM.


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