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 04-26-2011, 06:29 AM
Ralith Ralith is offline
Approved Member
 
Join Date: Aug 2010
Posts: 34
Default

Won't that leave the AI in control for 60 seconds, rather than having it glide into the ground? Really, the code should be ran instantly, and it should disable AI control instead of simply removing the aircraft--assuming that's currently possible.
Reply With Quote
  #2  
Old 04-26-2011, 08:12 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

This sample script made for fun disables player controls. Maybe someone can use it to disable AI controls for say 10 minutes before destroying AI

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

     public class Mission: maddox.game.AMission
     {
  	 / / Override the method that is invoked when some of the planes will take off ...
	 public override void OnAircraftTookOff (int missionNumber, string shortName, AiAircraft aircraft)
         {
             base.OnAircraftTookOff (missionNumber, shortName, aircraft); / / call the base method (you never know ...)
             if (GamePlay.gpPlayer ()! = null) / / check if we have a player.
             {
                 if (GamePlay.gpPlayer (). Place ()! = null) / / check that the player is sitting somewhere and not hanging out on the rag.
                 {
                     if (aircraft.Name (). Equals (GamePlay.gpPlayer (). Place (). Name ())) / / if the plane took off - a player, then ...
                     {
                         aircraft.hitNamed (part.NamedDamageTypes.ControlsElevatorDisabled); / / ... disables  elevators ...
                         aircraft.hitNamed (part.NamedDamageTypes.ControlsAileronsDisabled); / / ...  aileron ...
                         aircraft.hitNamed (part.NamedDamageTypes.ControlsRudderDisabled); / / ...  rudder.
						 / / Have a nice flight!
                     }
                 }
             }
         }      
     }
More scripts here http://translate.google.com/translat...hp%3Ft%3D68369

Last edited by Ataros; 04-26-2011 at 08:16 AM.
Reply With Quote
  #3  
Old 05-24-2011, 08:20 AM
klem's Avatar
klem klem is offline
Approved Member
 
Join Date: Nov 2007
Posts: 1,653
Default

Quote:
Originally Posted by Ataros View Post
This sample script made for fun disables player controls. Maybe someone can use it to disable AI controls for say 10 minutes before destroying AI

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

     public class Mission: maddox.game.AMission
     {
  	 / / Override the method that is invoked when some of the planes will take off ...
	 public override void OnAircraftTookOff (int missionNumber, string shortName, AiAircraft aircraft)
         {
             base.OnAircraftTookOff (missionNumber, shortName, aircraft); / / call the base method (you never know ...)
             if (GamePlay.gpPlayer ()! = null) / / check if we have a player.
             {
                 if (GamePlay.gpPlayer (). Place ()! = null) / / check that the player is sitting somewhere and not hanging out on the rag.
                 {
                     if (aircraft.Name (). Equals (GamePlay.gpPlayer (). Place (). Name ())) / / if the plane took off - a player, then ...
                     {
                         aircraft.hitNamed (part.NamedDamageTypes.ControlsElevatorDisabled); / / ... disables  elevators ...
                         aircraft.hitNamed (part.NamedDamageTypes.ControlsAileronsDisabled); / / ...  aileron ...
                         aircraft.hitNamed (part.NamedDamageTypes.ControlsRudderDisabled); / / ...  rudder.
						 / / Have a nice flight!
                     }
                 }
             }
         }      
     }
More scripts here http://translate.google.com/translat...hp%3Ft%3D68369
Can anyone see what's wrong with the following? I get the first test message at about +45 seconds while still in the hangar (engine on or engine off), repeated every 20 seconds (which is strange) until about mission start +3mins but I never get the second test message or the messages that follow in the "if" statement:


//SEND MESSAGE TO PLAYER WHEN THEY HAVE TAKEN OFF

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

GamePlay.gpHUDLogCenter("Takeoff messages start."); //Test/debug Message

if (aircraft.Name() == GamePlay.gpPlayer().Place().Name()) // if the plane took off - a player, then ...
{

GamePlay.gpHUDLogCenter("Switch section reached"); //Test/debug Message

switch (aircraft.Army())
{
case 1:
if ((aircraft.Type() == AircraftType.Bomber) || (aircraft.Type() == AircraftType.DiveBomber)) // if Bomber or Divebomber
{ GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Remember, Get Organised! Attack briefed targets!"); }
else
{ GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Organise Escorts and protect Convoy moving from Beachy Head to the Thames Estuary!"); }
break;
case 2:
if ((aircraft.Type() == AircraftType.Bomber) || (aircraft.Type() == AircraftType.DiveBomber)) // if Bomber or Divebomber
{ GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Remember, Get Organised and attack briefed Targets!"); }
else
{ GamePlay.gpHUDLogCenter(new Player[] { GamePlay.gpPlayer() }, "Remember, Get Organised and protect our bombers by Escort or Frei Jagd!"); }
break;
}

}

} //end public override void OnAircraftTookOff
__________________
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
  #4  
Old 05-24-2011, 12:08 PM
Iku_es Iku_es is offline
Approved Member
 
Join Date: May 2011
Location: Bilbao, Spain
Posts: 30
Default

Hi,

I have never tried scripting for Clod, but as a C# programer, I'm going to make an educated guess:

Try changing this line:

if (aircraft.Name() == GamePlay.gpPlayer().Place().Name() )

for this one:

if ( aircraft.Name().Equals(GamePlay.gpPlayer().Place().Name()) )

I'm not sure of this because I don't know the types of the objects involved in the comparison (strings?), but try it anyway.

(Check this for more info about why: C# Value Type vs Reference Type)

Also you should check that aircraft is not null, and that GamePlay.gpPlayer().Place() is not null, for security reasons in order to avoid NullReference exceptions.

Last edited by Iku_es; 05-24-2011 at 02:18 PM.
Reply With Quote
  #5  
Old 05-24-2011, 02:18 PM
ZaltysZ's Avatar
ZaltysZ ZaltysZ is offline
Approved Member
 
Join Date: Sep 2008
Location: Lithuania
Posts: 426
Default

klem,

OnAircraftTookOff(() does not currently work for planes spawned at BirthPlaces. It should work for FMB planes with waypoints. I guess, you get first message showed because you have AI taking off.
Reply With Quote
  #6  
Old 05-24-2011, 02:26 PM
ZaltysZ's Avatar
ZaltysZ ZaltysZ is offline
Approved Member
 
Join Date: Sep 2008
Location: Lithuania
Posts: 426
Default

Instead of;

Code:
if (aircraft.Name() == GamePlay.gpPlayer().Place().Name())
try

Code:
if (aircraft == GamePlay.gpPlayer().Place())
By the way, GamePlay.gpPlayer() returns player of offline mission. This won't return a client player in MP, so if you are doing MP mission, this won't work.
Reply With Quote
  #7  
Old 05-24-2011, 03:45 PM
klem's Avatar
klem klem is offline
Approved Member
 
Join Date: Nov 2007
Posts: 1,653
Default

Quote:
Originally Posted by ZaltysZ View Post
Instead of;

Code:
if (aircraft.Name() == GamePlay.gpPlayer().Place().Name())
try

Code:
if (aircraft == GamePlay.gpPlayer().Place())
By the way, GamePlay.gpPlayer() returns player of offline mission. This won't return a client player in MP, so if you are doing MP mission, this won't work.
Thanks guys.

It was for MP and for a BirthPlace so a double fail

btw I had it report aircraft.Name() and GamePlay.gpPlayer().Place().Name() and they were the same string so 'If == ' should have worked ok.
__________________
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
  #8  
Old 04-26-2011, 09:09 AM
ZaltysZ's Avatar
ZaltysZ ZaltysZ is offline
Approved Member
 
Join Date: Sep 2008
Location: Lithuania
Posts: 426
Default

Quote:
Originally Posted by Ralith View Post
Won't that leave the AI in control for 60 seconds, rather than having it glide into the ground? Really, the code should be ran instantly, and it should disable AI control instead of simply removing the aircraft--assuming that's currently possible.
The aim is not to make how it should look in real life. The aim is to remove clutter at first and then make the best you can with realism, because piles of planes have huge impact on playability.

Yes, you can disable the controls, but trimmed plane can happily fly even without working controls. What I want to say: disabling the controls does not guarantee a quick crash.

Extending despawn timeout can lead to great clutter, i.e. when player presses "Create" multiple times.
Reply With Quote
  #9  
Old 04-26-2011, 09:38 AM
robtek's Avatar
robtek robtek is offline
Approved Member
 
Join Date: Oct 2007
Posts: 1,819
Default

The aim should be, imho, when a player bails from a working plane and he tries to create a new plane, he find himself in that "abandoned" plane, as long as it is still flying
And from a realism point of view, it is realistic that planes with dead crews were hunted and so live planes could escape.
I dont think that happens so often to have a felt influence on playability.
__________________
Win 7/64 Ult.; Phenom II X6 1100T; ASUS Crosshair IV; 16 GB DDR3/1600 Corsair; ASUS EAH6950/2GB; Logitech G940 & the usual suspects
Reply With Quote
  #10  
Old 04-26-2011, 10:11 AM
ZaltysZ's Avatar
ZaltysZ ZaltysZ is offline
Approved Member
 
Join Date: Sep 2008
Location: Lithuania
Posts: 426
Default

Quote:
Originally Posted by robtek View Post
The aim should be, imho, when a player bails from a working plane and he tries to create a new plane, he find himself in that "abandoned" plane, as long as it is still flying
You mean injection after ejection? I don't think game engine allows you to teleport a crew member into plane. You can force a player posses a virtual crew member, but at first there should be something to posses in cockpit.

Quote:
Originally Posted by robtek View Post
And from a realism point of view, it is realistic that planes with dead crews were hunted and so live planes could escape.
I dont think that happens so often to have a felt influence on playability.
In fact, the problem isn't flying Dutchmen alone. The problem is bigger. All despawning logic isn't so trivial and implementation can become very complex. The more I play in MP, the more pitfalls I see.
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 09:52 AM.


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