View Full Version : Choosing parking positions
EG14_Marcast
Apr-17-2013, 09:58
Creating a mission with "spawn parked" aircrafts, is there any command to determine the parking positions at game's start? So far I used the trick to fill with static planes the positions I don't want to be used, but in this way I have a lot of useless ground objects.
I try:
Put static objects in all spawn positions minus in the first where I want the plane spawn.
Save the mission, open (with Notepad) the .mis file, and remove all static objects.
Save an test, and plane spawn... in the last point! :grrr:
Sokol1
EG14_Marcast
Apr-17-2013, 12:43
I try:
Put static objects in all spawn positions minus in the first where I want the plane spawn.
Save the mission, open (with Notepad) the .mis file, and remove all static objects.
Save an test, and plane spawn... in the last point! :grrr:
It's a good idea...the problem is that I want to keep some static objects in the airfield, but I could solve this using only one type for the "baits" and deleting only those. I'll try:)
EG14_Marcast
Apr-17-2013, 18:43
It doesn't work. After I've deleted ground objects, the starting position returns the same as before:grrr:
Here's a quick & very dirty solution. Place stationary objects over the spawn points you do not want to use. After you spawn-in, the script will remove the stationary objects.
using System;
using maddox.game;
using maddox.game.world;
using maddox.GP;
using part;
public class Mission : AMission
{
public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceEnter(player, actor, placeIndex);
Timeout(1.0, () =>
{
foreach (GroundStationary gs in GamePlay.gpGroundStationarys())
{
Point3d p = new Point3d();
p.x = gs.pos.x;
p.y = gs.pos.y;
p.z = gs.pos.z;
if (actor.Pos().distance(ref p) < 1500 && actor.Name().Contains("Austin_10_Tilly")) gs.Destroy();
}
});
}
}
EG14_Marcast
Apr-18-2013, 05:12
Here's a quick & very dirty solution. Place stationary objects over the spawn points you do not want to use. After you spawn-in, the script will remove the stationary objects.
Thanks! But I'm not familiar at all with scripting; shall I copy that script and copy where in the mission file?
Thanks! But I'm not familiar at all with scripting; shall I copy that script and copy where in the mission file?
No, not copied into the mission file. Just copy the script text above, & paste into a seperate text file (say using notepad). Save the file with the same name as your mission file name, but with a .cs extension. eg. If your mission file is called MyMission.mis then save the script as MyMission.cs make sure that both the mission file & script file are in the same directory & launch your mission. The script will run automatically with the mission.
92 Sqn. Philstyle (QJ-P)
Apr-18-2013, 06:16
@Salmo,
I have been wondering for months how to get scripts to be recognised. I'm going to make it a seperate thread if that's ok?
EG14_Marcast
Apr-18-2013, 11:56
No, not copied into the mission file. Just copy the script text above, & paste into a seperate text file (say using notepad). Save the file with the same name as your mission file name, but with a .cs extension. eg. If your mission file is called MyMission.mis then save the script as MyMission.cs make sure that both the mission file & script file are in the same directory & launch your mission. The script will run automatically with the mission.
Understood. Let me ask you something else: I understand that this script removes all static objects from the mission. As I like to place some objects (planes, vehicles, buildings...) in an airfield, would it be possible that the script removed only specific objects, i.e. a type of truck? So I could use only those ones to fill the spawn points, keeping all the others.
Understood. Let me ask you something else: I understand that this script removes all static objects from the mission. As I like to place some objects (planes, vehicles, buildings...) in an airfield, would it be possible that the script removed only specific objects, i.e. a type of truck? So I could use only those ones to fill the spawn points, keeping all the others.
Absolutely possible. I've changed the relevent line in the above script. All static "tilly car" objects within 1500m of the spawn point are deleted
if (actor.Pos().distance(ref p) < 1500 && actor.Name().Contains("Austin_10_Tilly") gs.Destroy();
EG14_Marcast
Apr-19-2013, 04:29
Absolutely possible. I've changed the relevent line in the above script. All static "tilly car" objects within 1500m of the spawn point are deleted
This is exactly what I needed, thanks a lot!
EG14_Marcast
Apr-20-2013, 13:08
Absolutely possible. I've changed the relevent line in the above script. All static "tilly car" objects within 1500m of the spawn point are deleted
if (actor.Pos().distance(ref p) < 1500 && actor.Name().Contains("Austin_10_Tilly") gs.Destroy();
I followed your instructions but it doesn't work...when I spawn in, the airfield is full of austin cars. Strange enough, because it's a German airfield:)
I followed your instructions but it doesn't work...when I spawn in, the airfield is full of austin cars. Strange enough, because it's a German airfield:)
Woops, there was a minor error in the script that caused it not to run with the mission. I've updated the 1st post with the corrected script. I've added another closed-bracket after the tilly car name (in red-bold below).
if (actor.Pos().distance(ref p) < 1500 && actor.Name().Contains("Austin_10_Tilly")) gs.Destroy();
Salmo,
does this only work once? If you spawn in - cars disappear, but what if you want to respawn, is it random again or are you forced to use the same spawn point?
Thanks
Hood
Salmo,
does this only work once? If you spawn in - cars disappear, but what if you want to respawn, is it random again or are you forced to use the same spawn point?
Thanks
Hood
It works just once. The cars are placed over spawn points by the mission builder, so this forces the player to spawn at only the non-masked spawn points. Once the player spawns cars are removed for asthetic reasons, so at the next spawning, all spawn points are available & the game code may spawn you in a non-prefered location. As I said, in the 1st post, it's a quick & dirty solution to the problem. If I devoted more time to the issue I'd prefer a different methology.
SG1_sandokito
Apr-22-2013, 13:33
if you understand Spanish, there is a mini tutorial to create one home base.
Take off road, taxi road, and spawn point to your home base.
http://www.escuadron69.net/v20/foro/index.php?/topic/55537-parte-ii-tutorialfmb-objetos/
EG14_Marcast
Apr-22-2013, 14:03
Woops, there was a minor error in the script that caused it not to run with the mission. I've updated the 1st post with the corrected script. I've added another closed-bracket after the tilly car name (in red-bold below).
if (actor.Pos().distance(ref p) < 1500 && actor.Name().Contains("Austin_10_Tilly")) gs.Destroy();
It still doesn't work...I also tried to set the range at 5000 instead of 1500 but the cars are still there..
I test too, with stationary vehicle and AI vehicle "Austin_10_Tilly" and none are removed.
Sokol1
It still doesn't work...I also tried to set the range at 5000 instead of 1500 but the cars are still there..
Thanks Guys, I'm at work at the moment. Will sort it out when I get home.
EG14_Marcast
Apr-23-2013, 04:57
if you understand Spanish, there is a mini tutorial to create one home base.
Take off road, taxi road, and spawn point to your home base.
http://www.escuadron69.net/v20/foro/index.php?/topic/55537-parte-ii-tutorialfmb-objetos/
Very useful guide, thank you.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.