![]() |
Mission Menu and Ambulance
I spent a short bit of time looking at the new Beta API for a 'Mission Menu' and figuring out how to direct traffic. When you crash you can call for an ambulance.
Details and test mission download here: http://simhq.com/forum/ubbthreads.ph...ml#Post3387861 The interesting part of the script is here: Code:
else if (menuItemIndex == 6) |
Nice Idea
'SAAAAANNNNNIIIIII' ;) With the new command menu feature, we got a very interesting feature. |
This is insanely kewl.
What happens if one crash in enemyland and call for ambulance. :-D |
"... new Beta API for a 'Mission Menu' ..." ???
Where do you access/get a copy of the API? |
The API is part of the beta patch.
As for if you called it from far away, I've not tried it - but waypoint-wise it would just keep trucking till it got to you. |
You should use the "GamePlay.gpFindPath()" method to let the game engine calculate the waypoints. This way the car will not cross water and use roads and bridges.
As the calculation of the waypoints is done asynchronous (in a different thread) you have to wait until the calculation is finished: Code:
IRecalcPathParams pathParams = GamePlay.gpFindPath(start, 10.0, end, 20.0, PathType.GROUND, groundGroup.Army); Look for navyr's tank war example how to check the result of the path calculation within the OnTick() method. |
Quote:
Pseudocode: 1. On player crash-landing 2. Is crash-landing within home base radius? 3. If so, cycle through vehicle objects and see if there is an ambulance (&/or fire truck) 4. If an ambulance exists, Is the ambulance within the same home base radius as the crash landing? 5. If so, then send the ambulance to the crash site (calculate waypoints). |
Various emergency & service cars script by naryv posted an sukhoi.ru today.
Code:
using System; |
awesome :)
maybe we could soon see a script who call supply truck to come...rearm us and go :) |
Thanks Banks for the FindPath - yep, as I just put down the vehicle on the field I'd just do a quick A->B but that way is far better.
Ataros - Excellent script from narvy, could have done with that yesterday :) It seems to do quite a lot, such as make sure the vehicles don't bump into the target aircraft (my ambulance was quite destructive) and dynamically spawn the vehicles in the airport dependent on the activity/closeness. I love that on landing it can decide whether to put out a fire, re-arm you or go capture you as an enemy. Good stuff - thanks. |
Two questions of a curious user (who wouldn't know how to code if his life depended on it):
1.) Wouldn't it be more logical to automate the process of ambulance and firetruck rushing to a damaged aircraft? 2.) Would it be possible to derive a similar procedure for rescue launches or similar "lifeboats"? I mean the Brits had them on the coast and the germans used whatever was locally available for the same purposes. It may be window-dressing for the moment but may be of importance later on (keyword: pilot-centric campaign). |
1.) Wouldn't it be more logical to automate the process of ambulance and firetruck rushing to a damaged aircraft?
Exactly so, inbound to land is a damaged plane - set up to meet it with ambulance/fire engine Trigger will be perhaps- DamagedPlane crosses some AirfieldEmergency radius - warm up ambulance and fire tender If definitely landing, equipment approaches runway. Carefully :) Ming |
It's the coolest CoD FMB moment so far for me, it is a wonder thanks naryv your AirfieldEmergency script works first time perfectly. Awesome :)
http://simhq.com/forum/ubbthreads.ph...ml#Post3388512 Ming |
Quote:
(2) That's a great idea and very possible. |
In the radio comms there is a command where you can call the tower for emergency. Could this be used as a trigger and have ambulance and firetruck rush out to the runway?
|
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 |
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 |
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? |
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 |
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:
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 |
Quote:
http://img716.imageshack.us/img716/9...pboard03ra.jpg After a ''perfect'' wheels up landing they send me winch, fuel, ammo and bombs (spend previous load before landing)! :) Ambulance is not need. :) Sokol1 |
Quote:
Code:
if (!CurTechCars.Contains(TmpCar)) 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) |
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!
|
Quote:
|
Quote:
|
Quote:
BTW can you make the new aircraft to spawn at exactly the same position heading the same direction as the old one? If yes, the change would be hardly noticeable for a player. |
Quote:
Anyone else dealt with a rotation angle? |
I demand fully-automated working traffic lights in London town and fleets of Routemasters. Civilization: Cliffs of Dover
Next Week's Demand Or The Kitten Gets It: a flocking algorithm for Heinkels Ming :) |
Quote:
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.... |
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.
|
Quote:
Code:
... |
Yes that's looking good :)
I haven't tested your one but it should work. I left in the condition to check for an airfield and added the condition to check for player planes: Code:
public override void OnAircraftLanded(int missionNumber, string shortName, AiAircraft aircraft) If you've got any hints for setting up a repair script, please share :) I can't find the scripting commands in the beta code, so any pointers would be welcome! I'm hoping that we can get a reference page for scripting commands on a wiki, much like this one: http://community.bistudio.com/wiki/C...Commands_ArmA2 That would be really useful. |
Quote:
Regarding spawn delay I have a concern: what happens when a marker is captured and then a delayed spawn of a defending tank group occurs? Probably the marker color changes again and it is recaptured by the defending side? |
Hey all I'm new to Cliffs FMB but long time lurker here and decided to register as this script has me stumped.
So I have made my MP Dogfight Mission, its ready and working. So can someone give me a quite instruction on how to put this ambulance script into my game (which ever script is best). Sorry if its real simple by the way but i cant understand how to. Thank you Gerbil M |
1. Copy and paste the script to notepad and save as a .cs file (not .cs.txt !!!) The file must have the same name as the mission .mis file.
2. Put the .cs file in the same directory as .mis file. 3. Run the mission. |
Ah rgr i see thank you Ataros :) will test soon so this should work for every airfield in my MP map?
|
Gerbil you can also add the script to your mission by- after the copy operation Ataros speaks of above, if your FMB is running and you are looking at your mission, you can go to the Script tab and paste the text in there to create the script. This can be easier than finding the mission on your computer :)
(I tell you this to point out that CoD is Windows-friendly, standard Windows operations like Ctrl + v work) Ming |
Rgr Thank you
|
Quote:
Thanks |
Quote:
|
Quote:
Thanks |
Player Class: PlaceEnter(Actor, Placeindex)
example: player.PlaceEnter(Aircraft, 0); |
Quote:
|
New/updated service vehicle, ambulance, fire truck mission plug-in
Thanks to everyone who posted about the ambulance script on this thread. I've worked on an updated version of it that is designed to work in multiuser servers (though it should work offline just as well).
- Vehicles spawn in along with you & then drive off (ie, your service vehicles just finished with getting your a/c ready, then they drive off) - When you land (full stop landing--putting chocks in will make sure) the fuel & repair trucks will come trundling up pretty soon. - Whenever you crash, even just borking up a takeoff & damaging your propeller & undercarriage, you'll soon be visited by an ambulance and a fire truck. Even if you crash out in the middle of nowhere. Only exception would be in water--they if close to the shore the emergency vehicles will do their best & drive right up to the shore. (Rescue boats will hae to come in a future version I guess. Someone to pick you up when you parachute in could be a future improvement as well.) - Vehicles mostly avoid you but if you hit them they WILL damage you. So you have to look sharp & avoid. - Vehicles travel to & from Spawn Points (ie, "Birthplace" in the .mis files) preferentially. They always travel more or less directly between the target aircraft & an area immediately around the spawn point .This gives you general control over where the vehicles appear & where they travel to/park just by moving the spawn point at your airfield in FMB. - I couldn't get the "reuse old vehicles at the same airport" code to work at all, so this simply spawns in new vehicles every time & then spawns them out after they are no longer needed. It seems to work fine so far. -You're welcome to use as is or adapt for use in your own scripts, missions, servers, etc. - It's designed to be a painless plug-in to any existing mission. It's a self-standing mission, so you just put it in your mission folder & then load it as a sub-mission during OnBattleStarted(). ZIP file with script & mission files, sample code, instructions all in one FILE: auto-generate-vehicles.cs <see separate message> The mission file is just a stub and you don't need anything in it except the headers (and maybe not even those--I haven't really experimented). It just allows your main .cs file to load the auto-vehicle-generate.cs neatly as a sub-mission. However I like to keep a minimal .mis file in place with a map, weather, etc. because then you can edit & run it easily in FMB. That is helpful for testing. Here is my sample .mis file: FILE: auto-generate-vehicles.mis Code:
[PARTS] FILE: main.cs Code:
public override void OnBattleStarted() Code:
public void ReadInitialSubmissions(string filenameID, int timespread=60, int wait=0) Code:
////////////////////////////////////////////////////////////////////////////////////////////////// I believe that conf.ini pertains to your regular Launcher.exe process and confs.ini applies if you are running "Launcher.exe -server" as a dedicated server. Note that you will need to exit Launcher.exe, then edit and save conf.ini & confs.ini, then re-start Launcher.exe. If you don't follow this process, your conf.ini and/or confs.ini will be overwritten when Launcher.exe exits. Code:
[rts] Again: ZIP file with script & mission files, sample code, instructions all in one |
Quote:
Code:
// Note that I trimmed down some comments, debugging code, etc to make it fit on the forum better. Full code is in the ZIP file with script & mission files, sample code, instructions all in one |
Quote:
Code:
///TODO: This is highly repetitious & could be abstracted to a single simpler |
All times are GMT. The time now is 03:47 AM. |
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.