Jump to content

No me crea archivos cs


vencejo

Recommended Posts

Jau:

Estoy creando una misión con un script muy sencillito, pero cuando guardo la misión solo me crea el *.mis.

El script es del tipo crear avión cuando atraviesas un área. El activador y lo que tiene que hacer tienen el mismo nombre, está seleccionado el avión que tiene que crearse, y tiene seleccionado en sus propiedades "solo de script" o parecido.

 

Es una misión que tenía desde hace tiempo que siempre ha funcionado hasta hace un rato. He mirado en su carpeta y efectivamente solo está el mis. La he editado rehaciendo el script (que ya estaba) pero no hay manera de que me cree el cs.

¿Que podría ser que estoy haciendo mal?

Gracias

Link to comment
Share on other sites

Pues que el editor de misiones no te crea los .cs, pero tranquilo que los activadores que pongas si funcionan.

 

Para que te cree en .cs, tendrías que ir a la tercera pestaña y programarlo. Para lo cual es mejor crear el cs desde fuera.

 

Yo el .cs, solo lo utilizo para darle a un mismo activador diferentes funciones.

Ejemplo:

Quiero que me cree un grupo en el aire pero ademas quiero que me mande un mensaje de pantalla indicando que el grupo se ha creado.

 

en el .mis

 

[Trigger]
spd TPassThrough 5 2 99071 171457 2050
spd2 TPassThrough 5 2 99481 162922 2450
bombar TPassThrough 5 2 99417 151426 2450
[Action]
spd ASpawnGroup 1 BoB_RAF_F_600Sqn_Late.01
spd2 ASpawnGroup 1 BoB_RAF_F_501Sqn_Late.01
bombar ASpawnGroup 1 BoB_RAF_F_FatCat_Early.01

 

Con esto, la mision funcionaría de forma correcta. Pero si ademas quieres agregarle texto...

 

Esto en el Cs

 

if ("spd".Equals(shortName) && active)
{
GamePlay.gpHUDLogCenter("spitis tontos creados");
GamePlay.gpGetTrigger(shortName).Enable = false;


}
if ("spd2".Equals(shortName) && active)
{
GamePlay.gpHUDLogCenter("spitis listos creados");
GamePlay.gpGetTrigger(shortName).Enable = false;


}

if ("bomber".Equals(shortName) && active)
{
GamePlay.gpHUDLogCenter("bomber tontos creados");
GamePlay.gpGetTrigger(shortName).Enable = false;
}

 

Le estas diciendo que cuando el activador se ponga en marcha, ademas de efectuar la acción ya definida en la misión le pide que mande un mensaje a pantalla.

 

Lo bueno de poder trabajar con el .cs, es que también te permite crear muchos grupos distintos, con un solo trigger.

Ejemplo,:

Quiero crear muchos vuelos distintos, al mismo tiempo. Para lo cual tienes dos opciones.

Crear una activador y condicionante por vuelo,(metodo sin .cs)

 

O la que yo empleo,poner un activador, y multiples acciones de forma que luego en el cs lo programas.

 

Ejemplo

.mis

 

[Trigger]
vuelo TTime 300
[Action]
vu4 ASpawnGroup 1 BoB_LW_LG2_I.03
vu3 ASpawnGroup 1 BoB_LW_KuFlGr_706.03
vu2 ASpawnGroup 1 BoB_RAF_F_FatCat_Early.11
vu1 ASpawnGroup 1 BoB_RAF_F_FatCat_Early.01

 

.cs

if (shortName.Equals("vuelo"))
{

List<string> actions = new List<string> { "vu1", "vu2", "vu3", "vu4" };

actions.ForEach(item =>
{
AiAction action = GamePlay.gpGetAction(item);
if (action != null)
action.Do();
});
GamePlay.gpGetTrigger(shortName).Enable = false; // para multiples acciones.

 

Bien te lo traduzco. Primero le dices que si el condicionante de vuelo se activa. Te cree los condicionantes de la lista :List<string> actions = new List<string> { "vu1", "vu2", "vu3", "vu4" };

 

Espero no liarte más de lo que creo que ya estas pero resumiendo que para la misión que tu tienes, no necesitas crear el cs, porque los activadores y las acciones que programes en el .mis funcionaran sin problema

Edited by sandokito
Link to comment
Share on other sites

Otras opciones que tiene el poder usar el .cs, es para poner un tiempo de desaparición de aparatos cuando el piloto lo deja.

 

Este es uno de los metodos empleados.

using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;

public class Mission : AMission
{
public void _DespawnEmptyPlane(AiActor actor)
{
if (actor == null)
{ return;}

Player[] Players = GamePlay.gpRemotePlayers();

bool PlaneIsEmpty = true;

foreach (Player i in Players)
{
if ((i.Place() as AiAircraft) == (actor as AiAircraft))
{
PlaneIsEmpty = false;
break;
}
}

 

Otra opción es con tiempo

 

using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;

public class Mission : AMission

private void destroyPlane (AiAircraft aircraft) {
if (aircraft != null) {
aircraft.Destroy ();
}
}

private void explodeFuelTank (AiAircraft aircraft)
{
if (aircraft != null)
{
aircraft.hitNamed (part.NamedDamageTypes.FuelTank0Exploded);
}
}

private void destroyAiControlledPlane (AiAircraft aircraft) {
if (isAiControlledPlane (aircraft)) {
destroyPlane (aircraft);
}
}

private void damageAiControlledPlane (AiActor actor) {
if (actor == null || !(actor is AiAircraft)) {
return;
}

AiAircraft aircraft = (actor as AiAircraft);

if (!isAiControlledPlane (aircraft)) {
return;
}

if (aircraft == null) {
return;
}

aircraft.hitNamed (part.NamedDamageTypes.ControlsElevatorDisabled);
aircraft.hitNamed (part.NamedDamageTypes.ControlsAileronsDisabled);
aircraft.hitNamed (part.NamedDamageTypes.ControlsRudderDisabled);
aircraft.hitNamed (part.NamedDamageTypes.FuelPumpFailure);

int iNumOfEngines = (aircraft.Group() as AiAirGroup).aircraftEnginesNum();
for (int i = 0; i < iNumOfEngines; i++)
{
aircraft.hitNamed((part.NamedDamageTypes)Enum.Parse(typeof(part.NamedDamageTypes), "Eng" + i.ToString() + "TotalFailure"));
}

/***Timeout (240, () =>
{explodeFuelTank (aircraft);}
);
* ***/

Timeout (300, () =>
{destroyPlane (aircraft);}
);
}

public override void Init(maddox.game.ABattle battle, int missionNumber)
{
base.Init(battle, missionNumber);
MissionNumberListener = -1; // que tenga encuenta los eventos de todas las misiones suponiendo que cargues submisiones claro.
}

 

aclararte que esto son partes de Scrips mas completos que utilizo para las misiones, y así podríamos hacer todo lo que tu imaginación quiera.

Edited by sandokito
Link to comment
Share on other sites

Dudo que se pueda hacer todo lo que mi imaginación quiere... ladrón.

 

Pues es que no va. Pensaba que era por no haber cs. Voy a verlo mas detenídamente. Esta es la mis:

 

[PARTS]
core.100
bob.100
[MAIN]
MAP Land$Online_Map
BattleArea 150000 100000 100000 150000 1000
TIME 12
WeatherIndex 0
CloudsHeight 1000
BreezeActivity 10
ThermalActivity 10
player BoB_LW_LG2_I.000
[splines]
[AirGroups]
BoB_RAF_F_FatCat_Early.01
BoB_LW_LG2_I.01
[boB_RAF_F_FatCat_Early.01]
Flight0 1
Class Aircraft.SpitfireMkIIa
Formation VIC3
CallSign 26
Fuel 100
Weapons 1
Skill 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
[boB_RAF_F_FatCat_Early.01_Way]
NORMFLY 23573.33 24170.67 500.00 300.00
NORMFLY 25386.67 26090.67 500.00 300.00
NORMFLY 26240.00 22016.00 500.00 300.00
NORMFLY 22485.33 22826.67 500.00 300.00
NORMFLY 20501.33 25536.00 500.00 300.00
NORMFLY 25045.33 26090.67 500.00 300.00
[boB_LW_LG2_I.01]
Flight0 1
Class Aircraft.Bf-109E-1
Formation FINGERFOUR
CallSign 30
Fuel 100
Weapons 1
Skill 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
BandColor0 0.92 0.72 0.15 0.80 0.80 0.80 0.15 0.15 0.15
[boB_LW_LG2_I.01_Way]
NORMFLY 19349.33 19818.67 500.00 300.00
NORMFLY 23168.00 23530.67 500.00 300.00
[CustomChiefs]
[stationary]
[buildings]
[buildingsLinks]
[Trigger]
beau TPassThrough 2 2 20437 20821 500
[Action]
beau ASpawnGroup 1 BoB_RAF_F_FatCat_Early.01

Link to comment
Share on other sites

[PARTS]

core.100

bob.100

[MAIN]

MAP Land$Online_Map

BattleArea 0 0 40960 40960 10000

TIME 12

WeatherIndex 0

CloudsHeight 1000

BreezeActivity 10

ThermalActivity 10

player BoB_LW_LG2_I.000

[GlobalWind_0]

Power 3.000 0.000 0.000

BottomBound 0.00

TopBound 1500.00

GustPower 5

GustAngle 45

[splines]

[AirGroups]

BoB_RAF_F_FatCat_Early.21

BoB_LW_LG2_I.01

[boB_RAF_F_FatCat_Early.21]

Flight0 1

Class Aircraft.SpitfireMkIIa

Formation VIC3

CallSign 27

Fuel 100

Weapons 1

SpawnFromScript 1

Skill 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3

[boB_RAF_F_FatCat_Early.21_Way]

NORMFLY 23573.33 24170.67 500.00 300.00

NORMFLY 25386.67 26090.67 500.00 300.00

NORMFLY 26240.00 22016.00 500.00 300.00

NORMFLY 22485.33 22826.67 500.00 300.00

NORMFLY 20501.33 25536.00 500.00 300.00

NORMFLY 25045.33 26090.67 500.00 300.00

[boB_LW_LG2_I.01]

Flight0 1

Class Aircraft.Bf-109E-1

Formation FINGERFOUR

CallSign 30

Fuel 100

Weapons 1

Skill 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3

[boB_LW_LG2_I.01_Way]

NORMFLY 19349.33 19818.67 500.00 300.00

NORMFLY 23168.00 23530.67 500.00 300.00

[CustomChiefs]

[stationary]

[buildings]

[buildingsLinks]

[Trigger]

beau TPassThrough 5 2 20437 20821 500

[Action]

beau ASpawnGroup 1 BoB_RAF_F_FatCat_Early.21

listo rullando sin problemas

Te faltaba esto

SpawnFromScript 1

 

Aparte que he cambiando el trigger a activación por armada del aire azul. Pero esto son manías mías.

Edited by sandokito
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Some pretty cookies are used in this website