PDA

View Full Version : How to make scripts work with your missions



92 Sqn. Philstyle (QJ-P)
Apr-18-2013, 06:18
This comes from the eminent Salmo:

There is a simple 3-step process to getting scripts to run with your missions;


Copy the script text and paste it into a new text file (say using notepad).

Save this new file with the same name as your mission file name, but with a .cs extension; e.g. 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.

ATAG_Snapper
Apr-18-2013, 06:36
Stickied. Thanks both to Salmo (I never knew until now how a script was incorporated into a mission. Now I know. :D ).....and:

Thanks, Phil, for summarizing in point form and giving Salmo's instructions its rightfully own thread.

Basha
Aug-29-2013, 08:36
Can multiple scripts required go on 1 .cs file or do individual script elements need there own .cs file or could it be either or ?

ATAG_Lolsav
Mar-12-2014, 00:23
Basha: Yes, but they need to be properly accomodated, ie, under the main script file "header", usually "Amission" type of name

dog1
Jan-12-2017, 11:39
hello
i am new to COD but veteran in IL2 mod ,i have some basic questions:
1) what is a script and where can i see examples of them and how to make and use them ?
2) once you have one you add it to the mission file in the same folder ?

ATAG_Bliss
Jan-12-2017, 11:53
hello
i am new to COD but veteran in IL2 mod ,i have some basic questions:
1) what is a script and where can i see examples of them and how to make and use them ?
2) once you have one you add it to the mission file in the same folder ?

A script is basically snippets of code that allow you to have certain things happen in a mission (IE - objectives, scoring, spawning of AI aircraft/objects, destruction of airfields, mission end time, on screen messages, etc.,etc.,etc) Scripts are located in the (.cs) file. Essentially you wil have a (.mis) file, the mission file.. You will have a (.cs file) the script file. And you will have a briefing file for your mission briefing.

Can a mission be created without any scripts? Definitely. But to do some of the more fancier stuff you see, there is code work required.

Here's a collection of some old ATAG missions for our online server:http://theairtacticalassaultgroup.com/forum/Downloads.php?do=download&downloadid=7

And if you are interested in running an online server, here is ATAG's server commander you can download: http://theairtacticalassaultgroup.com/forum/Downloads.php?do=download&downloadid=5

I would suggest looking at Wolverine's mission which has quite extensive coding involved if you really want to dive in: http://theairtacticalassaultgroup.com/forum/Downloads.php?do=download&downloadid=47

One final note: Within the FMB you can open up a script screen to copy/paste/write scripts although it's much easier to do it in Notepad+ or Visual Basic, etc., but the key component within the FMB, within the script window, is the ability to "compile" your code. This will check your code for errors with regards to using it inside Cliffs of Dover. It's very handy.

Good luck ;)

dog1
Jan-13-2017, 04:26
thank you very much for the extensive explanation and links, i will study all the above and begin practicing .

xpupx
Dec-12-2017, 19:13
Is the in game script editor still working? I cant get a single enemy aircraft to spawn with player pass through or army air triggers?
The only thing that will trigger are ships!!
Any ideas??
:grrr:

TWC_Fatal_Error
Dec-13-2017, 08:10
what do you have can you send an example show me you triggers set up from the mission file

1lokos
Dec-13-2017, 10:14
xpupx
Is the in game script editor still working? I cant get a single enemy aircraft to spawn with player pass through or army air triggers?
The only thing that will trigger are ships!!
Any ideas??

If I remember correctly FMB "pass though" is bugged since MG "drama" days, is need add a bit of code in the "script" box in FMB to make then work. I think is this:



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

public class Mission : AMission
{
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);

if ("Trigger_name".Equals(shortName) && active)
{
AiAction action = GamePlay.gpGetAction("Trigger_name"); //same as YourTriggerName
GamePlay.gpLogServer(null, "Test", new object[] { }); //Testmessage
if (action != null)
{
action.Do();
}
GamePlay.gpGetTrigger(shortName).Enable = false;
}
}
}

Salmo
Dec-13-2017, 22:06
Is the in game script editor still working? I cant get a single enemy aircraft to spawn with player pass through or army air triggers?
The only thing that will trigger are ships!!
Any ideas??
:grrr:

1Lokos is indeed correct when he says the script GUI window in FMB is bugged. It's on TFS's long TODO list.

xpupx
Dec-17-2017, 05:03
Is it just me or FMB missions not working at all now ?
I get to the create aircraft button and nothing happens? Seem to remember this happening in the first version of the game?
Can someone let me know if:
FMB missions works in MP?
Scripts made in the FMB scripting tool work in a MP mission?
Is the Weather working now?
Regards...