Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   FMB, Mission & Campaign builder Discussions (http://forum.fulqrumpublishing.com/forumdisplay.php?f=203)
-   -   Engine parameters (http://forum.fulqrumpublishing.com/showthread.php?t=31350)

theOden 04-21-2012 06:04 AM

Engine parameters
 
We're all able to read parameters such as fuel and engine values but has anyone found a way to set the values?

What I'm at is to set engine oil and radiator temps to "running" levels when a plane is spawned on a runway (reading birthplace data or the missionfile if more of a "coop") - beats me how they gets there with a cold engine :) .

FG28_Kodiak 04-21-2012 11:32 AM

There is no way to set them.

hc_wolf 04-21-2012 01:37 PM

Yeah can't set them unless a ground unit. this is about as close as you can get
I gave up lol maybe to drunk. :confused:
Code:


        /*      //  AiAirGroup airGroup = aircraft.AirGroup();
              // if(aircraft == airGroup.GetItems()[0])                       

              {

                  double speed = aircraft.getParameter(part.ParameterTypes.Z_VelocityTAS, -1);
                  double sFuel = aircraft.getParameter(part.ParameterTypes.S_FuelReserve, -1); // kgs
                  double iFuel = aircraft.getParameter(part.ParameterTypes.I_FuelReserve, -1); // kgs
                  int ammo = 0;
                  for (int i = 0; i < 9; i++)
                  {
                      ammo += (int)(aircraft.getParameter(part.ParameterTypes.S_GunReserve, i)); // qty
                      sFuel += (int)(aircraft.getParameter(part.ParameterTypes.S_FuelReserve, i)); // qty
                      iFuel += (int)(aircraft.getParameter(part.ParameterTypes.I_FuelReserve, i)); // qty                                       


                  };
                  if (ammo == 0 || sFuel < 20)

                      sFuel += 40;
                  iFuel += 40;
                  ammo += 1;

              }

      */


theOden 04-21-2012 01:41 PM

Thats what I suspected.
Thanks for looking into it Kodiak, I do appreciate all other efforts in scripting from you aswell.

For anyone else that might look for the same effect and ending up in this thread, I've also tried to manipulate the game settings (GamePlay.gpDifficultyGet().Engine_Temperature_Eff ects that is) in different events, still no success but here you go for future reference (all commented out at this stage):

Code:

//$debug
using System;
using System.Collections;
using maddox.game;
using maddox.game.world;
using maddox.GP;
using System.Collections.Generic;
using System.Globalization;

public class Mission : AMission
{
    //private string OdenMissionPath = "missions/Multi/Co-Op/ItalianVisit.mis";
        //private bool odenDebug = false;
   
        // Public Overrides
    public override void Init(ABattle battle, int missionNumber)
    {
        base.Init(battle, missionNumber);
        /*
            DifficultySetting ds = GamePlay.gpDifficultyGet();
            ds.Engine_Temperature_Effects = false;
            GamePlay.gpDifficultyGet().set(ds);
            Player localPlayer = GamePlay.gpPlayer();
            GamePlay.gpLogServer(new Player[] { localPlayer }
                        , "Init: {0} {1}"
                        , new object[] { GamePlay.gpDifficultyGet().Engine_Temperature_Effects,ds.Engine_Temperature_Effects }
                );
                */
        }
    public override void OnBattleStarted()
    {
            base.OnBattleStarted();       
            /*
            DifficultySetting ds = GamePlay.gpDifficultyGet();
            ds.Engine_Temperature_Effects = false;
            GamePlay.gpDifficultyGet().set(ds);
            Player localPlayer = GamePlay.gpPlayer();
            GamePlay.gpLogServer(new Player[] { localPlayer }
                        , "OnBattleStarted: {0} {1}"
                        , new object[] { GamePlay.gpDifficultyGet().Engine_Temperature_Effects,ds.Engine_Temperature_Effects }
                );
                */
        }

    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
                base.OnPlaceEnter(player, actor, placeIndex);
                /*
                string bpName = "Bollocks";
                bool spawnParked = false;
                string strSpawn = "unknown";
                */
            /*
                DifficultySetting ds = GamePlay.gpDifficultyGet();
            ds.Engine_Temperature_Effects = false;
            GamePlay.gpDifficultyGet().set(ds);
            Player localPlayer = GamePlay.gpPlayer();
            GamePlay.gpLogServer(new Player[] { localPlayer }
                        , "OnPlaceEnter {0} {1}"
                        , new object[] { GamePlay.gpDifficultyGet().Engine_Temperature_Effects,ds.Engine_Temperature_Effects }
                );
                */
                /*
                Point3d pt3d = actor.Pos();
                AiAirport homeBase = FindClosestAirfield(0,pt3d,1000);
        foreach (AiBirthPlace bp in GamePlay.gpBirthPlaces())
        {
            if (bp != null)
                if(bp.Pos().distance(ref pt3d) < 5000)
                {
                        bpName = bp.Name(); // requires proper names under [BirthPlace] in mis-file
                        spawnParked = bp.IsSetOnPark();
                        if(spawnParked) strSpawn = "parking area"; else strSpawn = "on runway";
                    };
        };       
        if(GamePlay.gpDifficultyGet().Engine_Temperature_Effects) strSpawn = "God I hate this game";
       
                AiAircraft aircraft = actor as AiAircraft;
                if(aircraft != null)
                {
                        //double fuelLitres = (float)(aircraft.getParameter(part.ParameterTypes.I_FuelReserve, -1));
                        GamePlay.gpLogServer(new Player[] { player }
                                , "onPlaceEnter {0} is '{1}' at {2} {3}"
                                , new object[]
                                        {        aircraft.InternalTypeName()
                                                , aircraft.Type() // Fighter/Bomber etc
                                                , bpName //homeBase.Name()
                                                , strSpawn
                                        }
                        );
                };
                */
                if(actor != null)
                {
                        // debug damagedAircrafts.Add(actor as AiAircraft);
                        Timeout(5, () => { GamePlay.gpHUDLogCenter(new Player[] { player }, "Find yourself home to Abbeville, Good Luck and be gentle on the engine"); });
                }
    }
               
    public override void OnTrigger(int missionNumber, string shortName, bool active)
    {
        base.OnTrigger(missionNumber, shortName, active);
       
        //if(active) GamePlay.gpHUDLogCenter("Trigger active: " +shortName);
        //else GamePlay.gpHUDLogCenter("Trigger idle: " +shortName);
        Player localPlayer = GamePlay.gpPlayer();
        if(active && localPlayer != null)
        {
                if(shortName == "Abbeville") Timeout(5, () => { GamePlay.gpHUDLogCenter(new Player[] { localPlayer }, "Welcome back to Abbeville"); });
        }
    }
   
    //
    internal AiAirport FindClosestAirfield(int army, Point3d pt3d, int runwaylength)
    {
        AiAirport result = null;
        AiAirport[] airports = GamePlay.gpAirports();
                string sectorName;
               
        if (airports != null)
        {
            foreach (AiAirport airport in airports)
            {
                    sectorName = GamePlay.gpSectorName(airport.Pos().x, airport.Pos().y).ToString();
                                //if (GamePlay.gpFrontArmy(airport.Pos().x, airport.Pos().y) == army && airport.FieldR() > runwaylength && (sectorName.IndexOf(">") == -1 && sectorName.IndexOf("<") == -1))
                                if((sectorName.IndexOf(">") == -1 && sectorName.IndexOf("<") == -1))
                {
                    if (result != null)
                    {
                        if (airport != null)
                            if (result.Pos().distance(ref pt3d) > airport.Pos().distance(ref pt3d))
                                result = airport;
                    }
                    else result = airport;                   
                }
            }
        }
        return result;
    }
   
}


Edit: ah! thanks a tonne hc_wolf, still no go though :)


All times are GMT. The time now is 12:23 PM.

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