Forums » Air Combat & Civil Aviation » IL-2: Cliffs of Dover » Ambulance Station: notes from the Cavern Active Topics You are not logged in. [Log In] [Register User]
Page 1 of 6 1 2 3 4 5 6 >
Topic Options
Rate This Topic
Hop to:
#3387619 - 09/11/11 10:49 AM Ambulance Station: notes from the Cavern
Ming_EAF19 Offline
Babelfish Immune
Veteran

Registered: 09/22/04
Posts: 10618
Loc: London
In the standard provided Stukas mission script I see how to pass an object's ID to running scripts so that objects can be damaged perhaps or to move them around intelligently (vehicles break out of convoy mode on spotting the enemy to get off the road, scat)

In this case b1 is looking at the mission (dot mis) file to pick up the IDentification that the FMB mission file is using to refer to the ship. Ships are GroundActors and vehicles are also in that group with any luck

Vehicle b1 (1_Chief in the dot-mis mission file) for example would then be driven by a script from point to point using the FindPath or .set functions perhaps

Not sure why there's a Gameplay (GamePlay.gpGetTrigger) and an IGamePlay- example maddox.game.IGamePlay.gpGetTrigger(string)

GP might be GPS. Which would be nice Smile2

Place vehicle in FMB, pick up its ID in the script, blow the bloody doors off when it finishes its move to the final waypoint.

Ming

Two fairly comprehensive functions (classes I think the C# programmers use) GameWorld and IGamePlay (found so far) and there's a GamePlay.gpxxx class too

maddox.game.GameWorld

maddox.game.GameWorld.ActorByName(string)

b1 = GamePlay.gpActorByName("1_Chief");

AiActor b1
AiGroundActor ship1
ship1.Health()

maddox.game.GameWorld.ActorIsValid(maddox.game.world.AiActor)
maddox.game.GameWorld.AiAirGroup(int, int)
maddox.game.GameWorld.AirGroups(int)
maddox.game.GameWorld.Airports()
maddox.game.GameWorld.Armies()
maddox.game.GameWorld.BirthPlaces()
maddox.game.GameWorld.FindPath(maddox.GP.Point2d, double, maddox.GP.Point2d, double, maddox.game.PathType, int)
maddox.game.GameWorld.FrontArmy(double, double)
maddox.game.GameWorld.FrontDistance(int, double, double)
maddox.game.GameWorld.FrontExist()
maddox.game.GameWorld.GetAction(string)
maddox.game.GameWorld.GetTrigger(string)
maddox.game.GameWorld.GroundGroups(int)
maddox.game.GameWorld.LandType(double, double)
maddox.game.GameWorld.MakeAirGroup(maddox.game.world.AiAircraft[ ], maddox.game.world.AiAirWayPoint[ ])
maddox.game.GameWorld.SectorName(double, double)

Places where classes are used (from online-posted missions) - 3D map positions etc mentioned

GamePlay.gpGetTrigger (shortName). Enable = false;
GamePlay.gpGetTrigger ("t_4"). Enable = false;
Player pl = GamePlay.gpPlayer();
GamePlay.gpLogServer(players, msg, args);
foreach (int army in GamePlay.gpArmies())
{
foreach (AiAirGroup group in GamePlay.gpAirGroups(army))

int ar = GamePlay.gpFrontArmy(actor.Pos().x, actor.Pos().y);
double ds = GamePlay.gpFrontDistance(2, actor.Pos().x, actor.Pos().y);

if ((GamePlay.gpFrontDistance (2, aircraft.Pos (). x, aircraft.Pos (). y)) <100)

GamePlay.gpHUDLogCenter("Your wingman is killed!");

if (GamePlay.gpPlayer().Place() != null)

aa = GamePlay.gpActorByName("0:BoB_LW_JG27_I.300");

action = GamePlay.gpGetAction ("a3");
GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName)).Do();

GamePlay.gpPostMissionLoad(UKMissionPath + "ships.mis");

GamePlay.gpPostMissionLoad(DEMissionPath + DEMissions[rand.Next(0, DEMissions.Count)]);

GamePlay.gpLogServer(null, "{0} was destroyed by {1}", new object[] { (actor as AiCart).InternalTypeName().Substring(4), (damages[0].initiator.Player.Name()) });

if (GamePlay.gpGroundGroups(1).Length == 0 || GamePlay.gpGroundGroups(1) == null)

foreach (AiGroundGroup group in GamePlay.gpGroundGroups(1))

if (GamePlay.gpRemotePlayers() == null || GamePlay.gpRemotePlayers().Length <= 0)
return;

foreach (Player p in GamePlay.gpRemotePlayers())

if (GamePlay.gpTime().current() > checkTime) {

if (checkShip1 && ship1.Health() < 1.0) {

if (GamePlay.gpPlayer().Place() != null) {

maddox.GP.Loc.set(ref maddox.GP.Point3d)

public void set(ref maddox.GP.Point3d T2)
Member of maddox.GP.Loc

maddox.GP.Loc.transformInvP(ref maddox.GP.Point3d, out maddox.GP.Point3d)
_________________________
'You are either a hater or you are not' Roman Halter


Top
#3387723 - 09/11/11 02:19 PM Re: Ambulance Station: notes from the Cavern [Re: Ming_EAF19]
Ming_EAF19 Offline
Babelfish Immune
Veteran

Registered: 09/22/04
Posts: 10618
Loc: London
Drawn out the vehicle-ish functions and found

maddox.game.world.AiAIChief

maddox.game.world.AiAIChief.FieldR()

It's a derived type from AiGroundGroup (whatever that is, a derived type I mean) - but anyway it has the magic AIChief word

maddox.game.world.AiGroundActor is an object with three parameters/Properties-
int Fuel()
double Health()
maddox.game.world.AiGroundActorType Type()

-so that's likely describing a vehicle and there looks to be a way to engineer a vehicle to run out of fuel to check that one is getting closer to taking command of the vehicle from the script

Selected-for-ground-operations listing below with interesting items

AiWayPoint hmm Smile2

Ming

maddox.game.world.AiGroundGroup

GetPos(out maddox.GP.Point3d)
maddox.game.world.AiGroundGroup.GetPos(out maddox.GP.Point3d)

GroupType()
maddox.game.world.AiGroundGroup.GroupType()

ID()
maddox.game.world.AiGroundGroup.ID()

maddox.game.world.AiGroundActor
int Fuel()
double Health()
maddox.game.world.AiGroundActorType Type()

public interface AiGroundActor
Member of maddox.game.world

Base Type
public interface AiActor
Member of maddox.game.world

AiGroundActor has the same set of base types as AiActor
but with another base type - AiCart


AiCart members (members?)
maddox.game.world.AiCart.Carter()
maddox.game.world.AiCart.CrewFunctionPlace(int)
maddox.game.world.AiCart.Destroy()
maddox.game.world.AiCart.ExistCabin(int)
maddox.game.world.AiCart.InternalTypeName()
maddox.game.world.AiCart.Person(int)
maddox.game.world.AiCart.Places()
maddox.game.world.AiCart.Player(int)

maddox.game.world.AiGroundActorType
Examples:-
public const maddox.game.world.AiGroundActorType Truck = 11
public const maddox.game.world.AiGroundActorType Tank = 8
public const maddox.game.world.AiGroundActorType Motorcycle = 2

Base Type AiActor
maddox.game.world.AiActor.Army()
maddox.game.world.AiActor.Group()
maddox.game.world.AiActor.IsAlive()
maddox.game.world.AiActor.IsTaskComplete()
maddox.game.world.AiActor.IsValid()
maddox.game.world.AiActor.Name()
maddox.game.world.AiActor.Pos()
maddox.game.world.AiActor.Tag

Base Type AIGroup
maddox.game.world.AiGroup.GetItems()
maddox.game.world.AiGroup.GetWay()
maddox.game.world.AiGroup.SetWay(maddox.game.world.AiWayPoint[ ])
maddox.game.world.AiGroup.Idle

Derived Types
maddox.game.world.AiAIChief

maddox.game.world.AiAIChief.FieldR()

maddox.game.world.AiGroundGroupType
maddox.game.world.AiGroundGroupType.Artillery
maddox.game.world.AiGroundGroupType.Ship
maddox.game.world.AiGroundGroupType.Town
maddox.game.world.AiGroundGroupType.Train
maddox.game.world.AiGroundGroupType.Vehicle
(public const maddox.game.world.AiGroundGroupType Vehicle = 1)

maddox.game.world.AiGroundWayPoint
public AiGroundWayPoint(ref maddox.GP.Point3d p, double speed, double wait_time, double road_width)
maddox.game.world.AiGroundWayPoint.BridgeIdx
maddox.game.world.AiGroundWayPoint.roadWidth
maddox.game.world.AiGroundWayPoint.waitTime
_________________________
'You are either a hater or you are not' Roman Halter

Top

#3387729 - 09/11/11 02:28 PM Re: Ambulance Station: notes from the Cavern [Re: Ming_EAF19]
FearlessFrog Offline
Senior Member

Registered: 01/08/09
Posts: 4325
Loc: Vancouver, BC
On the way out the door, being shouted at by Mrs Frog, but wanted to leave some clues I've found Ming in my extensive and exhaustive minutes of research into the FMB and moving vehicles.

- I thought I saw a training mission with an ambulance in it. One of the training ones?

- Took a copy of the 'Training mission 4', to play with i.e. copied these

C:\Program Files (x86)\Steam\steamapps\common\il-2 sturmovik cliffs of dover\parts\bob\mission\training\training04.mis, .misroads and .briefing (i.e. three files) into my:

C:\Users\OlegMaddox\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Single

..directory (that way I can edit them).

- Opened up the FMB and fiddled with training04 in respect to vehicles, i.e:

- Clicking on a tilly car, the 'actor' part shows 'NPC' (non player character) ticked and a script of 'car.cpp' assigned, with the waypoint target being the spline1 road.

In the underlying mission file it translates to this line:

1_Chief Vehicle.Austin_10_Tilly gb /posx 29702.30/posy 248009.84 /script car.cpp/target 1_SplineRoad /num_units 2/marker0 circle_yellow/skin1 materialsSummer_RAF

So what I've learnt from this quick glance is:

- There are inbuilt scripts you can assign objects

- Spline roads can be pre-defined and assigned as targets to the scripts

- Additional scripting can reference these vehicles and also their targets.

So the next step would be something to change either the scripted associated with the vehicle, i.e. away from car.cpp to something that moved it itself, or perhaps change the end-point of the target spline, so as to move the car 'off-road' to where you want it to go (i.e. the location of the crashed aircraft).





Top
#3387742 - 09/11/11 02:58 PM Re: Ambulance Station: notes from the Cavern [Re: Ming_EAF19]
BKHZ_Furbs Offline
Member

Registered: 04/08/05
Posts: 2395
You know i have no idea what your talking about, but it sounds more promising than my TIR on the ceiling stuff. wave
_________________________


Top
#3387861 - 09/11/11 05:46 PM Re: Ambulance Station: notes from the Cavern [Re: Ming_EAF19]
FearlessFrog Offline
Senior Member

Registered: 01/08/09
Posts: 4325
Loc: Vancouver, BC
Ok, we have a working ambulance smile

The basic premise is that you just make up some new waypoint routes for a ground vehicle and then find something to trigger them, i.e. a OnCrashLanded event or a Mission menu call. Here's the summary, where I've added an extra menu item to the previous add-in I did here http://simhq.com/forum/ubbthreads.php/topics/3385237/New_API_in_the_Beta.html#Post3385237

To add the new menu item 'Call Ambulance' find this line in the previous post

Click to reveal..


GamePlay.gpSetOrderMissionMenu( player, true, 1, new string[] { "Destroy Wings", "Destroy Engine",
"Destroy Guns", "Report Damage On", "Report Damage Off"}, new bool[] { false, false, false, false, false } );


..and replace it with

Click to reveal..


GamePlay.gpSetOrderMissionMenu(player, true, 1, new string[] { "Destroy Wings", "Destroy Engine",
"Destroy Guns", "Report Damage On", "Report Damage Off", "Call Ambulance" }, new bool[] { false, false,
false, false, false, false });



New code is then after the last } of the menu:

Click to reveal..



else if (menuItemIndex == 6)
{
GamePlay.gpHUDLogCenter("Ambulance Dispatched!");

Player[] all = { player };

AiActor amb = GamePlay.gpActorByName("0_Chief"); // Our ambulance, defined as
first vehicle in mission
if (amb != null)
{
AiGroup g = (AiGroup)amb; // Everything with waypoints is always in groups
AiWayPoint[] waypoints = g.GetWay(); // Get the waypoints it had

foreach (AiWayPoint waypoint in waypoints)
{
//GamePlay.gpLogServer(all, "waypoint: x=" + waypoint.P.x.ToString() + " y=" +
waypoint.P.y.ToString(), null);
x = waypoint.P.x;
y = waypoint.P.y;
z = waypoint.P.z; // Remember this for late, as we need a good height from somewhere
}

Player me = GamePlay.gpPlayer();
AiActor where = me.Place();
Point3d pos = where.Pos(); // Get our position, i.e. where to send the ambulance
Point3d target = new Point3d(pos.x, pos.y, z); // Set our target to be us

//GamePlay.gpLogServer(all, "me: x=" + pos.x.ToString() + " y=" + pos.y.ToString()
+ " z=" + pos.z.ToString(), null);

// Note: Set the z height to be the last waypoint height rather than it's real height,
Pos seems a PoS
Point3d last_known = new Point3d(amb.Pos().x, amb.Pos().y, z);

AiGroundWayPoint[] newWaypoints = { new AiGroundWayPoint(ref last_known, 50.0, 0.0, 10.0),
new AiGroundWayPoint(ref target, 50.0, 0.0, 10.0) };

g.SetWay(newWaypoints); // Off we go, on new route!

AiWayPoint[] resetWaypoints = g.GetWay(); // Just diagnostics, i.e. can be removed
but basically to check they took
foreach (AiWayPoint waypoint in resetWaypoints)
{
//GamePlay.gpLogServer(all, "New waypoint: x=" + waypoint.P.x.ToString() + " y="
+ waypoint.P.y.ToString(), null);
}

}
setMainMenu(player);
}











Now it would be the opportunity to add some 3d positional sound (wooooo, woooooo) plus see if any of the parts on that vehicle can be modified with an animation (flashing light).

Sorry it's a bit rough. If needed, I can upload the mission file somewhere too.

Edit. Test mission uploaded here: http://www.megaupload.com/?d=ZL5XO3UV


Edited by FearlessFrog (09/20/11 06:28 PM)
Edit Reason: added preview to stop wideness

Top
#3388138 - 09/12/11 04:30 AM Re: Ambulance Station: notes from the Cavern [Re: Ming_EAF19]
No457_Squog Offline
Squadron Leader
Member

Registered: 06/05/01
Posts: 2260
Loc: Melbourne, Australia
(without me having tested the mission) Did the ambo tip you over because the waypoint co-ords are the same as yours?

Ideally you would want to call a mission with the ambo in it and teleport it to some pre-set co-ords at the player's field and then plan the waypoints to the player's plane.

This has real expand abilities - trucks dragging crashed wrecks off runways in use, fuel trucks etc...

PS: FF can we have a dedicated 'cliffs' scripting sub-forum?
_________________________
No457_Squog
Squadron Leader

No. 457 Squadron vRAAF

Top
#3388170 - 09/12/11 07:00 AM Re: Ambulance Station: notes from the Cavern [Re: Ming_EAF19]
Ming_EAF19 Offline
Babelfish Immune
Veteran

Registered: 09/22/04
Posts: 10618
Loc: London
Aaagh now it's my turn to be on the way out Smile2 (will test later, thanks!)

Quote:
AiActor amb = GamePlay.gpActorByName("0_Chief");

Gorgeous.

Very exciting developments thanks Frog and other contributors!

Ming
_________________________
'You are either a hater or you are not' Roman Halter

Top
#3388417 - 09/12/11 12:58 PM Re: Ambulance Station: notes from the Cavern [Re: Ming_EAF19]
FearlessFrog Offline
Senior Member

Registered: 01/08/09
Posts: 4325
Loc: Vancouver, BC
On sharing back the code (as seems proper, as I've used it as a source so many times) on the banana forum it looks like it prompted someone to add a lot more examples in this theme (is he (naryv) a Russian dev, not sure?)

http://forum.1cpublishing.eu/showthread.php?p=335269#post335269

That script dynamic creates vehicles that on an aircraft landing do the following:

- If you are damaged it sends a Fire Tender and Ambulance

- Sends a Fuel and Ammo supplies trucks

- If you are a bomber type that the Ammo truck also brings bombs (which you can see)

- If you land at an enemy base it sends a Tank out to capture you as a prisoner smile

Also, unlike the wee ambulance example, it will plot a FindPath course and not hurtle in to you, hastening your demise.


I'm unsure about a scripting sub-forum at the moment Ming, as I think we'd need more interest here to justify it other than just for me and you.

Top
#3388465 - 09/12/11 02:11 PM Re: Ambulance Station: notes from the Cavern [Re: Ming_EAF19]
Ming_EAF19 Offline
Babelfish Immune
Veteran

Registered: 09/22/04
Posts: 10618
Loc: London
Very kind of you thanks Frog, btw I didn't ask for a sub-forum that was Squog (who I know longtime to be a content creator and all-round good egg/virtual pilot), you'd need content before considering that so let's build some content if possible. You've given us a ton of stuff to play with thanks again Smile2

Ambulance races stand by, someone build a lawyer model Smile2

Ming
_________________________
'You are either a hater or you are not' Roman Halter

Top
#3388505 - 09/12/11 03:07 PM Re: Ambulance Station: notes from the Cavern [Re: No457_Squog]
FearlessFrog Offline
Senior Member

Registered: 01/08/09
Posts: 4325
Loc: Vancouver, BC
Originally Posted By: No457_Squog
(without me having tested the mission) Did the ambo tip you over because the waypoint co-ords are the same as yours?

Ideally you would want to call a mission with the ambo in it and teleport it to some pre-set co-ords at the player's field and then plan the waypoints to the player's plane.

This has real expand abilities - trucks dragging crashed wrecks off runways in use, fuel trucks etc...

PS: FF can we have a dedicated 'cliffs' scripting sub-forum?


The ambulance would occasionally go on a Mad Max style tour-de-force and get to the injured as fast as possible then only to massacre all who it found there, but the waypoint system seems to take not crashing into account sometimes. I think it's related to the wideness of the 'road' (as in the waypoint) and some object avoidance code.

The script I linked to on the banana forums does seem to do what you suggested, i.e. teleport in the vehicles if needed and then plot - I haven't tried it yet but the code looks great. We're collectively building up a good library of how-to's which is looking very promising so far.

Apologies on the Ming doppelganger clanger, I think once we have a bit more content then we could set one up.

Top
Page 1 of 6 1 2 3 4 5 6 >
Topic Options
Rate This Topic
Hop to:

Moderator:  RacerGT 
 

Forum Use Agreement | Privacy Statement
Copyright 1997-2013, SimHQ Inc. All Rights Reserved.