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 05-24-2012, 10:48 AM
pupo162 pupo162 is offline
Approved Member
 
Join Date: Feb 2010
Posts: 1,188
Default strange behaviour of some function ( classes?)

Im havign a mission with my current mission wich is a little bit of a pain, since i think its not a code problem. ( i will psot the code later)

but the

-ifplayercrashlanded
-ifplayerlanded
-playerisairbourne

function / classes, give faulty resoults.

some times i land, and the the trigger is not launched, others i crash land, and same happens (even with a basic "hello world" ),

To overcome this i created a refly menu option who uses "player is airbourne function), yet some times im safe and sound on the ground and this still doesnt work :S

this is kind of ruining my scripting efforts. Is this an ingame recurrent issue?
Reply With Quote
  #2  
Old 05-24-2012, 12:25 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

-ifplayercrashlanded
depends on Location, if you crashed near or at a Airfield, its not triggered you get a regular landing.

-ifplayerlanded
Works normal for me in Single and Player hosted server, Problems sometimes on dedicated.

-playerisairbourne
works normal for me.

Let me see your code, please
Reply With Quote
  #3  
Old 05-24-2012, 04:00 PM
pupo162 pupo162 is offline
Approved Member
 
Join Date: Feb 2010
Posts: 1,188
Default

code will be available here in a coupel of hours...

sorry admins, i posted this in the wrong place, can you move this to the FMB forum? thats were it was supposed to be in :S
Reply With Quote
  #4  
Old 05-24-2012, 10:23 PM
Blackdog_kt Blackdog_kt is offline
Approved Member
 
Join Date: Jan 2008
Posts: 2,715
Default

Roger, will move to FMB forum
Reply With Quote
  #5  
Old 05-25-2012, 06:28 AM
pupo162 pupo162 is offline
Approved Member
 
Join Date: Feb 2010
Posts: 1,188
Default

Thnaks blackdog!

Quote:

public override void OnOrderMissionMenuSelected(Player player, int ID, int menuItemIndex)
{
base.OnOrderMissionMenuSelected(player, ID, menuItemIndex);

if (player != null)
{
if (menuItemIndex == 1)
{
GamePlay.gpHUDLogCenter(new Player[] { player }, "Red - {0} blue - {1}", new object[] { redscore, bluescore });
setMainMenu(player);

}
if (menuItemIndex == 2)
{
GamePlay.gpHUDLogCenter(new Player[] { player }, "Ainda nao funciona");
setMainMenu(player);
}
if (menuItemIndex == 3)
{

if (player.Place() != null && player.Place() is AiAircraft)
{
AiAircraft aircraft = player.Place() as AiAircraft;

if (!aircraft.IsAirborne())
{

int value = 0;

if (player != null)

switch (player.Army())
{
case 1:
if (rafa.TryGetValue((aircraft as AiAircraft).InternalTypeName(), out value))
{
rafa[(aircraft as AiAircraft).InternalTypeName()] = value + 1;
GamePlay.gpHUDLogCenter(new Player[] { player }, "You will refly in 5 seconds!");
Timeout(5, () => { destroyPlane(aircraft); });
}

break;

case 2:
if (lwa.TryGetValue((aircraft as AiAircraft).InternalTypeName(), out value))
{
lwa[(aircraft as AiAircraft).InternalTypeName()] = value + 1;
GamePlay.gpHUDLogCenter(new Player[] { player }, "You will refly in 5 seconds!");
Timeout(5, () => { destroyPlane(aircraft); });
}
break;
}
else
GamePlay.gpHUDLogCenter(new Player[] { player }, "Refly is not possible if Airbourne!");
}
}
setMainMenu(player);

}

}
}

this function works perfectly for newly spawn planes, but if take a short circuit and land, or crash, it no longer works, im sitted in my plane and i get the ""Refly is not possible if Airbourne!""

crashlanded was working ok last night, but was giving issues the other one,

Quote:
base.OnAircraftCrashLanded(missionNumber, shortName, aircraft);

Player player = null;

for (int i = 0; i < aircraft.Places(); i++)
{
if (aircraft.Player(i) != null)
{
// TODO: Account for more than one player in an aircraft
player = aircraft.Player(i);
break;
}
}

int value = 0;


if (aircraft.Player(0) != null)

if (player != null)


switch (player.Army())
{
case 1:
if (rafa.TryGetValue((aircraft as AiAircraft).InternalTypeName(), out value))
{
bluescore = bluescore + rafv[(aircraft as AiAircraft).InternalTypeName()];
GamePlay.gpHUDLogCenter(new Player[] { player }, "You crashed!, {0} : LOST!", new object[] { SplitName((aircraft as AiAircraft).InternalTypeName()) });
Timeout(20, () =>
{ destroyPlane(aircraft); });
}

break;

case 2:
if (lwa.TryGetValue((aircraft as AiAircraft).InternalTypeName(), out value))
{
redscore = redscore + lwv[(aircraft as AiAircraft).InternalTypeName()];
GamePlay.gpHUDLogCenter(new Player[] { player }, "You crashed!, {0} : LOST!", new object[] { SplitName((aircraft as AiAircraft).InternalTypeName()) });
Timeout(20, () =>
{ destroyPlane(aircraft); });
}
break;
}
same thing for onplayerlanded, works 90% of the time, its the 10% who get me mad

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

Player player = null;

for (int i = 0; i < aircraft.Places(); i++)
{
if (aircraft.Player(i) != null)
{
// TODO: Account for more than one player in an aircraft
player = aircraft.Player(i);
break;
}
}

int value = 0;


if (aircraft.Player(0) != null)

if (player != null)


switch (player.Army())
{
case 1:
if (rafa.TryGetValue((aircraft as AiAircraft).InternalTypeName(), out value))
{
rafa[(aircraft as AiAircraft).InternalTypeName()] = value + 1;
GamePlay.gpHUDLogCenter(new Player[] { player }, "Welcome Home, {0} : saved!", new object[] { SplitName((aircraft as AiAircraft).InternalTypeName()) });
Timeout(20, () =>
{ destroyPlane(aircraft); });
}

break;

case 2:
if (lwa.TryGetValue((aircraft as AiAircraft).InternalTypeName(), out value))
{
lwa[(aircraft as AiAircraft).InternalTypeName()] = value + 1;
GamePlay.gpHUDLogCenter(new Player[] { player }, "Welcome Home, {0} : saved!", new object[] { SplitName((aircraft as AiAircraft).InternalTypeName()) });
Timeout(20, () =>
{ destroyPlane(aircraft); });

}
break;

}
}
Reply With Quote
  #6  
Old 05-25-2012, 06:54 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

For IsAirborne you can make your own

Simply check:
(actor as AiAircraft).getParameter(part.ParameterTypes.Z_Alt itudeAGL, -1)
(actor as AiAircraft).getParameter(part.ParameterTypes.Z_Vel ocityTAS, -1)

First is Height over Ground, Second is True Airspeed in m/sec.

So if for exampe
Code:
(actor as AiAircraft).getParameter(part.ParameterTypes.Z_AltitudeAGL, -1) <= 1.0
and
Code:
(actor as AiAircraft).getParameter(part.ParameterTypes.Z_VelocityTAS, -1) <= 1.0
you can get shure the plane is on the ground, but you should test the Values.

For checking if plane is Damaged you can use
Code:
(actor as AiAircraft).getParameter(part.ParameterTypes.M_Health, -1)
== 1 if not damaged < 1 if damaged

Last edited by FG28_Kodiak; 05-25-2012 at 07:25 AM.
Reply With Quote
  #7  
Old 05-25-2012, 09:32 AM
pupo162 pupo162 is offline
Approved Member
 
Join Date: Feb 2010
Posts: 1,188
Default

soudns amazing. so i can actually get in flight parameters fo the planes? that could be usefull for a lot of stuff!

i will work furthter on this tomorrow, no time today...

is the 1.0 in meters and killometers? on the check speed and altitude?


also does
Quote:
(actor as AiAircraft).getParameter(part.ParameterTypes.M_Hea lth, -1)
can be used for static planes? im havign this "issue" where i strafe enemey parked (Ground object) planes, and they are left burning, yet they dont count as destroyed. if i could use this, maybe i could give the points to the team according to the damage done to straffed planes?

thanks Kodiak,
Reply With Quote
  #8  
Old 05-25-2012, 09:43 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

meters, all return values are metric
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:14 AM.


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